Repository navigation
Description
Summary
The WAC ACL parser reads authorizations by their literal compact keys (acl:agent, acl:mode, acl:accessTo, or the bare agent, mode, …) instead of interpreting the document as JSON-LD. A valid JSON-LD ACL that uses expanded IRIs (or any other prefix, e.g. wac:) is accepted with 201, but parses as granting nobody anything. If it is the resource's only ACL, the owner is locked out, including from the .acl itself, so it can't be repaired over HTTP.
It fails closed (denies), so it isn't an access leak, but it is a silent lockout.
Reproduce
As the pod owner (single-user pod, --idp --conneg), on 0.0.212. src/wac/parser.js is unchanged on main (b424397):
-
PUT /me/public/acl-repro/expanded/doc.ttl(Turtle) →201 -
PUT /me/public/acl-repro/expanded/doc.ttl.acl,Content-Type: application/ld+json, granting the owner Read/Write/Control in expanded form →201[{ "@id": "#owner", "@type": ["http://www.w3.org/ns/auth/acl#Authorization"], "http://www.w3.org/ns/auth/acl#agent": [{ "@id": "http://127.0.0.1:8732/me/profile/card.jsonld#me" }], "http://www.w3.org/ns/auth/acl#accessTo": [{ "@id": "http://127.0.0.1:8732/me/public/acl-repro/expanded/doc.ttl" }], "http://www.w3.org/ns/auth/acl#mode": [ { "@id": "http://www.w3.org/ns/auth/acl#Read" }, { "@id": "http://www.w3.org/ns/auth/acl#Write" }, { "@id": "http://www.w3.org/ns/auth/acl#Control" } ] }] -
GET doc.ttlas the owner →403;GET doc.ttl.aclas the owner →403
The same triples in compact form ("@context": { "acl": "http://www.w3.org/ns/auth/acl#" }, "acl:agent", "acl:mode", …) behave as expected: both GETs return 200.
Expected
The two documents are the same RDF, so they should authorize the same requests. Or, if JSS only supports a subset of JSON-LD for ACLs, the PUT should be rejected (e.g. 400/422) rather than accepted and silently ignored.
Cause
src/wac/parser.js:
isAuthorizationmatches the full@typeIRI, so the node is recognised as an authorization.parseAuthorizationthen readsnode['acl:accessTo'] || node['accessTo'],node['acl:agent'] || node['agent'],node['acl:mode'] || node['mode'], … Expanded keys (or keys with a different prefix) are never seen, soagentsandmodescome out empty.
Suggested fix
- Expand the document (jsonld
expand, already a dependency through the Turtle conversion) and read the full ACL IRIs, normalising@id/@valuearrays. That covers expanded form, any prefix,@contextarrays (cf. rdf/turtle: JSON-LD @context array form not handled — locally-resolvable contexts only #389), and@vocab. - Optionally, at PUT time: parse the incoming ACL the same way and reject it if it yields no authorizations, or if it would remove the writer's own Control. That's a cheap guard against self-lockout.
How it came up
Running SolidOS against JSS. JSS answers Turtle ACL PUTs with 415 + Accept-Put: application/ld+json, so the client retried as JSON-LD; the first version serialised in expanded form and the owner lost access to every resource it had just created (address book, schedule, chat).
Activity
fix(wac): refuse ACL writes that grant no mode to any agent (#631)
Merge pull request #632 from JavaScriptSolidServer/wac-acl-jsonld-exp…
bump version to 0.0.222
bump version to 0.0.222