Skip to content

App grants: one secret sealed to an external app (key hub phase 1) - #286

Merged
ralyodio merged 2 commits into
masterfrom
key-grants
Nov 11, 2026
Merged

ralyodio merged 2 commits into
masterfrom
key-grants

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Phase 1 of the CoinPay ↔ logicsrc key hub. Spec: https://claude.ai/artifact/LAZgAiqWqeLQ14uJ5JpdKb (private doc).

What

An app asks for named keys. You approve on logicsrc. Your browser decrypts each value and seals it to that app's per-user inbox key. logicsrc relays ciphertext only.

  • /grant?origin=&nonce=
    • logicsrc fetches <origin>/.well-known/logicsrc-grant/<nonce> itself, over TLS, so the consent page shows a verified origin. Anything the app POSTs is never trusted.
    • The fetch is https only, to public addresses only (private, link-local, CGNAT and metadata ranges are refused), with no redirects.
    • The webhook and return URLs must be on the same origin.
  • Approve
    • The value is decrypted in the browser with the identity key, using the same libsodium calls as the vault page. It's then sealed with @profullstack/sealed-secrets, the format meshhook, smshub and others already open.
    • The server checks that the vault fingerprint is current and refuses signing keys. It stores app_grants as metadata plus ciphertext only.
  • Webhooks use Standard Webhooks signatures: grant.delivered, grant.updated, grant.revoked.
  • Rotation: teams rotate-keys now re-seals the new value to every grant on the old fingerprint (resealAppGrants). Each grant reads its own vault and secret name, and the result is reported in the run output.
  • /apps lists grants and revokes them. Revoking tells the app to delete its copy and says to rotate as well.

Defaults taken for the spec's open questions

  • No always-on exception: unlock-on-use stays.
  • Team-vault grants are allowed, approved by any member who can open the vault.
  • Revoke does not rotate automatically.
  • The feature is free.

Tests

  • apps/pwa: 122/122. The new app-grants.test.mjs runs a full crypto round trip against a fake app (manifest, consent, approve, signed webhook, the app's own key opens it). It also covers signing-key refusal, stale fingerprints, another user's request, rotation re-delivery and revoke.
  • packages/cli: the new rotate-app-grants.test.ts passes, and so do the existing rotate tests. umbrella.test.ts has 2 failures that already fail on master (checked in a clean worktree).

🤖 Generated with Claude Code

ralyodio and others added 2 commits November 11, 2026 13:16
…r inbox

Phase 1 of the CoinPay <-> logicsrc key hub (spec: claude.ai/artifact/LAZgAiqWqeLQ14uJ5JpdKb).

- /grant consent page: logicsrc fetches the request manifest from the app's
  own origin over TLS (/.well-known/logicsrc-grant/<nonce>), public hosts
  only, so the page shows a verified origin, not a claimed name
- The browser decrypts with the identity key (as the vault page does) and
  seals with @profullstack/sealed-secrets to the app's inbox; the server
  stores ciphertext + metadata only (app_grant_requests, app_grants)
- Signed Standard Webhooks to the app: grant.delivered / updated / revoked
- Signing keys (wallet, seed, SSH) are refused for apps
- rotate-keys re-seals the new value to every app grant on the old
  fingerprint (resealAppGrants); /apps lists and revokes grants

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit bbf640a into master Nov 11, 2026
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

55 finding(s)

HIGH/CRITICAL: 2 | MEDIUM: 29 | LOW: 24

Severity Rule Location
HIGH js-host-header-trust apps/commandboard-web/server.js:27
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:45
MEDIUM js-unescaped-html-sink apps/commandboard-web/src/main.ts:19
MEDIUM sh-remote-script-execution apps/logicsrc-web/public/install.sh:71
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/[[...slug]]/page.tsx:59
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/layout.tsx:88
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/app/pricing/page.tsx:42
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/components/breadcrumbs.tsx:43
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/components/pit-footer.tsx:16
MEDIUM js-unescaped-html-sink apps/logicsrc-web/src/components/site-shell.tsx:36
MEDIUM js-unescaped-html-sink apps/pwa/public/keyring.js:51
MEDIUM sql-template-interpolation apps/pwa/src/routes/rotation.mjs:79
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:253
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:297
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:299
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:303
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:307
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:326
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:327
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:329
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:330
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:331
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:334
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:395
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:402
MEDIUM redos-nested-quantifier packages/cli/src/rotation-catalog.ts:408
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:10
MEDIUM redos-nested-quantifier packages/opencontext/src/ids.ts:11
MEDIUM js-timing-unsafe-mac-compare packages/opencontext/src/validate.ts:208
MEDIUM redos-nested-quantifier packages/openerrand/src/browser.ts:34
MEDIUM redos-nested-quantifier packages/openontology/src/ids.ts:20
LOW secret-generic-credential apps/pwa/test/appbar.test.mjs:10
LOW secret-generic-credential apps/pwa/test/signup-profile.test.mjs:61
LOW secret-generic-credential apps/pwa/test/signup-profile.test.mjs:72
LOW secret-openai-key packages/cli/src/desktop-flow.test.ts:315
LOW secret-generic-api-key packages/cli/src/desktop-flow.test.ts:315
LOW secret-generic-api-key packages/cli/src/rotate-flow.test.ts:177
LOW secret-generic-credential packages/cli/src/rotate-flow.test.ts:184
LOW secret-generic-api-key packages/cli/src/rotate-flow.test.ts:198
LOW secret-generic-credential packages/cli/src/rotate-flow.test.ts:204
LOW secret-generic-credential packages/cli/src/rotators.test.ts:52
LOW secret-generic-credential packages/cli/src/rotators.test.ts:75
LOW secret-generic-credential packages/cli/src/rotators.test.ts:135
LOW js-hardcoded-crypto-key packages/cli/src/rotators.test.ts:222
LOW secret-database-url packages/cli/src/rotators.test.ts:258
LOW secret-database-url packages/cli/src/vault-clean.test.ts:10
LOW secret-aws-access-key packages/opencontext/src/permissions.test.ts:260
LOW secret-stripe-key packages/opencontext/src/permissions.test.ts:262
LOW secret-aws-access-key packages/opencontext/src/security.test.ts:228
LOW secret-database-url packages/opencreds/src/categories.test.ts:98

…and 5 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

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.

1 participant