Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bucket versioning #1522

Merged
merged 6 commits into from
Sep 10, 2024
Merged

Add bucket versioning #1522

merged 6 commits into from
Sep 10, 2024

Conversation

noah-paige
Copy link
Contributor

Feature or Bugfix

  • Enhancement

Detail

  • Add bucket versioning to any bucket that does not have
    • Pipeline Artifacts Bucket
    • CloudFront FE Bucket
    • Cloudfront User Guide Bucket

Relates

N/A

Security

Please answer the questions below briefly where applicable, or write N/A. Based on
OWASP 10.

  • Does this PR introduce or modify any input fields or queries - this includes
    fetching data from storage outside the application (e.g. a database, an S3 bucket)?
    • Is the input sanitized?
    • What precautions are you taking before deserializing the data you consume?
    • Is injection prevented by parametrizing queries?
    • Have you ensured no eval or similar functions are used?
  • Does this PR introduce any functionality or component that requires authorization?
    • How have you ensured it respects the existing AuthN/AuthZ mechanisms?
    • Are you logging failed auth attempts?
  • Are you using or adding any cryptographic features?
    • Do you use a standard proven implementations?
    • Are the used keys controlled by the customer? Where are they stored?
  • Are you introducing any new policies/roles/users?
    • Have you used the least-privilege principle? How?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@noah-paige
Copy link
Contributor Author

noah-paige commented Sep 5, 2024

Explanation of Checkov Baseline Updates:

  • 3 removals of CKV_AWS_21 for the 3 buckets that now enable bucket versioning
  • 1 removal of CKV_AWS_11 for the scoped down permissiosn by specifying own artifacts bucket rather than letting cdk create one
  • 1 rename of resource from AWS::S3::Bucket.dataallmaincdkpipelinePipelineArtifactsBucketF1C6C602 to AWS::S3::Bucket.pipelineartifactsbucketE44F7DE9 from CDK created artifacts bucket to manually created one

Testing:

  • Deploy to AWS in us-east-1, cross account, internet facing deployment
  • Pipeline successful
  • FE accessible - APIs working as expected

@dlpzx dlpzx self-requested a review September 9, 2024 06:29
@dlpzx
Copy link
Contributor

dlpzx commented Sep 9, 2024

Overall changes look good! Thanks for the PR @noah-paige. I have 2 general comments:
I see that there are still 2 buckets with the CKV_AWS_21 enabled in the baseline. Are we planning to work on them?

  • the CDK pipelines cross region replication bucket
  • the data.all pipelines artifacts bucket

I wanted to verify that the update works for existing deployments, so I am merging this branch to an existing environment to double test the PR. I'll post here the results ---> UPDATE: all good!

@noah-paige
Copy link
Contributor Author

@dlpzx - added artifacts bucket that is versioned for data.all pipelines as well and updated the checkov baseline. Tests passing that are synthesizing template with the new manually created bucket.

I think we are okay with the replication bucket - given that versioning is helpful for back up and restore information as needed, the replication bucket is only used for FE to replicate info already stored elsewhere and its source of truth is upstream from a different bucket. I think for now there is no risk allowing CDK to create that bucket with its own defaults

Going to re-request your review - please give one more look at PR when you have time

f'{artifact_bucket_base_name}-bucket',
bucket_name=f'{artifact_bucket_base_name}-bucket',
block_public_access=s3.BlockPublicAccess.BLOCK_ALL,
removal_policy=RemovalPolicy.RETAIN,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do we really want removal_policy=RemovalPolicy.RETAIN,? When we delete a pipeline stack I think the artefacts bucket is no longer used. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed - updated

@noah-paige noah-paige merged commit 9b8197c into main Sep 10, 2024
10 checks passed
@noah-paige noah-paige self-assigned this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants