Skip to content

refactor(privacy): extract the secret detector into the uteke-privacy crate - #1737

Merged
ajianaz merged 1 commit into
developfrom
feat/1732-uteke-privacy
Nov 12, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/1732-uteke-privacy

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • New workspace crate crates/uteke-privacy (regex only, no IO, no uteke-core dependency) holding the pure secret detector: AWS, GitHub, npm, Slack, Google keys, bearer, JWT, URL passwords, NAME=value with entropy checks, the allowlist, idempotent redaction and the masked shapes.
  • Public API: redact(&str, &Policy) -> Redacted { text, counts }, Policy (allowlist, from_patterns), PolicyError, RedactionCount, compile_allowlist, redact_with_allowlist. An optional serde feature (off by default) derives Serialize/Deserialize for RedactionCount; uteke-core turns it on.
  • uteke-core depends on it and re-exports it from uteke_core::privacy (redact(&str, &[Regex]), Redaction alias, RedactionCount, compile_allowlist, PrivacyConfig, PrivacyMode, load_config, ...). The config, modes, Prepared and flag helpers stay in core. No source change in cli, server or mcp.
  • Detector tests moved with the code; core keeps its config/mode/flag tests and the engine integration tests. The shared docs/privacy-filter-cases.json test now runs in the new crate. Added a Policy test and a README doctest.
  • Release plumbing: release.yml publishes uteke-privacy first and waits for it before uteke-core, mcp, cli and server; the crates.io verify loop includes it. AGENTS.md (crate list, version rule, release steps, mutation gate diff now covers crates/uteke-privacy), AGENT.md, CONTRIBUTING.md, docs/architecture.md, docs/mutation-testing.md, .cargo/mutants.toml and CHANGELOG updated. CI jobs and dependabot already use workspace-wide scope.

Why

tole needs the same unknown-secret detection on its egress paths, and a published crate cannot depend on unpublished or heavy code; uteke-core pulls SQLite, reqwest and tokio. One ruleset for both projects (owner decision in #1732). No new rules and no behaviour change.

Conservative choices: the old redact(&str, &[Regex]) signature is kept in core for compatibility, and RedactionCount serde is behind an optional feature so the default dependency set stays regex only. The cases test reads docs/privacy-filter-cases.json from the repo, so it only runs in a checkout, not from the published tarball.

Refs #1732. Remaining: the crates.io publish is the owner's action (the release workflow will publish it on the next tag).

Testing

  • cargo fmt --all -- --check clean
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo test --workspace: 1738 passed, 0 failed (uteke-privacy: 17 unit + 2 doctests; uteke-core privacy tests: 26)
  • cargo package -p uteke-privacy --list and cargo publish --dry-run -p uteke-privacy --allow-dirty succeed (dry run only)

… crate

Move the pure detector (rules, entropy checks, allowlist, idempotent
redaction) from uteke-core into crates/uteke-privacy (regex only, no IO).
uteke-core depends on it and re-exports it from uteke_core::privacy, so
callers and behaviour are unchanged. Release workflow publishes
uteke-privacy first. Refs #1732
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

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