Skip to content

Conversation

kashifkhan0771
Copy link
Contributor

@kashifkhan0771 kashifkhan0771 commented Jan 29, 2025

Description:

This PR add a new rule for sourcegraph tokens.
Issue: #1697

Checklist:

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

}

// validate
tps := utils.GenerateSampleSecrets("sgp_", secrets.NewSecret(`\b(sgp_(?:[a-fA-F0-9]{16}|local)_[a-fA-F0-9]{40}|sgp_[a-fA-F0-9]{40}|[a-fA-F0-9]{40})\b`))
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add separate test cases for each pattern. This will only generate cases for a single pattern, meaning obvious issues could be missed.

kashifkhan0771 and others added 2 commits January 29, 2025 19:08
Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
@zricethezav
Copy link
Collaborator

very nice! Thanks @kashifkhan0771

@zricethezav zricethezav merged commit c6424a6 into gitleaks:master Jan 31, 2025
1 check passed
alayne222 pushed a commit to alayne222/gitleaks that referenced this pull request May 28, 2025
* added sourcegraph token rule

* updated ruleid

Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>

* added more true positive test cases

---------

Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
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