Skip to content

The context scope is inert: the authority re-refuses every grant it admits #655

Closed

Description

@filvecchiato

Split out of #454. That PR introduced the context scope, could not make it effective, and has since removed it: Granted ships as all | storage, and a manifest naming context parses as an unrecognised value. This issue owns introducing the scope for real — the vocabulary and the behaviour together.

The problem

A manifest granting context behaves identically to one granting nothing.

manifest_grants_scope (truapi-server/src/runtime.rs) is consulted by
create_account_proof and ring_vrf_sign
(runtime/capabilities/account.rs). Every request the grant admits is then refused one
layer down by require_owned_ring_vrf_key, in both authority implementations:

// runtime/signing_host.rs, mirrored in runtime/pairing_host.rs
if caller != handle.dot_ns_identifier {
    return Err(RingVrfError::NotAllowlisted);
}

That maps to the same wire error the grant seam itself would have produced, so the two
outcomes are byte-identical. The scope is inert.

Why the authority must re-adjudicate

The capability layer has already checked the grant, so the obvious fix is to relay that
decision to the authority as a flag on CreateProofAuthorityRequest /
RingVrfSignAuthorityRequest. That is not safe: on a paired host the authority request
arrives over the wire from another host, and a flag the caller sets is exactly what
require_owned_ring_vrf_key exists to stop. The component holding the keys has to decide
for itself.

So require_owned_ring_vrf_key becomes "the caller owns the key, or the owner's
manifest grants the caller context, and the user has not already refused" — resolved
against the chain by the authority, not handed to it.

What blocks that

The signing role cannot resolve a manifest.

  • install_asset_hub_genesis_hash is called only from runtime/pairing_host.rs.
    SigningHostConfig has no Asset Hub field, and SigningHostRuntime::with_chat_platform
    never installs one, so asset_hub_chain_genesis_hash() is None and every manifest
    lookup bails. A signing host would deny every grant.
  • PairingHost holds platform and chain but no RuntimeServices at all.

Adding the field means changing SigningHostConfig::new(...), which is constructed at the
UniFFI boundary (truapi-server/src/native.rs) and the JS boundary
(truapi-server/src/wasm.rs). That bumps the FFI checksum, so iOS, Android, the JS host
and the CLI all have to supply an Asset Hub genesis hash for the signing role and ship
regenerated bindings — which is why it is not part of #454.

Scope

  • SigningHostConfig carries the Asset Hub genesis hash; SigningHostRuntime installs it
  • Hosts supply it: iOS, Android, JS, truapi-host CLI
  • Regenerate and commit UniFFI bindings (make uniffi + sync-bindings.sh)
  • PairingHost can reach manifest resolution
  • Reintroduce Granted::Context and GrantedScope::Context, and the context value in docs/rfcs/granted-scopes.md
  • require_owned_ring_vrf_key admits a granted caller in both authorities
  • A grant never overrides a denial the user already gave: read the stored AccountAccess decision before the manifest, read-only, so a grant lookup never raises the prompt that would settle a NotDetermined one. RFC: Scoped grants in trustedProducts #454 had this and removed it with the scope
  • create_account_proof checks the session before the grant, matching ring_vrf_sign
  • Amend docs/rfcs/granted-scopes.md: context covers proof and signing on the
    granting product's keys, replacing the line that says signing has no scope of its own

Ordering hazard

create_account_proof checks the grant before the session while ring_vrf_sign checks
the session first. With no session, a granting target answers Rejected and a non-granting
one NotAllowlisted — a probe for who granted whom, and the thing the storage path's
uniform refusal was designed to prevent. Relaxing the authority makes this reachable, so
the reorder has to land with it, not after.

Tests to add

  • A cached context grant, a live session, and a foreign key handle: must succeed. This
    is the test whose absence let the dead path ship — the existing
    a_cached_context_grant_lets_a_foreign_proof_through asserts Rejected only because it
    has no session, so it proves the call reached the session guard and nothing more.
  • A persisted AccountAccess = Denied plus a context grant: still refused, at the runtime
    seam and again at the authority.
  • ring_vrf_sign on the grant path at all — currently untested.
  • all satisfying context at the runtime seam, not only in the parser.

Activity

  1. filvecchiato commented on Sep 9, 2026

    @filvecchiato
    CollaboratorAuthor

    Depends on #660. The authority re-adjudicating a grant runs on the signing role, which cannot resolve a manifest until the Asset Hub genesis hash is installed there. #660 is that half, and it stands alone: storage is already merged and already dark on those hosts.

  2. peetzweg commented on Sep 9, 2026

    @peetzweg
    Member

    We are a concrete consumer of this: dim2.<tld> (the personhood game) registering a lite person needs ring-VRF proofs made with peopl.<tld>'s lite key in peopl's score context — for PeopleLite.set_alias_account before the game's sign-up, again on later sign-ups when the ring moved, and for recognised persons' Game.sign_up_with_alias. Today every such request from dim2 answers NotAllowlisted (truapi-host 0.13.1), so the person leaves for peopl, binds there and comes back, with a window in which the ring can move and send them back again. With a context grant from peopl to dim2 we would do bind → sign-up in one press.

    What we need to know: whether the fix here is planned for the manifest path (as RFC-0024 describes) rather than a per-proof prompt, and roughly when it reaches truapi-host.

  3. self-assigned this
    on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

R2 blockerMust be done for R2host-workNeeds implementation in one or more host repos

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions