Skip to content

fix: trust CA in login keychain instead of system keychain#11

Merged
willisrocks merged 8 commits intomainfrom
fix-ca-trust-login-keychain
Mar 10, 2026
Merged

fix: trust CA in login keychain instead of system keychain#11
willisrocks merged 8 commits intomainfrom
fix-ca-trust-login-keychain

Conversation

@willisrocks
Copy link
Copy Markdown
Contributor

Summary

  • Changed macOS CA trust from system keychain (/Library/Keychains/System.keychain with -d flag, requiring sudo) to login keychain (~/Library/Keychains/login.keychain-db, no sudo)
  • Added login_keychain_path() helper using dirs::home_dir() for dynamic path resolution
  • Updated all 5 user-facing messages in init.rs to reference login keychain and remove sudo references
  • Updated docs/spec.md and skills/setup/SKILL.md to reflect the change
  • Added unit test for keychain path helper and #[ignore] functional roundtrip test

Test Plan

  • cargo clippy -- -D warnings: zero warnings
  • cargo test: 15 passed, 9 ignored
  • Functional keychain roundtrip test (manual, triggers macOS password dialog)

Residual Issues

  • Progress messages ("trusting CA in login keychain...") are not platform-gated (matches pre-existing pattern)
  • Function still named trust_ca_in_system (doc comment updated, rename deferred as low-priority)

🤖 Generated with Claude Code

willisrocks and others added 8 commits March 10, 2026 08:01
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ps, naming rationale

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorder Task 1 to test-first (write failing test, verify compile error,
then implement). Add doc comment update for trust_ca_in_system to
accurately describe per-platform behavior after the fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add documentation about the macOS Keychain Access password dialog that
users will see (matches mkcert behavior). Replace fragile starts_with
"/Users/" test assertion with is_absolute() check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The system keychain requires sudo, which always fails since devproxy
runs as the current user via socket activation. Switch to the login
keychain (no sudo, just a one-time Keychain Access dialog) and update
all user-facing messages in init to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix test cleanup to use `remove-trusted-cert` without `-d` flag,
  matching the user trust store where the cert was added (not admin store)
- Revert unrelated formatting changes in init.rs to keep diff surgical

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update docs/spec.md and skills/setup/SKILL.md to reference login
  keychain instead of system keychain (finding #1)
- Use distinct CN "devproxy Test CA" in roundtrip test to avoid
  colliding with real devproxy CAs in the login keychain (finding #3)
- Update e2e test to accept trust success (no longer requires sudo
  fallback output since login keychain trust succeeds without sudo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@willisrocks willisrocks merged commit a3471c3 into main Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant