Repository navigation
Keep the port of the client origin in the consent page form-action - #231
Open
chefboyrdave21 wants to merge 1 commit into
Open
chefboyrdave21 wants to merge 1 commit into
chefboyrdave21 wants to merge 1 commit into
Conversation
The approval page allows the client's redirect origin as a CSP form-action, because the browser applies form-action to every redirect that follows the form POST. The origin was built from the scheme and host only, so for a client on a non-default port (for example a loopback redirect such as http://localhost:3999/cb, as recommended for native and command line apps by RFC 8252) the browser blocked the final redirect. The user approved the app and was then left on the approval page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
The approval page allows the client's redirect origin as a CSP
form-action, because the browser appliesform-actionto every redirect after the form POST (back to/authorize, then to the client). The origin was built from scheme and host only. For a client on a non-default port (for example a loopback redirect such ashttp://localhost:3999/cb, which RFC 8252 recommends for native and command line apps) the final redirect is blocked: the user clicks Allow and stays on the approval page.Fix
Keep the port when building the allowed origin.
Tests
PageControllerTest::testApprovalAllowsRedirectOriginAsFormActionwith a default port, a non-default port and a loopback redirect. The last two fail without the fix.Verification
Verified on Nextcloud 35.0.2 (PHP 8.5) behind a reverse proxy that terminates TLS, with
@inrupt/solid-client-authn-node5.0.3 /@inrupt/solid-client4.0.0 and in a headless browser. The unit suite passes in a Nextcloud 35 container.🤖 Generated with Claude Code