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(kubernetes): [CKV_K8S_140] Update ApiServerTlsCertAndKey.py to check RHS values #3506

Merged
merged 6 commits into from
Sep 21, 2022

Conversation

nijdarshan
Copy link
Contributor

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

Description

The earlier code was only checking if the -tls-cert-file and --tls-private-key-file parameters are present but was not checking if the values are provided on the RHS.

Fixes

Optimised CKV_K8S_140 to check for the values and non-empty values on the RHS of the parameters.

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

@gruebel gruebel changed the title [CKV_K8S_140] Update ApiServerTlsCertAndKey.py to check RHS values fix(kubernetes): [CKV_K8S_140] Update ApiServerTlsCertAndKey.py to check RHS values Sep 14, 2022
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 catch 🚀

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, looks good 🚀 can you also add one failing test, where one of the flags is used, but without a value?

@nijdarshan
Copy link
Contributor Author

Added a new fail check for the update

@nijdarshan
Copy link
Contributor Author

nice, looks good 🚀 can you also add one failing test, where one of the flags is used, but without a value?

Hey, @gruebel could help me identify why the code fails in a few tests? I will rectify them accordingly!

@gruebel
Copy link
Contributor

gruebel commented Sep 20, 2022

quite easy, if you add a new test case it also needs to be added to the actual test file. Additionally the object names should be unique, so we can be sure, the correct ones are failing/passing.

@gruebel gruebel merged commit f01ac01 into bridgecrewio:master Sep 21, 2022
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.

3 participants