forked from phoenix/litellm-mirror
add stricter secret detection
This commit is contained in:
parent
552bac586f
commit
84ee37086c
96 changed files with 2337 additions and 0 deletions
26
enterprise/enterprise_hooks/secrets_plugins/github_token.py
Normal file
26
enterprise/enterprise_hooks/secrets_plugins/github_token.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""
|
||||
This plugin searches for GitHub tokens
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from detect_secrets.plugins.base import RegexBasedDetector
|
||||
|
||||
|
||||
class GitHubTokenCustomDetector(RegexBasedDetector):
|
||||
"""Scans for GitHub tokens."""
|
||||
|
||||
@property
|
||||
def secret_type(self) -> str:
|
||||
return "GitHub Token"
|
||||
|
||||
@property
|
||||
def denylist(self) -> list[re.Pattern]:
|
||||
return [
|
||||
# GitHub App/Personal Access/OAuth Access/Refresh Token
|
||||
# ref. https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/
|
||||
re.compile(r"(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36}"),
|
||||
# GitHub Fine-Grained Personal Access Token
|
||||
re.compile(r"github_pat_[0-9a-zA-Z_]{82}"),
|
||||
re.compile(r"gho_[0-9a-zA-Z]{36}"),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue