Skip to content

Keep the port of the client origin in the consent page form-action - #231

Open
chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/consent-form-action-port
Open

chefboyrdave21 wants to merge 1 commit into
pdsinterop:mainfrom
smilinTux:fix/consent-form-action-port

Conversation

@chefboyrdave21

Copy link
Copy Markdown

Problem

The approval page allows the client's redirect origin as a CSP form-action, because the browser applies form-action to 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 as http://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::testApprovalAllowsRedirectOriginAsFormAction with 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-node 5.0.3 / @inrupt/solid-client 4.0.0 and in a headless browser. The unit suite passes in a Nextcloud 35 container.

🤖 Generated with Claude Code

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant