bridgecrewio / checkov

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
https://www.checkov.io/
Apache License 2.0
7.17k stars 1.12k forks source link

fix(secrets): fix find line #6864

Closed omryMen closed 1 week ago

omryMen commented 1 week ago

User description

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

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

New/Edited policies (Delete if not relevant)

Description

Include a description of what makes it a violation and any relevant external links.

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:


Generated description

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

Refactor the CustomRegexDetector class to improve the accuracy of line number detection for potential secrets. Introduce error handling in the find_line_number function to ensure robustness against unexpected input.

<table><tr><th>Topic</th><th>Details</th><tr><td><a href=https://baz.co/changes/bridgecrewio/checkov/6864?tool=ast&topic=Error+Handling>Error Handling</a>
    </td><td>Enhance error handling in <code>find_line_number</code>.<details><summary>Modified files (1)</summary><ul><li>checkov/secrets/plugins/custom_regex_detector.py</li></ul></details><details><summary>Latest Contributors(2)</summary><table><tr><th>User</th><th>Commit</th><th>Date</th></tr><tr><td>RabeaZr</td><td>fix-secrets-multiline-...</td><td>November 21, 2024</td></tr>
omryMenfix-secrets-skip-empty...November 18, 2024 Line Number Fix Improve line number detection in CustomRegexDetector.
Modified files (1)
  • checkov/secrets/plugins/custom_regex_detector.py
Latest Contributors(2)
UserCommitDate
RabeaZrfix-secrets-multiline-...November 21, 2024
omryMenfix-secrets-skip-empty...November 18, 2024
This pull request is reviewed by Baz. Join @omryMen and the rest of your team on (Baz).