Skip to content

fix(privacy): bound the private-key scan, redact non-ASCII passwords, detect sk-ant keys - #1775

Merged
ajianaz merged 2 commits into
developfrom
fix/privacy-detector-hardening
Nov 14, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/privacy-detector-hardening

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

What

Three fixes in the uteke-privacy secret detector, plus a ### Security line in the [0.24.0] CHANGELOG:

Why

Found in the v0.24.0 release review. All three predate v0.23.0 (the detector was moved unchanged from uteke-core in #1737), so they are not regressions of this release, but the release should not ship them: the first lets one large write request stall the server, the other two let real secrets through redact and strict mode.

Testing

  • New tests: work in proportion to the text (60k markers finish, the rest is masked), 400 real keys in one document stay under the cap and are all masked, non-ASCII passwords are redacted, a non-ASCII sentence after a password name is still prose, an sk-ant- key with only short parts is detected, and a hyphenated sk-ant-colony-... name is not.
  • On the unfixed code (develop) the work-bound, non-ASCII password and sk-ant- tests fail; on this branch all 23 unit tests and 2 doc tests of uteke-privacy pass, and the 38 uteke-core tests that exercise redaction pass.
  • cargo clippy -p uteke-privacy --all-targets -- -D warnings and cargo fmt --check are clean.
  • CI on the PR at its current head: all 15 checks green (Test, Clippy, Build, Check, vecq backend, API Docs Fresh, Cargo Audit, Trivy) and Cora "No issues found". An earlier Cora/CodeCora block on a test fixture (a literal BEGIN marker) was fixed by assembling the marker at run time.

Closes #1772, closes #1773, closes #1774

… detect sk-ant keys (#1772, #1773, #1774)

The private-key scan reads a total proportional to the text and masks the rest past that cap. A single-token value assigned to a password name is judged on its content even when it holds a non-ASCII character. sk-ant-<kind><nn>- keys have their own rule, since the generic sk- rule needs one 20+ character part.

Closes #1772, closes #1773, closes #1774
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/uteke-privacy/src/lib.rs Outdated
fn the_private_key_scan_does_work_in_proportion_to_the_text() {
// Markers whose body is never key material: every BEGIN used to read a
// 16 KiB window, so the work grew with the square of the text.
let text = "-----BEGIN PRIVATE KEY-----\nshort\n".repeat(60_000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants