Files
xop/Cargo.toml
T
xop-botandClaude Code 7660b92d70 v0.5: 描述元数据 + list 免引号搜索 + 元数据操作免闸门
影响: key 多了人/AI 可读的用途说明(存加密 vault 内,不落明文文件);
`xop list` 的搜索不用再打引号; `xop list` / `xop desc` 只碰元数据、
永不吐 value,因此不再弹指纹、不再问口令 —— agent 跑 xop 不会被打断。
118 unit + 40 integration 全绿。

改动:
- 新增 `xop desc KEY [TEXT...]`: 描述存 vault 的 `__meta__` TOML 子表;
  文字用空格 join(不用引号), 真打进 vault 的一层引号会被剥掉;
  不写文字 = 清除描述(不用敲空引号 "")
- `xop list [TERM...]`: 搜索默认改成大小写不敏感的子串匹配, 命中 key 名
  或描述, 不用引号、不用通配符; 含 `*` `?` `[` 的词仍切 glob 语义
  (老写法 `xop list 'git_*'` 行为不变); 多词取并集
- 新增 `Vault::open_metadata` / `open_metadata_at`: 只开元数据路径,
  0600 keyring 静默解锁, 无 keyring 才回落手输 passphrase;
  `get`/`set`/`rm`/`run` 仍走 `Vault::open` 全套闸门
- 新增 `auth::Intent` + `auth::needs_gate(intent)`: 把"哪些操作要闸门"
  写成纯函数; `Vault::open` 与 `open_metadata` 共享 `decrypt_with` 核心
- 新增 `src/glob.rs`: 轻量匹配器, `*` 任意长 / `?` 单字符, 零新依赖;
  搜索用的 `has_meta` / `matches_ignore_case` / `contains_ignore_case` /
  `contains_glob_ignore_case`
- 新增 `src/datadir.rs`: 数据目录 `~/.xop/` → `~/.x/xop/`, 迁移是
  **复制不移动**(旧目录留作备份), 新 vault 已存在则跳过
- `keyring::load_at` / `save_at` 改 pub(路径显式化, 单测不碰全局 HOME)
- `audit.rs` 新增 `vault_desc(name)`: 只记 key 名, 描述文字不入日志(I2)
- 集成测试新增 pty 回归 `list_under_a_tty_never_prompts_for_biometrics`:
  `script -q /dev/null` 起真 pty + 30s 超时, 闸门若回来则失败而非挂死
- 版本 0.4.0 → 0.5.2; AGENTS.md / HANDOFF.md / docs/* 同步;
  examples 里 v0.5 搬家前的 `~/.xop/` 残留路径一并修正

设计: "搜索要打引号"的根因是 shell 通配符(`*` 在 zsh 下没匹配文件直接
`no matches found`), 不是 xop —— 所以正解不是"少打引号", 而是让日常
搜索根本不需要通配符: 默认子串匹配, `*`/`?`/`[` 只在用户显式写了时才
切回 glob。免闸门只给元数据操作: 闸门的意义是"释放真值前确认有人在场",
而 list/desc 永不吐 value; 值路径(get/set/rm/run)一行没动。

Co-Authored-By: Claude Code <[email protected]>
2026-10-22 17:03:12 +08:00

103 lines
2.7 KiB
TOML

[package]
name = "xop"
version = "0.5.2"
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