Skip to content

fix(secrets-detection): redact complete PEM private key blocks - #212

Merged
lucarlig merged 1 commit into
mainfrom
user/luca/fix-private-key-block-redaction
Oct 28, 2026
Merged

lucarlig merged 1 commit into
mainfrom
user/luca/fix-private-key-block-redaction

Conversation

@lucarlig

Copy link
Copy Markdown
Collaborator

private_key_block currently replaces only the opening PEM marker, leaving the key body and closing marker in tool output. Generic PKCS#8 and encrypted private keys also evade detection and blocking.

Match the full block through the closing marker of the same key type for RSA, DSA, EC, OpenSSH, encrypted, and generic PKCS#8 keys. If the matching closing marker is missing, redact through the end of the string. Separate complete blocks retain the text between them.

Adds Rust regressions for multiline, single-line, CRLF, repeated, truncated, mismatched-marker, and overlapping-detector cases, plus Python hook coverage for redaction, blocking, and payload isolation. Documents the behavior and bumps the plugin to 0.3.15.

Refs #162 (private-key detection/redaction item).

Validation:

  • make install followed by make ci NEXTEST_PROFILE=ci: 100 Rust tests and 118 Python hook tests passed; formatting, Clippy, wheel build/install, stubs, and benchmark compilation passed.
  • make plugins-validate: catalog validation and 41 repository tests passed.
  • Real-CPEX import and public scanner smoke check passed.
  • pre-commit run: all hooks, including secret scanning, passed. Baseline changes remove the old literal PEM fixture and refresh existing finding locations.
  • Plugin-scoped cargo deny ... check advisories: passed.

The full-workspace security scan fails on existing RUSTSEC-2026-0382 in the rate limiter's rustls-webpki 0.103.15, which is also present on origin/main. Workspace bans, licenses, and sources checks passed.

Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig marked this pull request as ready for review October 28, 2026 09:40

@gandhipratik203 gandhipratik203 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lucarlig
lucarlig merged commit 5770c5e into main Oct 28, 2026
28 of 29 checks passed
@lucarlig
lucarlig deleted the user/luca/fix-private-key-block-redaction branch October 28, 2026 09:56
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.

2 participants