Skip to content

Trying to reduce secret scan false positives - #2696

Draft
directionless wants to merge 4 commits into
kolide:mainfrom
directionless:seph/secret-exclusions
Draft

Trying to reduce secret scan false positives#2696
directionless wants to merge 4 commits into
kolide:mainfrom
directionless:seph/secret-exclusions

Conversation

@directionless

Copy link
Copy Markdown
Contributor

This is a bit if a heavy handed approach to reducing false positives -- it actually parses the file and tosses it. In contrast, the gitleaks developers might suggest being clever with allow regexps. gitleaks/gitleaks#1728

return false
}

expectedKeys := []string{"cty", "data", "enc", "iv", "kid"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these are all part of the JWE standard -- do we have anything outside of the standard to match against? I am wondering if this would match other items we aren't expecting.

@RebeccaMahany RebeccaMahany Apr 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(i.e., all JWEs can't be false positives, right?)

If JWEs are all false positives, since they are not plaintext, then we can maybe use the standard to detect them. I took a look and there's a library golang-jwt/jwe similar to golang-jwt/jwt that we already use, but I'm not sure it's stable. But looking at the RFC, I think there are two different ways to serialize JWEs (JWE Compact and JWE JSON) and maybe we could use those for stricter detection rules here, to make sure we capture both types?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Handled in #2697

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just to answer -- Yes, I think all JWEs are false positives

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