Repository navigation
feat(secret): read Secrets from 1Password through Secret Grants - #476
Merged
Merged
Conversation
Add Secret Providers to Pi Secret, starting with 1Password through the op CLI. secret_list searches a provider's items and fields (never values), secret_ask_grant asks the user to approve Secret Grants that are read again from the provider at each use, and secret_save saves a typed Secret into a new 1Password item after approval. Sessions store only a grant's locator. pi-utils' secret registry gains refresh callbacks so Child Agents read grants fresh (ADR-0010), and Pi Guardian allows the new tools by default. A backslash before a Secret Reference now makes it literal text.
The pre-push hook now runs pnpm verify:push (format, lint, typechecks). CI still runs the full pnpm verify.
… appears in them Redacting the whole history with every value held rewrote earlier messages when a Secret Grant read a value the model had already seen, discarding the provider's prompt cache. Each message is now redacted at the Redaction Generation it was first sent at (pi-secret ADR-0002).
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
Pi Secret can now read Secrets from a Secret Provider (1Password, through the
opCLI) using Secret Grants the user approves. It can also save a typed Secret into a new 1Password item. The session stores only a grant's Secret Locator, never a value, and the value is read again at each use, so one-time passwords stay current.secret_ask_grant,secret_saveand one guideline line are registered only whenopis onPATHat load. That is decided once, so the cached prompt prefix stays stable within a session.secret.providers.1password.{account, vaults}setting. The vault allowlist is checked on describe, search, save and every read, and errors never name a vault outside the list. Invalid settings fall back to no vaults.\$PI_SECRET_NAMEis left as written.Evidence
\{{secret:NAME}}was blocked ("references {{secret:NAME}}, which this session does not hold"). There was no way to use a 1Password item without the user pasting its value.After: focused offline suites, all with a fake provider or a fake
op:pi-secret: 72 passed (6 files). New:secret-grants.test.tsandone-password-provider.test.ts, plus escape cases inpi-secret-extension.test.ts.pi-utilssecret-registry.test.ts: 14 passed.pi-guardiantool-policy.test.ts: 86 passed. Rootsecret-guardian-combined.test.ts: 3 passed.pnpm verifywas not run locally; CI covers it.opwas signed out). Checksecret_saveitem creation and an?attribute=otpread by hand.Merge Danger
Door: two-way
The new session entry types (
pi-secret-grant,pi-secret-forget) are additive. Older versions ignore them, and the existing typed-Secret path is unchanged apart from the escape handling.Blast Radius: moderate
oponPATH: two new tools, andsecret_listsearches 1Password by default, sending item titles and field labels from every vault the CLI can see to the model unlessvaultsis set.Also includes a separate
chorecommit: the pre-push hook now runspnpm verify:push(format, lint, typechecks) instead of the fullpnpm verify. Test suites run only in CI, which still runspnpm verify.AGENTS.mdandREADME.mdare updated to match.