Skip to content

Conversation

kashifkhan0771
Copy link
Contributor

@kashifkhan0771 kashifkhan0771 commented Aug 1, 2025

Description:

This PR enhances and fixes the pattern test cases for the A and B letter detectors with the following improvements:

  • Secrets removed from variables: Instead of storing secret strings in variables, they are now passed directly into the input. This makes the tests clearer and easier to follow.
  • Realistic input examples: Test inputs now resemble real-world usage scenarios, rather than using fixed or artificial secret strings.
  • Additional valid pattern cases: More valid examples of patterns have been added to increase test coverage and reliability.
  • Improved error messages: Test case failure messages have been updated to be more informative and easier to debug.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@kashifkhan0771 kashifkhan0771 requested review from a team as code owners August 1, 2025 07:11
@@ -27,7 +27,7 @@ type Scanner struct {
var (
defaultClient = common.SaneHttpClient()

dbKeyPattern = regexp.MustCompile(detectors.PrefixRegex([]string{"azure", "cosmos"}) + `([A-Za-z0-9]{86}==)`)
dbKeyPattern = regexp.MustCompile(`([A-Za-z0-9]{86}==)`)
Copy link
Contributor

Choose a reason for hiding this comment

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

I hope this doesn't attract false positives

@kashifkhan0771 kashifkhan0771 merged commit bd1c660 into trufflesecurity:main Aug 4, 2025
13 checks passed
@kashifkhan0771 kashifkhan0771 deleted the update/oss-270 branch August 4, 2025 05:51
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.

2 participants