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

fix(bootstrap): ECR repository produces Security Hub finding [ECR.3] because of missing lifecycle policy #24735

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

tenjaa
Copy link
Contributor

@tenjaa tenjaa commented Mar 21, 2023

After enabling AWS Foundational Security Best Practices v1.0.0 in the security hub,
I am always frustrated when I see failed checks.

Similar to #24175 I would like to see a lifecycle rule that does not do much but at least per default resolves the finding.

I know that there is an RFC for garbage collection in the works but this is a simple immediate fix.

This is heavily inspired by #24175

Closes #24723.


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

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Mar 21, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team March 21, 2023 22:21
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. labels Mar 21, 2023
@tenjaa
Copy link
Contributor Author

tenjaa commented Mar 21, 2023

Exemption Request

This is not really a bug that is getting fixed so I find it hard to write a test. Especially as my inspiration did not have a test either.
Would be happy to write one but I would need a little hint what exactly is expected there.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 21, 2023
@tenjaa
Copy link
Contributor Author

tenjaa commented Mar 23, 2023

Hey @rix0rrr sorry for annoying but I saw you fixing in the last weeks similar security findings. Could you have a look at this?

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Overall this looks fine but you'll need to increment the version. It's at the bottom of the file.

@TheRealAmazonKendra
Copy link
Contributor

One more note: on a fix, the title should describe the problem, not the solution. Could you please adjust the PR title to reflect that? Also, I see no reason to not approve the exemption request. Adding those.

@TheRealAmazonKendra TheRealAmazonKendra added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Mar 28, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 28, 2023 18:58

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@tenjaa tenjaa changed the title fix(bootstrap): remove Security Hub finding [ECR.3] fix(bootstrap): ECR repository produces Security Hub finding [ECR.3] because of missing lifecycle policy Mar 28, 2023
@tenjaa tenjaa force-pushed the security-hub-ecr-3 branch from b4053bb to 721254d Compare March 28, 2023 19:01
@mergify mergify bot dismissed stale reviews from TheRealAmazonKendra and mrgrain March 28, 2023 19:02

Pull request has been modified.

ECR.3 requires ECR repositories to have at least one lifecycle policy
@tenjaa tenjaa force-pushed the security-hub-ecr-3 branch from 721254d to 836a214 Compare March 28, 2023 19:03
@tenjaa
Copy link
Contributor Author

tenjaa commented Mar 28, 2023

@TheRealAmazonKendra Hope the title is not too long now but I opted for the more precise variant.
The description and version are also adapted now.

@TheRealAmazonKendra
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2023

update

✅ Branch has been successfully updated

@TheRealAmazonKendra
Copy link
Contributor

This failure is unrelated. Restarting build.

@TheRealAmazonKendra
Copy link
Contributor

@TheRealAmazonKendra Hope the title is not too long now but I opted for the more precise variant. The description and version are also adapted now.

The title is good. Thank you.

@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 6c8de2d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit cdfa970 into aws:main Mar 28, 2023
@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@tenjaa tenjaa deleted the security-hub-ecr-3 branch March 28, 2023 21:28
homakk pushed a commit to homakk/aws-cdk that referenced this pull request Mar 28, 2023
…because of missing lifecycle policy (aws#24735)

After enabling AWS Foundational Security Best Practices v1.0.0 in the security hub,
I am always frustrated when I see failed checks.

Similar to aws#24175 I would like to see a lifecycle rule that does not do much but at least per default resolves the finding.

I know that there is an RFC for garbage collection in the works but this is a simple immediate fix.

_This is heavily inspired by https://github.com/aws/aws-cdk/pull/24175_

Closes aws#24723.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(bootstrap): remove Security Hub finding ECR.3
4 participants