影响: 直连 ssh 现在能用 xop run --askpass=NAME -- ssh user@host, 密码经 mkdtemp 0700 临时目录的 0600 data + 0700 getpass.sh 注入, 既不进 argv 也不进 env, ps 干净。68 unit + 24 integration 全绿 (含 macOS /var/folders/.../T temp dir 兼容)。 改动: - 新增 src/askpass.rs: mkdtemp(0700) + 0600 data + 0700 getpass.sh (cat "$XOP_ASKPASS_DATA"); AskpassHandle::Drop 跑 srm -m (fallback rm -rf); env_vars() 输出 SSH_ASKPASS + SSH_ASKPASS_REQUIRE=force + DISPLAY=:0 + XOP_ASKPASS_DATA - 新增 --askpass=NAME flag (Args + Run subcommand) - SecretRef::askpass: bool 标志 + askpass() ctor; ResolvedValue 镜像 - run_exec Phase 3.5: askpass refs 从 envp_resolved 切出来单独 setup, 放在 audit spawn_event 之前 (setup 失败不留孤儿事件); stdout guard 看完整 resolved 集做兜底 - injector::plan() 移除 SSH_* 自动检测; InjectStrategy::Askpass/Fd 变体删掉; askpass 改显式 opt-in (--askpass=NAME) - Error::Io(String, String) 退出码 73, askpass setup/chmod/write 失败 - tests/integration.rs run_askpass_sets_ssh_env_vars: SSH_ASKPASS 路径改 substring 匹配 (SSH_ASKPASS= + /xop-askpass- + /getpass.sh), 兼容 Linux /tmp 与 macOS /var/folders/.../T (per-user, world-unreadable) - AGENTS.md: v0.4 状态加 e2e 实测标注, 踩坑 #22 (vault key 名 ≠ 字面值) - HANDOFF.md: 测试数 62→68 / 15→24, status line 加 e2e 实测标注, smoke 命令加 askpass 用法 设计: 沿用 v0.3 argv_placeholder 模式 (SecretRef 标志位 + run_exec 单 vault open); ssh 本身不读 env, 强制 SSH_ASKPASS_REQUIRE=force 让 ssh 必走 askpass 脚本; 不沿用 sshpass -e 的 env hack (那个不解决 ps 泄漏)。temp_dir 走 std::env::temp_dir() 不写死 /tmp, 因为 macOS /var/folders/.../T 是 per-user + world-unreadable, 比 /tmp 更合适。 Co-Authored-By: Claude Code <[email protected]>
103 lines
2.7 KiB
TOML
103 lines
2.7 KiB
TOML
[package]
|
|
name = "xop"
|
|
version = "0.4.0"
|
|
edition = "2021"
|
|
description = "Local encrypted secret vault with Touch ID/PAM auth and optional child-process injection"
|
|
license = "MIT"
|
|
repository = "https://github.com/your-org/xop"
|
|
keywords = ["secrets", "vault", "cli", "credential-injection", "touch-id", "pam"]
|
|
categories = ["command-line-utilities", "authentication", "cryptography"]
|
|
|
|
[lib]
|
|
name = "xop"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "xop"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
# CLI
|
|
clap = { version = "4", features = ["derive", "env"] }
|
|
|
|
# Async runtime
|
|
tokio = { version = "1", features = ["full"] }
|
|
|
|
# Error handling
|
|
anyhow = "1"
|
|
thiserror = "2"
|
|
|
|
# Serialization (audit log / config)
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
|
|
# Secret type hygiene
|
|
secrecy = "0.10"
|
|
|
|
# Process / POSIX
|
|
nix = { version = "0.29", features = ["process", "signal", "fs", "net", "resource"] }
|
|
|
|
# Random number generation (vault salt/nonce)
|
|
rand = "0.8"
|
|
|
|
# Regex (argv parsing, stdout masking)
|
|
regex = "1"
|
|
|
|
# Time (audit log timestamps)
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
|
|
# Logging
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
|
|
# Async trait support (required for `async fn` in traits used as dyn)
|
|
async-trait = "0.1"
|
|
|
|
# Backend discovery (used by exec mode for resolving PATH)
|
|
which = "6"
|
|
|
|
# Templating
|
|
once_cell = "1"
|
|
|
|
# ── v0.2: local vault + auth ─────────────────────────────────────────────────
|
|
# Crypto for vault
|
|
aes-gcm = "0.10"
|
|
argon2 = "0.5"
|
|
zeroize = { version = "1", features = ["zeroize_derive"] }
|
|
# Vault plaintext format
|
|
toml = "0.8"
|
|
# Hidden passphrase prompt
|
|
rpassword = "7"
|
|
# Filesystem locking for atomic vault writes
|
|
fs2 = "0.4"
|
|
|
|
# Linux: PAM auth (currently uses pkexec subprocess; pam crate optional for future)
|
|
# [target.'cfg(target_os = "linux")'.dependencies]
|
|
# pam = "0.8"
|
|
|
|
# macOS: Touch ID via LAContext
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
cocoa = "0.26"
|
|
objc = "0.2"
|
|
|
|
[dev-dependencies]
|
|
assert_cmd = "2"
|
|
predicates = "3"
|
|
tempfile = "3"
|
|
serial_test = "3"
|
|
|
|
# Test-only feature: when enabled, `xop` will read `XOP_VAULT_PASSWORD` from
|
|
# the environment as a substitute for the interactive /dev/tty passphrase prompt.
|
|
# Used solely by `cargo test --features test-bypass` so integration tests
|
|
# can drive the binary non-interactively. NEVER enabled in release builds —
|
|
# shipping it would let any process with the env var bypass the entire
|
|
# passphrase layer and defeat the point of the encrypted vault.
|
|
[features]
|
|
default = []
|
|
test-bypass = []
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = "thin"
|
|
codegen-units = 1
|
|
strip = true |