Skip to content

ACL relative URIs not resolving correctly #24

Closed

Description

@melvincarvalho

Description

Relative URIs in ACL files (e.g., <./resource> or <./>) are not being resolved relative to the ACL file's location. This requires using absolute URLs in ACL files, which is non-standard.

Expected Behavior

Per the Solid WAC spec, relative URIs in ACL files should resolve relative to the ACL document's URL. For example, in /credit/.acl:

<#public>
    a acl:Authorization ;
    acl:accessTo <./> ;  # Should resolve to /credit/
    acl:default <./> ;
    acl:mode acl:Read .

Actual Behavior

Relative URIs don't match. Only absolute URLs work:

{
  "acl:accessTo": {"@id": "http://melvincarvalho.com/credit/week.json"}
}

Location

The issue appears to be in src/wac/checker.js in the urlMatches function, which does a simple string comparison without resolving relative URIs first.

Suggested Fix

Before comparing URLs in urlMatches(), resolve relative URIs against the ACL document's base URL.

Activity

  1. melvincarvalho commented on May 1, 2026

    @melvincarvalho
    ContributorAuthor

    Fixed in a736338 ("Resolve relative URLs in WAC ACL parser") on 2026-01-01 — src/wac/parser.js now resolves ./, ../foo/, etc. against the ACL document's base URL before the URL match step. Both JSON-LD and Turtle ACL forms work.

    Verified on the current gh-pages tip:

    import { parseAcl } from './src/wac/parser.js';
    const acl = {
      '@context': { acl: 'http://www.w3.org/ns/auth/acl#' },
      '@graph': [{ '@id': '#public', '@type': 'acl:Authorization',
                   'acl:accessTo': { '@id': './' }, 'acl:default': { '@id': './' },
                   'acl:mode': { '@id': 'acl:Read' } }]
    };
    const result = await parseAcl(JSON.stringify(acl), 'http://melvincarvalho.com/credit/.acl');
    // result[0].accessTo === ['http://melvincarvalho.com/credit/']
    // result[0].default  === ['http://melvincarvalho.com/credit/']

    Regression coverage already in test/wac.test.js:

    • should resolve relative accessTo URLs
    • should resolve relative default URLs
    • should resolve parent-relative URLs like ../other/

    Closing — reopen if anyone hits a relative-URI ACL that still doesn't resolve.

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