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: ignore baseline if path was not relative in source #1101

Merged
merged 2 commits into from Feb 25, 2023

Conversation

raffis
Copy link
Contributor

@raffis raffis commented Feb 17, 2023

Description:

There is currently a bug with the baseline ignore.

If gitleaks is not executed in the current directory and --source is used to specify a custom path, the baseline file is not ignored correctly because the relative file paths do not match. That check is done in Detect().

This will currently report secrets in the baseline file, however the baseline file should be excluded.

gitleaks detect --report-format json --verbose --log-level debug --baseline-path ~/foo/.gitleaks.baseline.json --source ~/foo

Basically as for now the baseline only works if gitleaks is executed directly in the target repository and the baseline path is set relative to it.
This pr fixes that bug so the baseline path is resolved correctly and can be compared during fragments check no matter what directory.

Checklist:

  • Does your PR pass tests?
  • Have you written new tests for your changes?
  • Have you lint your code locally prior to submission?

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
@jit-ci
Copy link

jit-ci bot commented Feb 17, 2023

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

❌ Jit has detected 1 important finding in this PR that you should review.
The finding is detailed below as a comment.
It’s highly recommended that you fix this security issue before merge.

cfgName: "path_only",
baselinePath: ".baseline.json",
fragment: Fragment{
Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
Copy link

Choose a reason for hiding this comment

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

Security control: Secret Detection

Type: Discord-Api-Token

Description: Discord API key

Severity: HIGH


Jit Bot commands and options (e.g., ignore issue)

You can trigger Jit actions by commenting on this PR review:

  • #jit_ignore_fp Ignore and mark this specific single instance of finding as “False Positive”
  • #jit_ignore_accept Ignore and mark this specific single instance of finding as “Accept Risk”
  • #jit_undo_ignore Undo ignore command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#jit_ignore_fp

@zricethezav
Copy link
Collaborator

@raffis thank you for this!

@zricethezav zricethezav merged commit 0259088 into gitleaks:master Feb 25, 2023
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

2 participants