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

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

Open
pjungermann opened this issue Jul 24, 2024 · 1 comment
Labels
bug Something isn't working community Community contribution

Comments

@pjungermann
Copy link

pjungermann commented Jul 24, 2024

Found a bug? You're welcome to GitHub Discussions

  • Please make sure to:
    • Describe in details what the problem is
    • Attach a log file with relevant data preferably in DEBUG level (--log-level=DEBUG)
    • Attach the scanned sample files, anonymize the data if the original file cannot be provided
    • When attaching files to the issue make sure they are properly formatted

Expected Behavior

(Which results are expected from KICS?)

  • .gitigore only applies to files within the same dir it exists and below
  • .gitignore does not apply to the (absolute) parent dir path

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)

  • Version: v2.0.1 (as part of MegaLinter v7.12.0)
  • Platform:
  • Subsystem:

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

@pjungermann pjungermann added bug Something isn't working community Community contribution labels Jul 24, 2024
@cx-monicac
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Community contribution
Projects
None yet
Development

No branches or pull requests

2 participants