You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(agent): route set_identity through agent to preserve meta-tag integrity (#242)
* fix(agent): route set_identity through agent to preserve meta-tag integrity
set_identity previously called save_meta() directly from the CLI process,
modifying the .meta file without updating the HMAC meta-tag in the keychain.
This broke all subsequent sign operations because ensure_meta_integrity()
detected the file/tag mismatch and rejected it as tampering.
Route identity updates through a new SetIdentity agent IPC message (0xF7).
The agent modifies the .meta file and atomically re-stamps the meta-tag,
maintaining integrity. Also fix error swallowing in the sign path where
backend.get() failures were logged without the actual error message, and
update AGENTS.md with stronger CI/CD-only binary guidance.
Closes#240
* fix(agent): make meta-tag re-stamp non-fatal in SetIdentity
On platforms where the meta-integrity store is unavailable (e.g. Linux
without Secret Service), perform_migrate_meta fails. Since the identity
metadata was already saved successfully, log the re-stamp failure as a
warning instead of propagating it as an error.
* fix(e2e): start agent before sshenc identity in tests
sshenc identity now routes through the agent IPC, so the agent must
be running. Two e2e tests called sshenc identity without starting the
agent first: gitenc_config_signs_commit_and_verifies and
identity_persists_through_metadata.
Copy file name to clipboardExpand all lines: AGENTS.md
+39-17Lines changed: 39 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,18 +19,34 @@ Use your judgement on Windows/Linux: prefer the installed binary when one
19
19
exists for parity reasons, but locally-built binaries are not a footgun on
20
20
those platforms the way they are on macOS.
21
21
22
-
## CRITICAL: Never Run Unsigned Binaries (macOS)
22
+
## CRITICAL: Always Use CI/CD-Built Binaries (macOS)
23
23
24
-
**DO NOT** run binaries from development builds (`cargo build`, `cargo run`, `~/.cargo/bin/*`) **on macOS** in production contexts or when they could access the Secure Enclave. (See the Platform Scope section above for Windows/Linux scoping.)
24
+
**NEVER build, codesign, or install custom macOS binaries.** Always use the CI/CD release
25
+
pipeline (`git tag vX.Y.Z` → GitHub Actions → Homebrew). This is non-negotiable.
25
26
26
-
### Why This Matters
27
+
The CI/CD pipeline performs steps that **cannot be replicated locally**:
27
28
28
-
sshenc accesses hardware-backed cryptographic storage (macOS Secure Enclave, Windows TPM, Linux software keys). Running unsigned development builds as agents can:
29
+
1.**Apple notarization** — AMFI (Apple Mobile File Integrity) only grants `keychain-access-groups`
30
+
entitlements to notarized app bundles. Without notarization, Secure Enclave key creation with
31
+
`.userPresence` access control fails with `-25308 (errSecInteractionNotAllowed)`.
32
+
2.**Provisioning profile embedding** — required for the app bundle's entitlements to be honored.
33
+
3.**Proper app bundle signing** — the entire `.app` bundle must be signed as a unit; signing
34
+
individual binaries and placing them in an existing bundle breaks the seal.
29
35
30
-
1.**Poison the keychain** — unsigned agents create keychain entries that conflict with production agents
31
-
2.**Trigger unexpected auth prompts** — users see Touch ID/password prompts from the wrong binary
4.**Leave stale processes** — development agents don't clean up properly when killed
36
+
**DO NOT** run binaries from development builds (`cargo build`, `cargo run`, `~/.cargo/bin/*`)
37
+
**on macOS** in production contexts or when they could access the Secure Enclave.
38
+
(See the Platform Scope section above for Windows/Linux scoping.)
39
+
40
+
### What Goes Wrong With Custom Builds
41
+
42
+
sshenc accesses hardware-backed cryptographic storage (macOS Secure Enclave, Windows TPM, Linux software keys). Running non-CI/CD builds as agents can:
43
+
44
+
1.**Fail silently on key generation** — AMFI rejects the entitlements, SE key creation with `.userPresence` returns `-25308`
45
+
2.**Poison the keychain** — unsigned agents create keychain entries that conflict with production agents
46
+
3.**Invalidate HMAC integrity** — unsigned binaries writing to `~/.sshenc/keys/*.meta` files corrupt the HMAC sidecar, breaking key operations for the production binary
47
+
4.**Trigger unexpected auth prompts** — users see Touch ID/password prompts from the wrong binary
0 commit comments