feat(accounts): serve harness credentials from the vault, and mint keys as a principal - #27
Merged
Merged
Conversation
…ys as a principal The harness asks a host for an account bearer and a per-database data-plane token; VaultCredentials answers both out of the unlocked vault, so consumers stop keeping their own plaintext account.json. It refuses rather than guesses when the answer is ambiguous. Keys can also be minted as a Constructive principal - a scoped sub-identity that can only narrow its owner - so a CI key carries its own permission mask instead of a copy of a human's access.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two things that make dcrypt useful to something other than a human at the UI.
1. dcrypt as a credential provider.
@agentic-kit/harnessdoesn't do auth — it defines the contract and makes the host supply it.VaultCredentialsis that host, reading the unlocked vault instead of a plaintextaccount.json:The interesting part is what it won't do. It refuses rather than guesses:
nullwhen no account is signed in, when several are and none was named, when the token has expired, and when zero — or two — keys claim the database. Nothing is cached, so every call re-reads the vault and locking cuts every consumer off at once. A data token is served even while its account is signed out, because an API key is its own credential, not a derivative of a session.Keys learn which database they are for, as ordinary (non-concealed) metadata:
2. Principals. A Constructive principal is a scoped sub-identity — what a key or an agent actually acts as — owned by a human and able only to narrow them:
isReadOnly, a per-scopeallowedMaskAND-ed with the owner's permissions during the SPRT cascade, andbypassStepUpso CI isn't blocked on someone's phone. No override row for a scope means it simply inherits the owner there, which the CLI says out loud rather than rendering an empty list.So "ci-deploy-key" becomes an identity with its own mask instead of a copy of your access.
createApiKeyroutes tocreateOrgApiKeywhen anorgIdis given; both carryprincipalId. Principals are read from the server on demand and deliberately not mirrored into the vault — a stale local copy of someone's permissions is worse than none. Creating and deleting one goes through the samewithStepUphold-and-replay as every other sensitive call.CLI:
Tests
packages/accountscovers the refusals specifically — ambiguous accounts, ambiguous databases, expired tokens, a data token surviving sign-out, and thatassignKeyToDatabaseleaves the concealed secret untouched — plus principal creation, step-up on creation, deletion, and refusing to reach the server when signed out. Repo lint, build, test and desktop typecheck are green.Not in this PR: the desktop UI for principals, and the IPC that would expose the provider to another process.
Link to Devin session: https://app.devin.ai/sessions/04636534e07048089ffb6b78142e12cd
Requested by: @pyramation