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

feat(terraform): add CKV_AWS_272 to validate Lambda function code-signing #3556

Merged
merged 5 commits into from
Sep 28, 2022

Conversation

AdamDev
Copy link
Contributor

@AdamDev AdamDev commented Sep 22, 2022

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

Description

Validate CKV_AWS_272 to check that lambda resource has code_signing_config_arn.
A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.

Fix

Optimised CKV_AWS_272 to check that lambda resource has code_signing_config_arn

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@AdamDev AdamDev changed the title Add check for lambda code_signing_config_arn feat(terraform)-code_signing_config_arn Sep 22, 2022
@AdamDev AdamDev changed the title feat(terraform)-code_signing_config_arn feat(terraform): code_signing_config_arn Sep 22, 2022
@AdamDev AdamDev requested a review from gruebel September 22, 2022 14:46
Copy link
Contributor

@gruebel gruebel left a comment

Choose a reason for hiding this comment

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

nice, good first try 💪

from checkov.common.models.enums import CheckResult


class TestLambdaCodeSigningConfigured(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

you used the wrong style for running the tests, please do something similar like here https://github.com/bridgecrewio/checkov/blob/master/tests/terraform/checks/resource/aws/test_WAFACLCVE202144228.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix please check

@gruebel gruebel changed the title feat(terraform): code_signing_config_arn feat(terraform): add CKV_AWS_272 to validate Lambda function code-signing Sep 22, 2022
@tsmithv11
Copy link
Collaborator

Great work! Can you add a description of what the policy is checking for and how to fix a violation of the policy?

@AdamDev
Copy link
Contributor Author

AdamDev commented Sep 23, 2022

@tsmithv11 where do you want to add this description?

@tsmithv11
Copy link
Collaborator

@tsmithv11 where do you want to add this description?

In the Description of the PR. Just add more detail on what the policy is checking for and why a user should turn on code signing verification.

@AdamDev
Copy link
Contributor Author

AdamDev commented Sep 24, 2022

Does this description is ok?

Copy link
Contributor

@gruebel gruebel left a comment

Choose a reason for hiding this comment

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

nice job 🥇

@AdamDev AdamDev merged commit c968334 into master Sep 28, 2022
@AdamDev AdamDev deleted the feat(terraform)-code_signing_config_arn branch September 28, 2022 07:14
losisin pushed a commit to ignite-analytics/checkov that referenced this pull request Sep 28, 2022
…ning (bridgecrewio#3556)

* Add check for lambda code_signing_config_arn

* set the code of the check

* Update checkov/terraform/checks/resource/aws/LambdaCodeSigningConfigured.py

Co-authored-by: Anton Grübel <[email protected]>

* Update checkov/terraform/checks/resource/aws/LambdaCodeSigningConfigured.py

Co-authored-by: Anton Grübel <[email protected]>

* change test to the new style

Co-authored-by: Adam Varsano <[email protected]>
Co-authored-by: Anton Grübel <[email protected]>
losisin pushed a commit to ignite-analytics/checkov that referenced this pull request Sep 28, 2022
…ning (bridgecrewio#3556)

* Add check for lambda code_signing_config_arn

* set the code of the check

* Update checkov/terraform/checks/resource/aws/LambdaCodeSigningConfigured.py

Co-authored-by: Anton Grübel <[email protected]>

* Update checkov/terraform/checks/resource/aws/LambdaCodeSigningConfigured.py

Co-authored-by: Anton Grübel <[email protected]>

* change test to the new style

Co-authored-by: Adam Varsano <[email protected]>
Co-authored-by: Anton Grübel <[email protected]>
@MrHash
Copy link

MrHash commented Sep 29, 2022

Consider adding switch for image based functions.
https://docs.aws.amazon.com/lambda/latest/dg/configuration-codesigning.html
Screen Shot 2022-09-29 at 15 14 33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants