Skip to content

CSS seemingly allows PATCH-to-create c/r without acl:Write permissions on c/r (201 instead of 401) #146

@michielbdejong

Description

@michielbdejong

Environment

CSS v4.0.1, node v12.19.1, npm v6.14.8

Description

Save this file as acl.ttl:

@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#read-append> a acl:Authorization;
  acl:agentClass foaf:Agent;
  acl:accessTo <http://localhost:3000/>;
  acl:default <http://localhost:3000/>;
  acl:mode acl:Read, acl:Append.

Upload it to http://localhost:3000/.acl by doing:

curl -v -X PUT -H 'Content-Type: text/turtle' -T acl.ttl http://localhost:3000/.acl

Now save this as patch.n3:

@prefix solid: <http://www.w3.org/ns/solid/terms#>.
<#patch> a solid:InsertDeletePatch;
  solid:inserts { <#hello> <#linked> <#world> .}.

and run the following two curl commands:

curl -X PUT -d '<#hello> <#linked> <#world>.' -H 'Content-Type: text/turtle' http://localhost:3000/with-put.ttl
curl -X PATCH -T patch.n3 -H 'Content-Type: text/n3' http://localhost:3000/with-patch.ttl

You will see the first one results in a 401, the second one in a 201, and indeed when you do curl http://localhost:3000/ you see /with-patch.ttl was created and /with-put.ttl was not:

[...]
    ldp:contains <index.html>, <with-patch.ttl>.

And with curl http://localhost:3000/with-patch.ttl you can see the contents:

<#hello> <#linked> <#world>.

Why is this different depending on the verb?

See also solid/web-access-control-spec#105.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions