Skip to content

feat: read-only mode via delegations with queries-only permissions#4016

Draft
aterga wants to merge 1 commit into
mainfrom
claude/wonderful-sagan-boufou
Draft

feat: read-only mode via delegations with queries-only permissions#4016
aterga wants to merge 1 commit into
mainfrom
claude/wonderful-sagan-boufou

Conversation

@aterga

@aterga aterga commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a "Read-only mode" checkbox to the authorize continue screen. When enabled, account delegations prepared for the session carry the new permissions field set to "queries" (covered by the delegation signature), which makes the IC reject update calls authenticated through them (see dfinity/ic#10449) while query calls remain permitted.

  • Backend: trailing read_only : opt bool arg on prepare_account_delegation and get_account_delegation; local delegation_signature_msg_with_permissions helper supporting the permissions field; the Delegation candid record gains permissions : opt text.
  • Frontend: checkbox wired through authorizationStore into the ICRC-34 delegation channel handler and passed to both endpoints.
  • Tests: integration test asserting the permissions field, signature validity, and that the signature binds to the permissions (lookup without read_only yields NoSuchDelegation).

Note: returning restricted delegations to relying parties requires @icp-sdk/core to round-trip the permissions field; until then, restricted delegations fail closed on the dapp side.

Notes on applying

  • Applied via three-way merge onto current main (originally cut against 794b7d2); merged cleanly.
  • New translatable strings are in the source but the lingui catalogs (*.po) were intentionally left untouched: main's committed catalogs are already behind its sources, and catalog updates land via the separate translation job.

Verification

  • cargo check / cargo clippy --all-targets clean for internet_identity, internet_identity_interface, canister_tests
  • tsc --noEmit, svelte-check (0 errors), eslint pass
  • Canisters built via scripts/build; integration tests against the built wasm:
    • accounts::should_get_read_only_account_delegation_with_queries_permissions passes
    • full accounts:: module: 22 passed, 0 failed

https://claude.ai/code/session_018gHRjyFYqumMxAMwbPRLuN


Generated by Claude Code

Adds a "Read-only mode" checkbox to the authorize continue screen.
When enabled, account delegations prepared for the session carry the
new permissions field set to "queries" (covered by the delegation
signature), which makes the IC reject update calls authenticated
through them (see dfinity/ic#10449) while query calls remain permitted.

- BE: trailing read_only opt arg on prepare_account_delegation and
  get_account_delegation; local delegation_signature_msg helper
  supporting the permissions field; Delegation candid record gains
  permissions : opt text.
- FE: checkbox wired through authorizationStore into the ICRC-34
  delegation channel handler and passed to both endpoints.
- Tests: integration test asserting the permissions field, signature
  validity, and that the signature binds to the permissions (lookup
  without read_only yields NoSuchDelegation).

Note: returning restricted delegations to relying parties requires
@icp-sdk/core to round-trip the permissions field; until then,
restricted delegations fail closed on the dapp side.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants