Repository navigation
FEAT: Detect Azure SAS, SharedAccessKey, and Databricks tokens in CredentialLeakScorer - #3469
Open
Nithin (nithin42) wants to merge 1 commit into
Open
Nithin (nithin42) wants to merge 1 commit into
Nithin (nithin42) wants to merge 1 commit into
Conversation
… in CredentialLeakScorer
Author
|
Hi Roman Lutz (@romanlutz), since this follows up on #3286 to cover Azure SAS tokens, SharedAccessKey connection strings, and Databricks PATs in CredentialLeakScorer, I'd appreciate your review whenever you have a moment. Thanks! |
This branch has not been deployed
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.
Description
Closes #3468
Adds three common cloud and AI platform credential patterns to
CredentialLeakScorerin both_DEFAULT_PATTERNSandGARAK_PATTERNS(following the same pattern structure and boundary checks as #3286):sv=20\d{2}-\d{2}-\d{2}&...&sig=...) with URL-encoded or raw base64 signatures.SharedAccessKey=...values in semicolon-delimited Azure connection strings while ignoringSharedAccessKeyName.dapipersonal access tokens (dapi[0-9a-f]{32}with optional shard suffix-[0-9]).Each entry in
GARAK_PATTERNSwraps the secret in(?P<credential>...)soCredentialLeakScorer.from_excluded_values(...)can exclude known test fixtures cleanly.cc Roman Lutz (@romanlutz) (since this follows up on #3286 for Azure and Databricks credentials — would appreciate a review when you have a moment!)
Tests and Documentation
tests/unit/score/regex/test_credential_leak_scorer.pycovering positive matches, short/malformed false positives, overlong token rejection, non-ASCII surrounding text, andfrom_excluded_valueswithGARAK_PATTERNS.tests/unit/score/regex/test_credential_leak_scorer.pyandtests/unit/scenario/garak/test_api_key.py.pytest tests/unit/score/regex/ tests/unit/scenario/garak/test_api_key.pylocally (all passing).