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

Regex boundary clean and various tweaks to reduce FPs (part 1) #2407

Closed
wants to merge 10 commits into from

Conversation

zricethezav
Copy link
Collaborator

Description:

Adds better regex boundaries and includes various tweaks to reduce FPs

Checklist:

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

@zricethezav zricethezav requested a review from a team as a code owner February 9, 2024 21:14
@zricethezav zricethezav changed the title Regex boundary clean and various tweaks to reduce FPs Regex boundary clean and various tweaks to reduce FPs (part 1) Feb 9, 2024
@@ -20,8 +21,8 @@ var (
client = common.SaneHttpClient()

// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
appPat = regexp.MustCompile(detectors.PrefixRegex([]string{"datadog", "dd"}) + `\b([a-zA-Z-0-9]{40})\b`)
apiPat = regexp.MustCompile(detectors.PrefixRegex([]string{"datadog", "dd"}) + `\b([a-zA-Z-0-9]{32})\b`)
appPat = regexp.MustCompile(detectors.PrefixRegex([]string{"datadog", "dd_", "dd-"}) + `\b([a-zA-Z-0-9]{40})\b`)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For the reviewer: I don't feel super strongly on this change. However it does seem like dd alone could introduce a fair number of FPs. Open for discussion!

@@ -21,8 +22,8 @@ var (
client = common.SaneHttpClient()

// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"dovico"}) + `\b([0-9a-z]{32}\.[0-9a-z]{1,}\b)`)
userPat = regexp.MustCompile(detectors.PrefixRegex([]string{"dovico"}) + `\b([0-9a-z]{32}\.[0-9a-z]{1,}\b)`)
keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"dovico"}) + `\b([0-9a-z]{32}\.[0-9a-z]{1,100})\b`)
Copy link
Collaborator Author

@zricethezav zricethezav Feb 9, 2024

Choose a reason for hiding this comment

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

For the reviewer: probably not gonna go past 100 alphanums on the backend here but 🤷🏻 I'm open for discussion

@zricethezav
Copy link
Collaborator Author

Going to close this PR and start fresh. After doing some testing some of these \bs are misplaced and have negative outcomes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants