~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Percent-encoded scope values are not decoded, so the scope is withheld

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

scope query values are compared as raw text. Take an app that asks for space:com.example.cal?authority=did%3Aplc%3Aabc&action=read, which is what URLSearchParams produces and what the reference scope parser decodes. Here for_group compares did%3Aplc%3Aabc with did:plc:abc, so narrow withholds the scope (space is None, and the request falls through to false). The same holds for an encoded skey or collection, and Permissions::space would not match such a value when the token is used. The host encodes this way itself: move_scope (account_move.rs:172) escapes every : in its aud. No test covers an encoded scope value.

How to see it

Read against docs/fresh at 4636e6d, the code at: crates/group-host/src/oauth_scope.rs:45 (SpaceScope::parse), :75 (for_group); crates/group-host/src/scopes.rs:18 (query). Paths are under crates/group-host/src unless they say otherwise. Severity: medium.

What you expected

Percent-decode each key and value when a scope's query is split, in both SpaceScope::parse and scopes::query. A shared helper would keep the two readings the same.

Where

The host, as built from 4636e6d. Found while checking the docs against the code.