Skip to content

Commit

Permalink
Merge pull request #384 from kevincerro/hotfix/static-website-public-…
Browse files Browse the repository at this point in the history
…access

Add BlockPublicAccess required config
  • Loading branch information
mnapoli authored Jun 22, 2024
2 parents eec40f4 + d0a227c commit 0d56286
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/constructs/aws/StaticWebsite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FunctionEventType } from "aws-cdk-lib/aws-cloudfront";
import type { Construct as CdkConstruct } from "constructs";
import type { AwsProvider } from "@lift/providers";
import type { BucketProps } from "aws-cdk-lib/aws-s3";
import { BlockPublicAccess } from "aws-cdk-lib/aws-s3";
import { RemovalPolicy } from "aws-cdk-lib";
import { redirectToMainDomain } from "../../classes/cloudfrontFunctions";
import { getCfnFunctionAssociations } from "../../utils/getDefaultCfnFunctionAssociations";
Expand Down Expand Up @@ -71,6 +72,12 @@ export class StaticWebsite extends StaticWebsiteAbstract {
websiteErrorDocument: this.errorPath(),
// public read access is required when enabling static website hosting
publicReadAccess: true,
blockPublicAccess: new BlockPublicAccess({
blockPublicAcls: false,
blockPublicPolicy: false,
ignorePublicAcls: false,
restrictPublicBuckets: false,
}),
// For a static website, the content is code that should be versioned elsewhere
removalPolicy: RemovalPolicy.DESTROY,
};
Expand Down

0 comments on commit 0d56286

Please sign in to comment.