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(general): Support CVE suppressions with the root file in repo #6948

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

rotemavni
Copy link
Collaborator

@rotemavni rotemavni commented Jan 13, 2025

User description

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

Description

This PR fixes an issue with CVEs that were not suppressed properly.
This is the use case that was not supported:

suppression = {'suppressionType': 'Cves', 'policyId': 'BC_VUL_2', 'comment': 'suppress cve ', 'accountIds': ['customer_some/repo'], 'cves': [{'uuid': '90397534-a1a0-41bb-a552-acdd861df618', 'id': '/requirements.txt', 'cve': 'CVE-2022-35920'}, 'checkovPolicyId': 'BC_VUL_2'}

record.file_path = '/requirements.txt'

I also extracted the CVE suppression into a separate function.

Checklist:

  • 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

Generated description

Below is a concise technical summary of the changes proposed in this PR:

Enhances the CVE suppression functionality in the Checkov tool. Refactors the _check_suppression method by extracting CVE-specific logic into a new _check_cve_suppression method. Modifies the suppression checking process to support CVE suppressions with the root file in the repository. Updates the corresponding test cases to verify the new functionality.

TopicDetails
CVE Suppression Refactors and enhances the CVE suppression logic to support root file suppressions
Modified files (2)
  • tests/common/integration_features/test_suppressions_integration.py
  • checkov/common/bridgecrew/integration_features/features/suppressions_integration.py
Latest Contributors(2)
UserCommitDate
lirshindalmanfeat-general-add-logs-...November 25, 2024
omryMenchore-sast-omit-skip-c...June 05, 2024
This pull request is reviewed by Baz. Join @rotemavni and the rest of your team on (Baz).

@rotemavni rotemavni deployed to scan-security January 13, 2025 16:03 — with GitHub Actions Active
@rotemavni rotemavni changed the title fix(general) Support CVE suppressions with the root file in repo fix(general): Support CVE suppressions with the root file in repo Jan 13, 2025
@rotemavni rotemavni marked this pull request as ready for review January 14, 2025 07:39
@rotemavni rotemavni merged commit 4e75793 into main Jan 14, 2025
37 of 40 checks passed
@rotemavni rotemavni deleted the fix-cve-suppressions branch January 14, 2025 09:36
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