Repository navigation
Conversation
…ient The Authorization header was written into the HTTP client's options and only when it was not set yet. A rotated token was never used, and every later request through a shared client carried the token, including requests to other hosts. Basic auth credentials were put unencoded into the URL. Wrap the client so that the headers (Accept, X-GitHub-Api-Version, Authorization) are computed from the options on every request and put on the client only for that request. Send Basic auth as an Authorization header. Default api.url to api.github.com for packages built without Github. Rename gh.token.scheme to gh.token_scheme, because a Registry cannot hold gh.token and gh.token.scheme at the same time. Deprecate only the dead methods of Authorization (getRateLimit(), getAuthorizationLink() and requestToken() still work) and trigger runtime deprecations for them and for Downloads. Document the options in overview.md instead of the v3 to v4 update guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The packages send JSON strings as request bodies, but without a content type joomla/http labels them application/x-www-form-urlencoded. Add Content-Type: application/json for string bodies unless a content type is set on the client or passed with the request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 12, 2026
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.
Summary of Changes
Aligns the HTTP layer with GitHub's current REST API conventions and fixes how credentials are sent.
fetchUrl()wroteAuthorization: token …into the client'sheadersoption, and only if it was not set yet. A changedgh.tokenwas never used, and every later request through the same (possibly shared, e.g. DI) client carried the GitHub token, including requests to other hosts. When the client was built from the options Registry, the header also ended up in the user's Registry. The package objects now wrap the client (Joomla\Github\RequestHeadersHttp, internal) so that the headers are computed from the options on each request and put on the client only for the duration of that request. Headers set on the client or passed with a request keep precedence. This keeps every existing call site, and those of the new packages in [4.x] Register the new API packages #67–[4.x] Add the Dependency Graph API package #85, working unchanged.Accept: application/vnd.github+jsonandX-GitHub-Api-Version(optionapi.version, default2022-11-28).Content-Type: application/jsoninstead of the transport defaultapplication/x-www-form-urlencoded(only for string bodies, and only when no content type is set on the client or passed with the request).gh.token_scheme(defaulttoken), e.g.Bearerfor GitHub App tokens. (An earlier commit called itgh.token.scheme, but aRegistrycannot holdgh.tokenandgh.token.schemeat the same time — setting one makes the other unreachable.)api.username/api.password) is sent as anAuthorization: Basicheader instead of unencoded URL userinfo (a password likep@ss:w/rdsent the request to the wrong host and leaked into exception messages). It only works on GitHub Enterprise Server.api.urldefaults tohttps://api.github.cominfetchUrl(), so a package constructed withoutGithubno longer requests a relative URL.Authorizationare deprecated (getRateLimit(),getAuthorizationLink()andrequestToken()still work), andRepositories\Downloads. All trigger a runtime deprecation (addssymfony/deprecation-contracts).Testing Instructions
Tests/GithubObjectTest.phpsends requests through a realHttpwith a recording transport: token rotation, no headers left on the client or in the options Registry, a second request through the shared client without the token, client headers taking precedence,api.version/gh.token_scheme, the JSON content type, Basic auth as header, sub-packages. These fail before the change. The package tests setapi.urlto''inGitHubTestCaseso they can keep asserting relative paths.Documentation Changes Required
docs/overview.md: options and headers, deprecated endpoints. (The 4.1 notes are no longer inv3-to-v4-update.md; that guide is for breaking changes only.)#66 needs adjusting when either is merged second:
authentication.mddocumentsgh.token.scheme(nowgh.token_scheme), the Basic auth userinfo caveat and the "Isolating the HTTP client" section (no longer needed), andpackages.mdsays the wholeAuthorizationclass is dead apart fromgetRateLimit().🤖 Generated with Claude Code