| 0ee5c3fb Andy McCall ↶ |
1 |
# Push protection's rules (hub spec §15.4, oxygenhub#268), compiled into |
| 2 |
# the hub. Each rule: |
| 3 |
# |
| 4 |
# id stable name, part of every fingerprint: never reuse one |
| 5 |
# description what a refusal calls it |
| 6 |
# regex Rust `regex` syntax, matched on bytes; the capture group |
| 7 |
# named `secret`, when there is one, is the secret, else the |
| 8 |
# whole match |
| 9 |
# keywords optional prefilter: the regex runs on a text only when one |
| 10 |
# of these occurs in it (case-insensitive) |
| 11 |
# requires optional: a regex the same file or inserted text must also |
| 12 |
# match somewhere, for secrets that are only one when paired |
| 13 |
# |
| 14 |
# Rules are tried in order and a match overlapping an earlier rule's is |
| 15 |
# dropped, so the specific rules come before the general ones. Bump |
| 16 |
# `version` whenever a rule is added, changed or removed. |
| 17 |
|
| 18 |
version = 1 |
| 19 |
|
| 20 |
[[rule]] |
| 21 |
id = "gcp-service-account" |
| 22 |
description = "Google Cloud service account key" |
| 23 |
keywords = ["service_account"] |
| 24 |
regex = '''"private_key"\s*:\s*"(?P<secret>-----BEGIN[^"]{40,})"''' |
| 25 |
requires = '''"type"\s*:\s*"service_account"''' |
| 26 |
|
| 27 |
[[rule]] |
| 28 |
id = "aws-access-key-id" |
| 29 |
description = "AWS access key ID" |
| 30 |
keywords = ["akia", "asia", "abia", "acca"] |
| 31 |
regex = '''\b(?P<secret>(?:AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\b''' |
| 32 |
|
| 33 |
[[rule]] |
| 34 |
id = "aws-secret-access-key" |
| 35 |
description = "AWS secret access key" |
| 36 |
keywords = ["aws", "secret"] |
| 37 |
regex = '''(?im)(?:aws|secret)[a-z0-9_ .\-]{0,30}['"]?\s*[:=]\s*['"]?(?P<secret>[A-Za-z0-9/+]{40})(?:[^A-Za-z0-9/+=]|$)''' |
| 38 |
requires = '''\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16}\b''' |
| 39 |
|
| 40 |
[[rule]] |
| 41 |
id = "azure-storage-connection-string" |
| 42 |
description = "Azure storage account connection string" |
| 43 |
keywords = ["accountkey="] |
| 44 |
regex = '''(?i)DefaultEndpointsProtocol=https?;AccountName=[A-Za-z0-9]+;AccountKey=(?P<secret>[A-Za-z0-9+/]{40,}={0,2})''' |
| 45 |
|
| 46 |
[[rule]] |
| 47 |
id = "github-token" |
| 48 |
description = "GitHub token" |
| 49 |
keywords = ["ghp_", "gho_", "ghu_", "ghs_", "ghr_"] |
| 50 |
regex = '''\b(?P<secret>gh[pousr]_[A-Za-z0-9]{36,255})\b''' |
| 51 |
|
| 52 |
[[rule]] |
| 53 |
id = "github-fine-grained-token" |
| 54 |
description = "GitHub fine-grained personal access token" |
| 55 |
keywords = ["github_pat_"] |
| 56 |
regex = '''\b(?P<secret>github_pat_[A-Za-z0-9]{22}_[A-Za-z0-9]{59})\b''' |
| 57 |
|
| 58 |
[[rule]] |
| 59 |
id = "gitlab-token" |
| 60 |
description = "GitLab personal access token" |
| 61 |
keywords = ["glpat-"] |
| 62 |
regex = '''\b(?P<secret>glpat-[A-Za-z0-9_\-.]{20,})''' |
| 63 |
|
| 64 |
[[rule]] |
| 65 |
id = "oxygenhub-token" |
| 66 |
description = "OxygenHub personal access token" |
| 67 |
keywords = ["oxyhub_"] |
| 68 |
regex = '''\b(?P<secret>oxyhub_[0-9a-f]{64})\b''' |
| 69 |
|
| 70 |
[[rule]] |
| 71 |
id = "oxygenhub-agent-grant" |
| 72 |
description = "OxygenHub agent grant token" |
| 73 |
keywords = ["oxyagent_"] |
| 74 |
regex = '''\b(?P<secret>oxyagent_[0-9a-f]{64})\b''' |
| 75 |
|
| 76 |
[[rule]] |
| 77 |
id = "oxygenflow-job-token" |
| 78 |
description = "OxygenFlow job token" |
| 79 |
keywords = ["flowjob_"] |
| 80 |
regex = '''\b(?P<secret>flowjob_[0-9a-f]{64})\b''' |
| 81 |
|
| 82 |
[[rule]] |
| 83 |
id = "oxygenflow-runner-credential" |
| 84 |
description = "OxygenFlow runner credential" |
| 85 |
keywords = ["flowrunner_"] |
| 86 |
regex = '''\b(?P<secret>flowrunner_[0-9a-f]{64})\b''' |
| 87 |
|
| 88 |
[[rule]] |
| 89 |
id = "oxygenflow-registration-token" |
| 90 |
description = "OxygenFlow runner registration token" |
| 91 |
keywords = ["flowreg_"] |
| 92 |
regex = '''\b(?P<secret>flowreg_[0-9a-f]{48})\b''' |
| 93 |
|
| 94 |
[[rule]] |
| 95 |
id = "slack-token" |
| 96 |
description = "Slack token" |
| 97 |
keywords = ["xoxb-", "xoxa-", "xoxp-", "xoxr-", "xoxs-"] |
| 98 |
regex = '''\b(?P<secret>xox[baprs]-[A-Za-z0-9-]{10,})''' |
| 99 |
|
| 100 |
[[rule]] |
| 101 |
id = "stripe-live-key" |
| 102 |
description = "Stripe live secret key" |
| 103 |
keywords = ["sk_live_", "rk_live_"] |
| 104 |
regex = '''\b(?P<secret>[rs]k_live_[A-Za-z0-9]{24,})\b''' |
| 105 |
|
| 106 |
[[rule]] |
| 107 |
id = "openssh-private-key" |
| 108 |
description = "OpenSSH private key" |
| 109 |
keywords = ["openssh private key"] |
| 110 |
regex = '''(?P<secret>-----BEGIN[ ]OPENSSH[ ]PRIVATE[ ]KEY-----[\s\S]{40,}?-----END[ ]OPENSSH[ ]PRIVATE[ ]KEY-----)''' |
| 111 |
|
| 112 |
[[rule]] |
| 113 |
id = "private-key" |
| 114 |
description = "PEM private key" |
| 115 |
keywords = ["private key"] |
| 116 |
regex = '''(?P<secret>-----BEGIN[ ](?:[A-Z0-9]+[ ])*PRIVATE[ ]KEY-----[\s\S]{40,}?-----END[ ](?:[A-Z0-9]+[ ])*PRIVATE[ ]KEY-----)''' |