Repository navigation
hooks: catch OpenAI project, service-account and admin keys - #21
Merged
Merged
Conversation
Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
StayLameBro
approved these changes
Oct 6, 2026
StayLameBro
left a comment
Owner
There was a problem hiding this comment.
Thanks for catching this! The old pattern let many project keys, and every service-account and admin key, through the hooks, so this closes a real gap. Keeping legacy sk- keys alphanumeric-only so text like sk-learn-… doesn't trip it is a nice touch, and building the test keys at runtime keeps the test file clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
check-sensitive.pylists OpenAI among the secrets it catches, but its OpenAI pattern only matches older key formats:That wants 32 plain alphanumerics right after the prefix. Project keys (
sk-proj-…) put-and_in their body, so a key is missed whenever one of those shows up in its first 32 characters, which is common. Service-account (sk-svcacct-…) and admin (sk-admin-…) keys never match.So a commit that adds one of these keys is accepted by the pre-commit / pre-push hooks.
Change:
proj,svcacct,admin) accept[A-Za-z0-9_-]in the body.sk-keys keep the alphanumeric-only rule, so kebab-case text likesk-learn-…still does not match.Tests: three
expect_blockcases intests/security/check-sensitive-test.sh(project, service-account, admin), assembled at runtime like the existing Anthropic one so this file stays clean. All three fail onmain(the key is committed) and pass with this change.