Skip to content

feat: global GPG keyring with interactive picker#21

Merged
lucatescari merged 19 commits into
devfrom
feat/global-gpg-keyring
Apr 15, 2026
Merged

feat: global GPG keyring with interactive picker#21
lucatescari merged 19 commits into
devfrom
feat/global-gpg-keyring

Conversation

@lucatescari

Copy link
Copy Markdown
Owner

Summary

  • Add gitveil config set-keyring/unset-keyring/show commands for managing a global GPG keyring directory
  • gitveil add-gpg-user (no args, no --from) now falls back to scanning the configured keyring directory with an interactive picker
  • Skip symlinks in GPG key directory scan (security fix, per CLAUDE.md policy)
  • XDG-compliant config file at ~/.config/gitveil/config with 0o600/0o700 permissions

Security

  • Config file: 0o600, config dir: 0o700
  • Paths canonicalized on save and re-canonicalized on load (defense-in-depth)
  • Symlinks skipped in directory scans
  • No auto-import of GPG keys — always requires interactive user selection
  • No new attack vectors — keyring dir is read-only, all existing validation unchanged

Test plan

  • 77 tests pass (31 unit + 40 integration + 6 cross-compat) — up from 54
  • 23 new tests cover: config commands (12), keyring fallback (5), scan security (3), config unit (3)
  • Unix permission tests gated with #[cfg(unix)]
  • CI: Linux, macOS, Windows matrix (no new dependencies)
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt --check clean

🤖 Generated with claude-flow

@lucatescari lucatescari force-pushed the feat/global-gpg-keyring branch from dcca3cd to 0651efc Compare April 15, 2026 09:20
- Unit tests: add Mutex to serialize env var mutations (fixes macOS CI race)
- GPG test: set GNUPGHOME to empty temp dir so GPG fails fast on all
  platforms instead of hanging (restores test on Windows)
- New tests/gpg_integration.rs: real GPG operations with temp keyrings
  - add-gpg-user: by email, fingerprint, --trusted, --no-commit, -k, --from
  - rm-gpg-user: remove, --no-commit, user not found error
  - ls-gpg-users: list, no users, named key
  - GPG unlock roundtrip: add user -> lock -> unlock via GPG
  - Multi-user: add 2, remove 1, verify count
- All tests auto-skip if GPG unavailable (skip_without_gpg! macro)
- CI: install GPG on Linux/macOS, run gpg_integration test step
- CLAUDE.md: add mandatory testing policy for all commands/features
- Total: 91 tests (31 unit + 40 integration + 14 GPG + 6 cross-compat)
gpg_available() now tests that GPG can operate with a custom GNUPGHOME,
not just that the binary exists. On Windows CI, Git's bundled GPG
reports a version but fails with MSYS2 path translation errors.
Gpg4win handles native Windows paths correctly, unlike the GPG
bundled with Git for Windows (which fails with MSYS2 path issues).
This enables GPG integration tests to run on all 3 platforms.
@lucatescari lucatescari merged commit da332fe into dev Apr 15, 2026
3 checks passed
@lucatescari lucatescari deleted the feat/global-gpg-keyring branch April 15, 2026 12:21
lucatescari added a commit that referenced this pull request Apr 15, 2026
feat: global GPG keyring with interactive picker
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