Checkmarx / kics

Find security vulnerabilities, compliance issues, and infrastructure misconfigurations early in the development cycle of your infrastructure-as-code with KICS by Checkmarx.
https://kics.io
Apache License 2.0
2.02k stars 297 forks source link

bug(scan): gitignore applied to absolute path leading to wrong exclusion #7217

Open pjungermann opened 1 month ago

pjungermann commented 1 month ago

Found a bug? You're welcome to GitHub Discussions

Expected Behavior

(Which results are expected from KICS?)

Actual Behavior

(Formatted logs and samples helps us to better understand the issue)

.gitignore rules get applied to the parent dir path leading to all files being ignored

Steps to Reproduce the Problem

(Command line arguments and flags used)

  1. Run KICS in any parent dir
    • in our case this, we used MegaLinter on Bitbucket Pipelines with the work dir/parent dir being /opt/atlassian/pipelines/agent/build
  2. create a .gitignore file that ignores that contains a rule matching the parent dir
    • in our case: build/ matching and excluding i.e. /opt/atlassian/pipelines/agent/build/some/dir/or/file
    • in another dir that didn't match (e.g., when running it locally), we got different results as the files were not ignored
  3. Run KICS with config verbose: true to see the exclusions

Specifications

(N/A if not applicable)

Relates-to: issue #4584 Relates-to: PR #5506

cx-monicac commented 1 month ago

Hi @pjungermann,

Thank you for bringing this bug to our attention we opened an internal bug and will work on it as soon as possible.