Skip to content

Add ENCRYPTED PRIVATE KEY and OpenVPN patterns to PrivateKeyDetector#957

Open
Vignesh-Kathirkamar wants to merge 4 commits into
Yelp:masterfrom
Vignesh-Kathirkamar:master
Open

Add ENCRYPTED PRIVATE KEY and OpenVPN patterns to PrivateKeyDetector#957
Vignesh-Kathirkamar wants to merge 4 commits into
Yelp:masterfrom
Vignesh-Kathirkamar:master

Conversation

@Vignesh-Kathirkamar

Copy link
Copy Markdown
  • Please check if the PR fulfills these requirements
  • Tests for the changes have been added
  • Docs have been added / updated
  • All CI checks are green
  • What kind of change does this PR introduce?

This adds two missing private key patterns to PrivateKeyDetector

  • What is the current behavior?

PrivateKeyDetector does not flag BEGIN ENCRYPTED PRIVATE KEY (PKCS#8 encrypted format) or BEGIN OpenVPN Static key V1 files. These are detected by pre-commit/pre-commit-hooks' detect-private-key but not by detect-secrets. (Related: #70)

  • What is the new behavior (if this is a feature change)?

Both patterns are now included in the PrivateKeyDetector denylist and will be flagged as secrets.

  • Does this PR introduce a breaking change?

No. Existing behavior is preserved; this only adds detection for two additional patterns.

  • Other information:

These patterns were identified by comparing detect-secrets' denylist against pre-commit-hooks' detect-private-key (which this plugin was originally derived from, per the source file header). As per #70's discussion, it was agreed that encrypted keys should still be flagged since passphrase strength cannot be assumed.

Vignesh-Kathirkamar and others added 4 commits May 12, 2026 13:59
Add two missing private key patterns to achieve parity with
pre-commit/pre-commit-hooks detect-private-key hook:

- BEGIN ENCRYPTED PRIVATE KEY (PKCS#8 encrypted format)
- BEGIN OpenVPN Static key V1

Per discussion in Yelp#70, encrypted private keys should still be flagged
since passphrase strength cannot be verified by static analysis.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add ENCRYPTED PRIVATE KEY and OpenVPN patterns to PrivateKeyDetector
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