You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug 2085553 - Github logins are failing with JSON error after recent changes to Bugzilla - #2797
GitHub login failures now show the real cause, and the "messaging functions" wrapper page is gone. That doesn't mean login works yet: I haven't found out why GitHub's response wasn't JSON. The new test passes in the container: 8 tests, Result: PASS.
Changes (3 files, nothing committed)
extensions/GitHubAuth/lib/Client.pm
It checks the HTTP status first, then parses the JSON. A failed request now gives github_error with the HTTP status and reason instead of "Unable to parse JSON response".
A 200 response that isn't JSON now reports the status and Content-Type.
GitHub's {"error": "bad_verification_code", ...} replies now show GitHub's own description. Before, this failed later on a confusing call with an empty token.
The error variable is renamed from message to reason, so the header no longer treats it as a message tag.
Added an explicit use LWP::UserAgent.
code-error-errors.html.tmpl: shows the status and content type. When LWP itself failed (DNS, TLS or proxy), it adds "Bugzilla could not connect to GitHub".
extensions/GitHubAuth/t/bmo/client-response.t (new): mocks the user agent to cover the success, 403, LWP internal 500, 200-but-not-JSON and OAuth-error cases. It also renders the error page to confirm the old fallback text is gone.
★ Insight ─────────────────────────────────────
The test turns on $USE_EXCEPTION_OBJECTS = 1 in Client::Error, which Login.pm also uses. Errors come back as objects you can inspect, so the test can check error and vars without rendering a page.
I used decoded_content(charset => 'none') instead of plain decoded_content. decode_json expects UTF-8 bytes, and fully decoded text would break on non-ASCII names or emails.
─────────────────────────────────────────────────
What I picked, what I gave up, and why: I made the failure readable and left the root cause alone, because the code doesn't show which GitHub call fails or why. Once this is deployed, the next failed login will name the cause (proxy, TLS or GitHub). That may need a second small fix. Also, I didn't run perl scripts/perl-fmt.pl, and line 77 of Client.pm is longer than the usual width.
The decoded verified value is a JSON boolean object, not the plain scalar 1. is_deeply distinguishes these types, so this success-path assertion fails even when the client returns the correct response. Use JSON::true() in the expected structure, or check the flag separately as a boolean.
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
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.
GitHub login failures now show the real cause, and the "messaging functions" wrapper page is gone. That doesn't mean login works yet: I haven't found out why GitHub's response wasn't JSON. The new test passes in the container: 8 tests, Result: PASS.
Changes (3 files, nothing committed)
★ Insight ─────────────────────────────────────
─────────────────────────────────────────────────
What I picked, what I gave up, and why: I made the failure readable and left the root cause alone, because the code doesn't show which GitHub call fails or why. Once this is deployed, the next failed login will name the cause (proxy, TLS or GitHub). That may need a second small fix. Also, I didn't run perl scripts/perl-fmt.pl, and line 77 of Client.pm is longer than the usual width.