Open rnillavazagan opened 2 months ago
I conducted testing and discovered that the GitHub Server-to-Server token (ghs_*) must have the appropriate permissions granted in order to perform specific operations. If the token lacks the required permissions, it results in a 403 Forbidden error. Conversely, if the token is expired or invalid, it returns a 401 Unauthorized error.
In our GitHub verification call using the /user API, it’s important to note that not all ghs_* tokens will necessarily have the permission to access user profile information. This means that requests to the /user endpoint can fail if the token lacks the necessary permissions. During my testing, even after granting user information access to the token, the API still returned a 403 error, which was perplexing.
On the other hand, when I made a request to the /issues API after providing the token with the necessary issues read access, it worked as expected.
Therefore, I guess we need a more refined approach to handle Server-to-Server(ghs_*
) tokens.
@zricethezav @abasit-folio3
TruffleHog Version
3.81.9
trufflehog filesystem scan not detecting a valid Github Server-Server token (GHS) when
--only-verified
is applied.Expected Behavior
Scan results should report the GHS secret as verified result.
Actual Behavior
No secrets are reported but instead the secret is shown as unverified result when
--only-verified
is removed.Steps to Reproduce
Additional Context
Same issues persists for GHS tokens present in docker images as well.