-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add validation for GCP application default credentials detector #4198
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
Conversation
- Introduced an `isValid` method to check the presence of required fields: ClientID, ClientSecret, RefreshToken, and Type. - Updated the `FromData` method to skip invalid credentials during processing.
…ntials detector - Introduced a new test case to handle invalid JSON input, ensuring the detector can gracefully manage such scenarios without returning unexpected results.
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.
requesting changes pending the outcome of an internal discussion
…ion method from GCP application default credentials detector
…ain' of github.com:trufflesecurity/trufflehog into fixes/oss-91
Note: This is a work in progress as I just noticed that tests are failing. Seems like the problem lies in String.Contains catching empty string. |
Closing this as adding empty string check in default false positive introduces new problems within the false-positive flow. |
Improve GCP Application Default Credentials Detection
Background
Google Cloud Platform (GCP) supports multiple types of credential JSON files, each with different structures:
Currently, our detector assumes User Credentials format. According to GCP documentation, User Credentials JSON will always contain these specific fields:
client_id
client_secret
refresh_token
type
Changes
isValid()
method to ensure we only process User CredentialsImpact
This change makes our GCP credential detection more accurate by reducing false positives from other credential types (OSS-91)
closes issue-3717
Checklist:
make test-community
)?make lint
this requires golangci-lint)?