Skip to content

feat: detect GitLab tokens and Azure client secrets#37

Open
jesse-quinn wants to merge 1 commit into
datumbrain:mainfrom
jesse-quinn:feat/gitlab-azure-token-rules
Open

feat: detect GitLab tokens and Azure client secrets#37
jesse-quinn wants to merge 1 commit into
datumbrain:mainfrom
jesse-quinn:feat/gitlab-azure-token-rules

Conversation

@jesse-quinn

@jesse-quinn jesse-quinn commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two new built-in detection rules and closes a test/docs gap on GitHub fine-grained PATs:

  • gitlab-token β€” GitLab personal access, deploy, runner, pipeline trigger, feed, and service account tokens (glpat-/gldt-/glrt-/glptt-/glft-/glsoat- prefixes), including the newer routable token format with dot-separated segments.
  • azure-client-secret β€” Microsoft Entra ID (Azure AD) application client secrets, keyed on the distinctive <3 chars><digit>Q~ shape with a 31–34 char tail. Uses lookarounds instead of \b because the secret charset includes ~, ., and -.
  • GitHub fine-grained PATs (github_pat_) were already matched by the existing github-token rule but had no test coverage or README mention β€” both added.

Details

  • Both new rules are severity: critical, category: secret, token-replace redaction, matching the conventions of neighboring rules.
  • Patterns are linear (no nested quantifiers) per the ReDoS guidance in CONTRIBUTING.md.
  • Example strings are deliberately low-entropy so GitHub secret scanning / push protection doesn't flag them as live credentials (a realistic-looking GitLab sample was blocked by push protection on the first push attempt).
  • dist/ rebuilt and committed per the CONTRIBUTING.md requirement.

Testing

  • npm test β€” 178 tests pass, including new positive/negative cases for all three token families.
  • End-to-end via the hook:
    echo "... glpat-... AZURE_CLIENT_SECRET=..." | node scripts/prompt-guard.js
    β†’ decision: block β€” GitLab Token (gitlab-token), Azure Client Secret (azure-client-secret)
    

Adds two built-in detection rules:

- gitlab-token: GitLab personal access, deploy, runner, pipeline
  trigger, feed, and service account tokens (glpat-/gldt-/glrt-/
  glptt-/glft-/glsoat- prefixes), including the newer routable
  token format with dot-separated segments.
- azure-client-secret: Microsoft Entra ID (Azure AD) application
  client secrets, keyed on the distinctive "<3 chars><digit>Q~"
  shape with a 31-34 char tail, using lookarounds since the
  charset includes non-word characters.

GitHub fine-grained PATs (github_pat_) were already covered by the
existing github-token rule; this adds test coverage for them and
documents them in the README.
@jesse-quinn
jesse-quinn force-pushed the feat/gitlab-azure-token-rules branch from 273715d to 3af8bed Compare July 20, 2026 23:48
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