fix(infra): make backups S3 bucket private and block public access#121
Open
hacktron-app-stg[bot] wants to merge 1 commit into
Open
fix(infra): make backups S3 bucket private and block public access#121hacktron-app-stg[bot] wants to merge 1 commit into
hacktron-app-stg[bot] wants to merge 1 commit into
Conversation
Remove the public-read ACL from the corp-prod-backups bucket, set an explicit private ACL, and enable all public access block protections so backup objects are no longer exposed to the public internet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vulnerability
infra.tfdefined theaws_s3_bucket.backupsbucket (corp-prod-backups) withacl = "public-read", and the associatedaws_s3_bucket_public_access_blockexplicitly disabled all four public-access protections (block_public_acls,block_public_policy,ignore_public_acls,restrict_public_bucketswere allfalse). This made any object stored in the bucket — including production backups — readable by unauthenticated users over the internet.Fix
acl = "public-read"argument fromaws_s3_bucket.backups.aws_s3_bucket_aclresource set toprivate(the modern, non-deprecated way to manage bucket ACLs).aws_s3_bucket_public_access_blockflags totrue, guaranteeing public ACLs/policies are blocked and ignored.The change is scoped to the reported finding (lines 4–15); the other resources in the file are left untouched.
Verification
Reviewed the resulting configuration for correctness against AWS provider idioms. Terraform is not installed in the sandbox, so
terraform validate/plancould not be run, but the change uses standard, current provider resources and arguments.Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/e5b5944b-951d-4deb-9327-41ddf305cb86