Repository navigation
feat(server): read the authorization endpoint's request strictly - #505
Merged
Merged
Conversation
server.BeginAuthorizationRequestFromHTTP(r) reads the client_id and request_uri a client sends the browser with after a pushed authorization request. Every embedder read them with r.URL.Query().Get, which silently takes the first of a repeated parameter, though RFC 6749 §3.1 says a parameter "MUST NOT be included more than once". This package's other endpoints already refuse duplicates through FormRequestFromHTTP; the authorization endpoint was the one place every integrator hand-rolled the parsing. A repeated client_id or request_uri, or a malformed query, is an invalid_request *Error, to render locally rather than redirect. A missing value is left for BeginAuthorization to answer, as it does today. The five demos with an authorization server, cmd/conformance-as and GETTING_STARTED now use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
osanderson
force-pushed
the
feat/server-begin-authorization-from-http
branch
from
October 2, 2026 04:20
cac6b85 to
6ccec35
Compare
…r redirect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
This is the second library addition from the DevX review. It's separate from #504, with which it shares no logic.
It reads the
client_idandrequest_uria client sends the browser to the authorization endpoint with after PAR (RFC 9126 §4).Why. Every embedder (the five demos and
cmd/conformance-as) read them withr.URL.Query().Get, which silently takes the first of a repeated parameter. RFC 6749 §3.1 says request parameters "MUST NOT be included more than once". FAPIgo's other endpoints already refuse duplicates (that's whatFormRequestFromHTTPis for); the authorization endpoint was the one place every integrator hand-rolled the parsing.Behaviour:
client_idorrequest_uri, or a malformed query, gets aninvalid_request*Error. The doc says to render it locally, never as a redirect: the request hasn't yet named a redirect URI it can be trusted with.BeginAuthorizationto answer, as it does any unrecognisedrequest_uriorclient_idtoday.Adopted:
cmd/conformance-as, whose suite-only error-redirect path still readsredirect_uriandstatefrom the raw query, but now takesclient_idfrom the strictly parsed request;GETTING_STARTED's login step.Tests
request_uri, a repeatedclient_idand a malformed query each getinvalid_request.go test -race ./...and golangci-lint pass;cmd/conformance-aspass their tests and lint;GETTING_STARTED's snippets compile.🤖 Generated with Claude Code