Repository navigation
Agent-ready PasteVault: CLI, sealed shares, secret requests, run, MCP and audit - #260
Merged
Merged
Conversation
Schema for tokens, agent identities, secret requests and audit events; session-or-token principal with scopes; personal API tokens; minute expiry and max_views; audit log; shared route registration. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Text and .env pastes in the web /p/ format, stdin input, get for pastes, --json and stable exit codes on every command, PASTEVAULT_TOKEN and login --with-token, key/password from files or env, list/revoke/status/ audit/token commands, shared crypto test vectors, CLI reference and an e2e CI workflow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
…cing - `pastevault up` migrates by default again, before routes create tables; SQLite skips the Postgres-only migrations instead of warning - CORS only answers the server's own and configured origins; cookie sessions can't make state-changing requests from untrusted origins (403 origin_not_allowed); TRUST_PROXY configures Fastify's trustProxy - Bad pv_pat_ tokens are rejected on every /api route; tokens bound to a revoked agent are invalid and /me hides revoked agents - Coalesce share.viewed for unlimited shares; enforce the token cap after create; roll back shares whose ownership record fails; no-store on the owned-share list - Tests: e2e-security suite, file-share max_views race, Postgres checks for plain `up` and the PR1 upgrade path Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Agents API with server-side fingerprints and token binding; shares sealed to an agent's X25519 key (PVWRAP1) that only the recipient can consume; CLI agent commands, put --to/--to-key, sealed get, TOFU pins; matching TypeScript wrap/fingerprint with shared vectors; sealed-share card in the web viewers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
- get renames on a clash after opening instead of failing after a view - bare slug#k= tries pastes first on servers without /meta - passwords are used as typed; whitespace-only passwords are rejected - API client refuses redirects so credentials are never forwarded - paste size checks match the server's request limit; .env falls back to a file share when too large; capabilities report paste limits - token input without echo, token create --out, capability gating for account commands, anonymous retry on an invalid token for public reads Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
- get refuses a link carrying a key or password that the server claims is sealed, before consuming (prevents server-forged content) - pvk1_ prefixes only resolve to pinned or local keys - a token bound to one agent cannot revoke another - non-canonical X25519 keys and base64url rejected in server, Go and TS - pins persist only after a successful create; recipient auth on chunk downloads of sealed shares; audit denial coalescing keyed by reason - document that sealed shares do not authenticate the sender Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Secret-request API (short codes, hashed poll tokens, one-time delivery with a short re-poll lease, rate limits, expiry, audit); CLI request, await, fulfil, decline and cancel; a local store sealed to the agent key with pv://secret handles; run with env injection and output masking; inject for templates; get --save. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
/account is split into cards under components/account: shares (views as n/max, sealed badge with the agent name, per-share activity timeline), agents (fingerprints recomputed locally, pin state, revoke, trust a changed key), API tokens (new-token dialog that shows the token once, revoke) and the account activity log with cursor paging. The page is now fully translated. The home page gains a Recipient select for signed-in accounts with agents. Sealing to an agent recomputes the fingerprint from the public key, checks it against a per-account TOFU pin in localStorage (a mismatch blocks sending), wraps the content key with sealToRecipient, forces one view and no password, and shows a link without #k plus a `pastevault get <url>` hint. Works for pastes and file shares; drafts keep the user's own burn/password choices. The API client no longer sends Content-Type: application/json on bodiless requests, which made every DELETE (including deleting a tracked share) fail with 400. All new strings are in the six locales. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
pastevault mcp (stdio, official go-sdk) with send/receive/request/status tools and no read_secret tool, confined to declared roots and refusing secret-like plaintext; Claude Code plugin and marketplace, Codex plugin, Gemini extension, SKILL.md and AGENTS snippet with a manifest check in CI; docs/agents.md, docs/security-model.md and refreshed README, CLAUDE.md and AGENTS.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
/r/<code> lets the signed-in owner answer an agent's secret request. The page recomputes the request key's fingerprint and compares it with #fp=: verified, a blocking mismatch, or a compare-by-eye notice when the link has none. It shows the requesting agent with this browser's pin state, the reason strictly as plain text in an "untrusted message" box, and an expiry countdown. The answer is a masked textarea and/or a file, checked against max_bytes after encryption, sealed in the browser and posted to fulfill. The page then polls until the agent collects it, and also offers decline. It handles the expired, declined, cancelled, delivered and not-found states, and never stores the value. The account page gains a Requests card: pending requests link to the page, recent ones show their status, metadata only. lib/secret-requests.ts seals the request payload (AAD pastevault:request:<id>:v1, wrap context request:<id>). A new request_payload crypto vector section is generated from it; Go checks that OpenSecretPayload opens it and reproduces the same bytes, and the TS test re-seals it. All new strings are in the six locales. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
…ening - creating a secret request needs a session or a token bound to that agent - masker covers RFC 3986/encodeURIComponent/quote/userinfo escaping in both hex cases and multi-line values (LF, CRLF, per line) - masked run no longer waits on background grandchildren; signals that arrive before start are replayed; race-clean and -race in CI - revoking an agent cancels and wipes its requests; request files survive transient errors; await --save-as/--overwrite and collision fallback - inherited env only resolves pv://secret handles; full fingerprints for request fulfil; stricter reason filtering and sanitised CLI output Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
- Sign-in return paths go through lib/redirects.ts: same origin only, no backslashes, whitespace or control characters, also once percent-decoded. Used by /account, the device page and the /r sign-in link. - Pins live in one store per origin (pv:pins), matched by agent id or name across accounts, so a server that changes the user id can't make a swapped key look like a first use. Per-user v1 stores are migrated. - Browsers without -webkit-text-security keep the textarea, show the value with a notice, and never alter it (no single-line password fallback). - /r keeps the form on a failed refresh, showing an inline "retrying" notice. It retries once with backoff, honours Retry-After, and backs off on 429. - Countdowns use the server clock (Date header offset), and only the server decides that a request expired. - Token dialog: can't be dismissed while creating or while the token is shown. The create mutation has gcTime 0. - Pages send frame-ancestors 'none' and X-Frame-Options: DENY. - Long names wrap. An empty #fp= blocks. sealedFor is cleared per create. - Audit labels use a whitelist of known events, and request rows show name and code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
- Paths: deny lists ignore case and trailing dots/spaces; paths are re-checked from the opened handle (/proc, F_GETPATH, GetFinalPathNameByHandle); reads open with O_NOFOLLOW; .git, harness state (~/.claude, ~/.codex, ~/.gemini), CLI credentials, histories and key files are refused; home, / and ancestors of home are never roots without --allow-home-root. - receive stages get's output in a private directory and places files itself: safe names for sender-chosen names, explicit risky names and config/CI/tool directories refused, no symlink following, overwrite only of files it wrote this session, default pastevault-received/; save_as overwrite only for the same share; only the configured server's shares unless --allow-any-host (openWorld). - Secret-like detector: secret-named keys in dotenv/YAML/JSON/INI, spaced KEY = value, case-insensitive PEM, more token prefixes, NFKC and homoglyph folding, tokens wrapped across lines. - requestState bound to its tool and verified for roots responses; request_status not read-only, gains wait_seconds (<= 55), per-request locking; waits fit client tool timeouts; stdout swap documented. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
…rence Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Roots are stored symlink-resolved, but the early check compared the path as typed, so on macOS (/var -> /private/var) and Windows (RUNNER~1 short names) files inside a root were refused. The early check now also resolves the longest existing prefix of the path before comparing with the roots and deny lists. Deny-list entries that do not exist yet (for example ~/.codex/auth.json under a symlinked home) are resolved the same way, so they still match once created. TestCaseInsensitiveRootContainment no longer expects case-sensitive containment on Windows, where filepath.Rel ignores case. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Creating the lock file while the previous holder's delete is still pending fails with ERROR_ACCESS_DENIED on Windows, not "file exists", so concurrent state updates failed intermittently (TestConcurrentStateUpdatesPreserveRollbackSkip on windows-latest). Treat it like a held lock and retry until the deadline. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk
Merged
10 tasks done
dartpain
added a commit
that referenced
this pull request
Oct 17, 2026
Agent-ready PasteVault: CLI, sealed shares, secret requests, run, MCP and audit (#260 → main)
This branch was successfully deployed
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
Makes PasteVault a safe way for AI agents and humans to exchange files,
.envfiles and secrets, and lets an agent use a secret without the secret entering its transcript.Five features, built in six stages from one design spec. Every stage got an independent adversarial review, and the review findings were fixed before the next stage.
1. Agent-ready CLI basics
.envpastes in the exact web/p/format, byte-identical and checked with shared crypto test vectors. Pastes can come from stdin (cat .env | pastevault put -).get: reads/p/pastes too. It checks metadata first, so a missing key, missing password, sealed share or unwritable output fails before a view is used.--jsonon every command, with a single error envelope, plus a stable exit-code table (docs/cli-reference.md).pv_pat_…, stored as SHA-256 hashes, expiring, revocable). Use them withPASTEVAULT_TOKENorlogin --with-token, and manage them from the web or withpastevault token.--no-key-in-outputkeeps the key out of output, and--key-outwrites it to a 0600 file.--expires 15m).max_viewsgeneralises burn-after-read and is consumed atomically.list,revoke,status --wait viewed|burned(read receipts) andaudit.2. Agent identities and recipient-bound ("sealed") encryption
pastevault agent initcreates an X25519 key pair and registers the public key. The fingerprint ispvk1_….put --to <agent>(or "Share to agent" on the web) wraps the content key to the agent's public key using PVWRAP1 (X25519 + HKDF-SHA256 + XChaCha20-Poly1305, with the context and recipient fingerprint in the AAD).3. Secret request flow (human → agent)
pastevault request OPENAI_API_KEY --why "run evals" --waitprintshttps://…/r/ABCD-EFGH#fp=….#fp) and the agent's reason, marked as untrusted text. The human types the secret or uploads a file, and the browser seals it to the request key.pv://secret/OPENAI_API_KEY. The server never sees plaintext and wipes the response after delivery.4.
pastevault runwith.env.pvreferences.env.pvholdsKEY=pv://secret/NAME(or share handles).pastevault run --env-file .env.pv -- cmdresolves the references, strips PasteVault's own credentials from the child's environment, forwards signals, and masks secret values in stdout and stderr. Masking covers the raw value plus base64/base64url (at all alignments), hex, every common URL encoding, JSON escaping, and multi-line values. Matches split across writes are still caught.injectfills template files.get --savestores into the local store.5.
pastevault mcp, a skill and per-tool pluginssend_text,send_file,receive,request_secret,request_status,list_secrets,share_status,audit,revoke_share) and noread_secret.receivestores secret-like content instead of returning it. File access is limited to the declared roots and refuses credential locations, regardless of case. Sender-chosen names that agents load (.mcp.json,CLAUDE.md, …) are renamed.request_secretwhen the client supports it.config.toml, a Gemini CLI extension,SKILL.mdand an AGENTS.md snippet. The manifests are validated in CI. The plugins were validated and connected with the realclaude,codexandgeminiCLIs (in a scratch HOME).6. Read receipts and audit log
AuditEventtable records metadata only: shares created, viewed, burned or revoked, access denied, requests, agents and tokens. IP storage is off by default (AUDIT_IP_MODE,TRUST_PROXY), events have a retention period, and repeat views are coalesced./accountshows per-share activity timelines and an account Activity log. The CLI hasstatus --waitandaudit.Web UI
/account: split into Shares (views and sealed badges), Agents, API tokens (each token shown once), Requests and Activity cards./r/[code].Security hardening found in review (all fixed here)
Originare rejected (origin_not_allowed).pv_pat_token gets 401 everywhere, and a token bound to a revoked agent is dead.#k=link as "sealed" to forge content; the CLI refuses before consuming. Non-canonical X25519 keys are rejected in the server, Go and TS. Fingerprint prefixes only resolve to keys that are already pinned.pastevault upmigrates by default again, and on Postgres it runsmigrate deploybefore the startup DDL.Known limitations (documented in
docs/security-model.md)#k=links do protect integrity. Agent-to-agent sender signatures are a possible follow-up.--to-keysealed links, and every sealed share underDISABLE_AUTH, can be consumed (burned) by anyone holding the link, though not decrypted.runand the MCP no-plaintext policy protect transcripts. An agent with a shell can still read secrets that are injected into processes it controls.Compatibility
expires_in_hoursandburn_after_readstill work, and existing#k=links and formats are unchanged.20261020_agent_ready), and the CI check covers drift for fresh installs, plainup, and upgrades from Harden burn-after-read, uploads and CLI secret handling #259.DISABLE_AUTH=true: the account, token, agent, request and audit routes return 404, and capabilities reportfalse.Docs
docs/cli-reference.md(every command, JSON shape and exit code),docs/agents.md(setup for each tool),docs/security-model.md, plus refreshedREADME.md,CLAUDE.md/AGENTS.mdandfeatures.md.Test plan
gofmt,go vet(linux/darwin/windows),go test ./...,go test -race ./..., and cross-compiles for 6 targetsnpm run typecheck && npm run lint, both root andfrontend/npm run test:crypto: shared vectors (paste, chunk, manifest, fingerprint, wrap incl. negatives, request payload) checked by the web code, Go and TS testsnode scripts/check-integrations.mjsnpm run test:e2eon SQLite: all 7 suites (smoke, tokens, security, cli, agents, requests, mcp)tests/check-postgres-migrations.mjs(fresh, plainup, upgrade from Harden burn-after-read, uploads and CLI secret handling #259) and the tokens/security/agents/requests suites/rrequest answered and delivered and then used throughrun, tampered or empty#fpblocked, inert reason rendering, clock skew, poll errors, open-redirect payloads, 6 locales, 390 px mobile, dark modeclaude plugin validate --strict,codex mcp list,gemini extensions validate; each server showed as connectede2e.ymlworkflow with a Postgres service)🤖 Generated with Claude Code
https://claude.ai/code/session_01TPmHC7r6snr4Ccq3zga1rk