Skip to content

Unscoped Capabilities are unusable #121

@blaine

Description

@blaine

When using unscoped capabilities (e.g., ucan:*), rs-ucan converts this "with" into * and omits the URI scheme:

"*" => ResourceUri::Unscoped,

this alone is probably a security issue (e.g., ucan:* is not equal to https:* for capability purposes), but has the unfortunate downside that unscoped capabilities are then not usable for the purposes of chain validation:

let uri = Url::parse(resource).ok()?;

In the above, the scope (which has been down-converted to simply * from e.g. ucan:*) is re-parsed and silently fails (use of anyhow here masks this error), returning None instead of the otherwise-valid capability.

The workaround is easy, i.e. just don't use unscoped capabilities, but flagging this here for a future fix. A fix should be as simple as either not using Unscoped at all (literally removing this line,

"*" => ResourceUri::Unscoped,
fixes the brokenness) and switching to only scoped capabilities, or adding a URI scheme to the Unscoped Resource type (as Scoped has).

I don't know what the motivation behind treating unscoped capabilities differently was, so I'll hold off on contributing a patch for now but lmk!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions