Repository navigation
Use Nextcloud's request for the base URI of RDF documents (fixes #225) - #228
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 Storage, Profile, Contacts, Calendar and webhook controllers built the base URI for RDF documents from $_SERVER['REQUEST_SCHEME'] and $_SERVER['SERVER_NAME']. Behind a reverse proxy that terminates TLS those describe the internal hop, so relative IRIs in served Turtle resolved to http:// (and to the internal host name, without the public port). Clients that compare IRIs, such as ACL inheritance in Inrupt's solid-client, then fail to match acl:default against the https container URL. Take the scheme, host and path from IRequest instead. It honours the overwriteprotocol, overwritehost and trusted_proxies settings. Fixes pdsinterop#225 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.
Fixes #225.
Problem
StorageController,ProfileController,ContactsController,CalendarController(and the webhook controller) built the base URI for RDF documents from$_SERVER['REQUEST_SCHEME']and$_SERVER['SERVER_NAME']. Behind a proxy that terminates TLS these describe the internal hop, so relative IRIs in served Turtle resolve tohttp://(and to the internal host name, without the public port), whateveroverwriteprotocol/overwritehostsay.Fix
A small
GetServerUriTraitbuilds the URI fromIRequest::getServerProtocol(),getServerHost()andgetRequestUri(), which honouroverwriteprotocol,overwritehostandtrusted_proxies. This is the approach suggested in #225.Tests
tests/Unit/Controller/GetServerUriTraitTest.php: scheme/host/path, a non-default port, and that$_SERVER['REQUEST_SCHEME']/SERVER_NAMEare ignored.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. Before: the root.aclserved as Turtle has<http://…/storage/>IRIs. After:<https://…/storage/>.Note: the owner lockout described in #225 also needs pdsinterop/php-solid-auth to advertise the resource's own ACL in
Link: rel="acl"(it advertises<.acl>for every resource, which resolves to the container's ACL). I opened a separate PR there.🤖 Generated with Claude Code