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(secrets): Add _prioritise_secrets by 3 levels of severity #6390

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

ChanochShayner
Copy link
Contributor

@ChanochShayner ChanochShayner commented Jun 3, 2024

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

Description

Add _prioritise_secrets func to prioritise secrets results on the same finding by 3 levels of severity.

  1. Private Key.
  2. Generic Private Key.
  3. Entropy.

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

@@ -74,6 +74,7 @@
}

ENTROPY_CHECK_IDS = ('CKV_SECRET_6', 'CKV_SECRET_19', 'CKV_SECRET_80')
GENERIC_PRIVATE_KEY_CHECK_IDS = ('CKV_SECRET_10', 'CKV_SECRET_13')
Copy link
Contributor

Choose a reason for hiding this comment

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

you can change this to set instead of tuple

@@ -319,6 +319,17 @@ def run(
self._modify_invalid_secrets_check_result_to_skipped(report)
return report

@staticmethod
def _prioritise_secrets(secret_records: Dict[str, SecretsRecord], secret_key: str, check_id: str) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _prioritise_secrets(secret_records: Dict[str, SecretsRecord], secret_key: str, check_id: str) -> bool:
def _should_prioritise_secrets(secret_records: Dict[str, SecretsRecord], secret_key: str, check_id: str) -> bool:

either rename or change the return type to not be a boolean

@ChanochShayner ChanochShayner merged commit e0d99b0 into main Jun 3, 2024
41 checks passed
@ChanochShayner ChanochShayner deleted the prioritise-secrets branch June 3, 2024 16:03
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.

None yet

4 participants