fix(facebookoauth): verify app creds against /{app-id} instead of /me#5013
Open
lukem-ts wants to merge 1 commit into
Open
fix(facebookoauth): verify app creds against /{app-id} instead of /me#5013lukem-ts wants to merge 1 commit into
lukem-ts wants to merge 1 commit into
Conversation
|
|
Corpora Test ResultsNo detector regex or keyword changes in this PR. Bench skipped. |
Comment on lines
+68
to
+69
| if verificationErr != nil { | ||
| s1.SetVerificationError(verificationErr, apiSecretRes) |
Contributor
There was a problem hiding this comment.
no need for this if here. SetVerificationError only adds error if it exists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
The verifier built a valid app access token ({app-id}|{app-secret}) but queried the /me node, which only accepts user/page tokens. Facebook rejects an app token there with HTTP 400 OAuthException code 2500 ("An active access token must be used to query information about the current user."), so the check returned 400 for every App ID/Secret pair — valid or not — and could never mark a result verified.
Query the documented validation endpoint instead: GET /{app-id}?fields=roles with the app token. Valid credentials return 200; invalid pairs return 400 OAuthException 190. Status handling now distinguishes verified (200), unverified (400/401), and indeterminate (other statuses -> verification error).
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Detector-only change to outbound Facebook Graph validation; no TruffleHog auth or data-path changes, though verified leaks may now correctly flag live app credentials.
Overview
Fixes Facebook App ID/secret verification so valid pairs can actually be marked verified. Verification no longer calls Graph
/mewith an app access token ({app-id}|{app-secret}), which only accepts user/page tokens and always failed with HTTP 400.It now uses
GET /{app-id}?fields=roleswith the same app token. 200 marks credentials verified; 400/401 mark them unverified; other statuses surface a verification error. On success, optionalExtraDataincludes app role count anduser:rolepairs parsed from the response.Reviewed by Cursor Bugbot for commit c3cf4e3. Bugbot is set up for automated code reviews on this repo. Configure here.