Skip to content

FEAT: Detect Azure SAS, SharedAccessKey, and Databricks tokens in CredentialLeakScorer - #3469

Open
Nithin (nithin42) wants to merge 1 commit into
microsoft:mainfrom
nithin42:feat/azure-credentials-leak-scorer
Open

Nithin (nithin42) wants to merge 1 commit into
microsoft:mainfrom
nithin42:feat/azure-credentials-leak-scorer

Conversation

@nithin42

@nithin42 Nithin (nithin42) commented Oct 22, 2026 •

Copy link
Copy Markdown

Description

Closes #3468

Adds three common cloud and AI platform credential patterns to CredentialLeakScorer in both _DEFAULT_PATTERNS and GARAK_PATTERNS (following the same pattern structure and boundary checks as #3286):

  • Azure SAS Token: detects SAS query strings (sv=20\d{2}-\d{2}-\d{2}&...&sig=...) with URL-encoded or raw base64 signatures.
  • Azure Service Bus / Event Hub Key: detects SharedAccessKey=... values in semicolon-delimited Azure connection strings while ignoring SharedAccessKeyName.
  • Databricks API Token: detects dapi personal access tokens (dapi[0-9a-f]{32} with optional shard suffix -[0-9]).

Each entry in GARAK_PATTERNS wraps the secret in (?P<credential>...) so CredentialLeakScorer.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

  • Added unit tests in tests/unit/score/regex/test_credential_leak_scorer.py covering positive matches, short/malformed false positives, overlong token rejection, non-ASCII surrounding text, and from_excluded_values with GARAK_PATTERNS.
  • Updated pattern count checks in tests/unit/score/regex/test_credential_leak_scorer.py and tests/unit/scenario/garak/test_api_key.py.
  • Ran pytest tests/unit/score/regex/ tests/unit/scenario/garak/test_api_key.py locally (all passing).

@nithin42

Copy link
Copy Markdown
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

No deployments
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.

Detect Azure SAS tokens, SharedAccessKey connection strings, and Databricks PATs in CredentialLeakScorer

1 participant