-
Notifications
You must be signed in to change notification settings - Fork 2k
Salesforce Refresh Token Detector #4295
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
Salesforce Refresh Token Detector #4295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a minor comment
if !apiResp.Active { | ||
return false, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not it show that credentials are valid but the token is not active ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it means that the credentials are valid, that is why we were able to get the status of the refresh token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to add - the validity of the credentials themselves is handled by a separate detector we already have, salesforceoauth2. This particular detector is specifically designed to identify and verify refresh tokens, which is why the focus here is limited to that aspect.
Description:
This PR adds a new detector for Salesforce OAuth 2.0 refresh tokens. Refresh tokens are long-lived credentials that allow applications to obtain new access tokens without requiring user interaction, making them critical security assets that need to be detected in code repositories.
What's Added
salesforcerefreshtoken
package with full detection and verification capabilities5AEP861
), consumer keys (starting with3MVG9
), and consumer secretsTechnical Details
Detection Patterns
(?i)\b(5AEP861[a-zA-Z0-9._=]{80,})\b
\b(3MVG9[0-9a-zA-Z._+/=]{80,251})
PrefixRegex
with keywords["salesforce", "consumer", "secret"]
+\b([A-Za-z0-9+/=.]{64}|[0-9]{19})\b
Verification Strategy
The detector uses Salesforce's OAuth 2.0 introspection endpoint (
/services/oauth2/introspect
) to validate refresh tokens:active
Triple Component Requirement
The detector requires all three components (refresh token, consumer key, consumer secret) to be present:
Testing Coverage
Pattern Tests
Integration Tests
Keywords
The detector uses the following keywords for efficient pre-filtering:
salesforce
5AEP861
3MVG9
Checklist:
make test-community
)?make lint
this requires golangci-lint)?