Repository navigation
Finish the key-place review's agent-safety changes - #106
Merged
Merged
Conversation
The 2026-11-02 review found encrypted-note "partly" safe as a place for keys with AI agents around. This does the rest of its changes that need no ADR amendment and no owner-only decision. Agents still stay out of the Vault (ADR-0007). - Companion: fixed provider_rejected and model_refusal errors, "tell the owner" endings, an honest tool description, the destination pinned in policy.json, and write-agent-key.mjs for the real key file. - Checks: secret and Seed Phrase scan, pinned entitlement hashes, stricter Companion networking rules, npm audit in CI, .env ignored. - Owner scripts: build-reader.sh and companion-setup.sh; package-companion.sh --app needs --owner-build for the real identifier. - App: Show and Copy refused unless the window is in front, missing and older Vault warnings, a Touch ID file-changed notice, "ended because the Vault locked", Screenpipe in the Sharing Guard, and the Reader's list printed only to a terminal. - Docs and in-app text: "When an agent needs a key", and wording that promised more than the code does. An independent review found 21 problems in the first version; all are fixed. ./scripts/check.sh passes on macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
The 2026-11-02 review asked whether encrypted-note is a safe place to keep keys when AI agents are around. Its answer was "partly", with 12 recommended changes. #105 covers two of them. This PR does the rest that need no ADR change and no owner-only decision. Agents still stay out of the Vault (ADR-0007).
Stacked on #105. Review that one first.
What changed
Agent Companion
provider_rejected: HTTP 400 or 404. The agent is told not to retry and to tell the owner.model_refusal: none of the refusal's wording is returned.timeout,provider_unavailableandinvalid_responsenow end "If it fails again, tell the owner."policy.jsonnow names the destination:https:,api.openai.com, port 443,POST,/v1/responses.generate.mjsbuilds its request from those fields and refuses to load with any other.policySha256in the lock is updated.companion/isolation/write-agent-key.mjswrites the real Agent Key file from stdin.scripts/package-companion.sh --apprefuses the real identifier unless you also pass--owner-buildand type the identifier at a terminal.Repo checks
scripts/scan-secrets.mjs(run by check.sh) scans tracked files for:scripts/pinned-hashes.txtpinsEntitlements.plistand the helper and Node entitlements. check.sh fails if one changes.scripts/check-network-source.mjs:generate.mjsmay importnode:httpsand onlyhttp.mjsmay importnode:http;dns) is allowed incompanion/;policy.jsonmust match its pin and name the approved destination.npm audit --omit=dev --audit-level=highfor the root and forcompanion/..gitignoreignores.env,.env.*and*.env.Owner scripts
scripts/build-reader.sh --out <folder>builds the Emergency Reader from a fresh clone oforigin/main.scripts/companion-setup.sh [--dry-run] <agent account>replaces the manual folder, fake key and plan steps.App
settings.jsonkeeps the Vault's id and change count (FORMAT.md section 14):settings.jsoncan defeat them.--reveal.Docs and in-app text
write-agent-key.mjs.Tests
./scripts/check.shpasses on this Mac: 732 Rust tests, 75 Companion tests, clippy, fmt, cargo deny, the helper typecheck, the network and secret scans, the entitlement pins and the WebView build.TMPDIR. Before the review fix, one new test failed there.ended_by_lock;npm audit(needs the network; it runs in CI);companion-setup.shagainst a real agent account;Review
An independent review in four areas, with a skeptic re-checking every finding, found 21 problems. All are fixed, and a separate check confirmed each fix. The main ones:
Decisions taken for the owner (easy to reverse)
Still the owner's call
--owner-buildcan still be passed by anything with a pseudo-terminal. A plainnpm run tauri -- buildbuilds the real identifier with no gate.🤖 Generated with Claude Code