Repository navigation
The Linked Data proxy delegates writes to other instances - #525
Open
namedgraph wants to merge 3 commits into
Open
namedgraph wants to merge 3 commits into
namedgraph wants to merge 3 commits into
Conversation
The http-tests stack ran one platform container, so every dataspace a federation test wrote to was one of the proxying instance's own, and delegation to another instance was never exercised. A second instance, linkeddatahub-remote, serves remote.localhost and admin.remote.localhost with its own secretary, owner and Fuseki datasets. nginx routes those hosts to it through server blocks the overlay adds via a new, by default empty, include in the main config. It reaches the first instance's WebIDs through the Docker host, hence ALLOW_INTERNAL_URLS on this test-only service. federation/PATCH-cross-instance-delegated.sh has B grant A's owner write on a document, then writes it twice. Directly with A's owner certificate it succeeds, so B verifies A's WebIDs. Through A's Linked Data proxy it is refused with 403, because since 1d71d03 the proxy delegates (the secretary's certificate and On-Behalf-Of) only to its own dataspaces, and B sees an anonymous write. The test asserts the proxied write succeeds, so it fails until cross-instance delegation is restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An authenticated caller's PUT, POST, PATCH or DELETE through the proxy goes out with the platform's certificate and On-Behalf-Of naming the caller, to another instance too, which verifies the delegation by dereferencing the caller's and the secretary's WebIDs. Since 1d71d03 only this instance's own dataspaces were delegated, so a cross-instance write arrived anonymous and was refused. Reads of other origins stay anonymous, and the ID token still goes to this instance's dataspaces only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ext hop The second instance gets a test redirector, /see-other/<path>, answering any method with 303 See Other to /<path>. A's owner POSTs to it through A's proxy, redirected to a document on B that only A's owner may read: the GET the POST continues as is a read of a foreign origin, which goes out anonymous and is refused. It is delegated instead, since the proxy decides delegation from the request's method rather than the hop's, and reads the document. 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
Since 6.2.4 (
1d71d036e), the Linked Data proxy delegates a signed-in caller only to this instance's own dataspaces. A write to another LinkedDataHub instance went out anonymous and was refused with403, which broke "Add data" to a foreign document (CHANGELOG 6.0: "Add data accepts foreign target documents").The reason given for the restriction was that "external sites can't verify a delegation anyway", and that doesn't hold.
WebIDFilterverifiesOn-Behalf-Ofby dereferencing the caller's and the secretary's WebID documents, which are public, so any instance can do it.The HTTP tests missed it because the stack ran one platform instance:
test.localhostandpackages.localhostare dataspaces of the same instance, so they always counted as "own".Change
ProxyRequestFilterpicks a client for each redirect hop:On-Behalf-Of(+ ID token cookie)On-Behalf-OfThe ID token is a bearer credential, so it still goes only to this instance's dataspaces. An OAuth caller writing to another instance is named in
On-Behalf-Of, like a WebID caller; their agent document carries<secretary> acl:delegates <agent>too (LoginBase).Tests
linkeddatahub-remoteservice, with its own dataspaces (remote.localhost,admin.remote.localhost), owner, secretary and fuseki datasets. nginx routes it through aninclude /etc/nginx/extra.d/*.conf;indocker-compose.yml, which does nothing when the directory is empty, so nothing needs to change in the copies of the compose file.federation/PATCH-cross-instance-delegated.sh: a PATCH as A's owner to a document on B that grants A's owner write.Related
OriginFilter) is compatible: the proxy doesn't forwardOrigin, so a proxied write reaches the target without one and passes.🤖 Generated with Claude Code