Skip to content

WAC: ACL parser reads literal acl: keys, so valid expanded JSON-LD ACLs grant nothing and lock the owner out #631

Closed

Description

@melvincarvalho

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):

  1. PUT /me/public/acl-repro/expanded/doc.ttl (Turtle) → 201

  2. 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" }
      ]
    }]
  3. GET doc.ttl as the owner → 403; GET doc.ttl.acl as 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:

  • isAuthorization matches the full @type IRI, so the node is recognised as an authorization.
  • parseAuthorization then reads node['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, so agents and modes come out empty.

Suggested fix

  • Expand the document (jsonld expand, already a dependency through the Turtle conversion) and read the full ACL IRIs, normalising @id/@value arrays. That covers expanded form, any prefix, @context arrays (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).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions