{
  "version": 1,
  "about": "OnClip secret-detection rules. Rules with \"kind\": \"ignore\" mark things that are meant to be shared (public keys, certificates): nothing inside them is flagged. Open (MIT): use, audit, improve. Each rule: a regular expression (ICU syntax), which capture group is the secret (0 = whole match), a confidence (high = known format, medium = heuristic), how much of the start to show in the hint, and optional checks (checksum, minimum entropy, minimum character classes among lower/upper/digit, skipping code identifiers made of words). OnClip masks on any match and warns only on high confidence.",
  "rules": [
    {
      "id": "ssh_public_key",
      "name": "SSH public key",
      "kind": "ignore",
      "confidence": "high",
      "pattern": "\\b(?:ssh-(?:rsa|ed25519|dss)|ecdsa-sha2-nistp(?:256|384|521)|sk-(?:ssh-ed25519|ecdsa-sha2-nistp256)@openssh\\.com)[ \\t]+AAAA[A-Za-z0-9+/]+={0,3}"
    },
    {
      "id": "public_key_or_certificate_pem",
      "name": "Public key or certificate",
      "kind": "ignore",
      "confidence": "high",
      "pattern": "-----BEGIN (?:[A-Z0-9]+ )*(?:PUBLIC KEY|CERTIFICATE|CERTIFICATE REQUEST)(?: BLOCK)?-----[\\s\\S]*?-----END (?:[A-Z0-9]+ )*(?:PUBLIC KEY|CERTIFICATE|CERTIFICATE REQUEST)(?: BLOCK)?-----"
    },
    {
      "id": "private_key_pem",
      "name": "Private key",
      "confidence": "high",
      "pattern": "-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----[\\s\\S]*?-----END (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----",
      "hintPrefix": 0,
      "hintLast": 0
    },
    {
      "id": "aws_access_key_id",
      "name": "AWS access key ID",
      "confidence": "high",
      "pattern": "\\b(?:AKIA|ASIA|AGPA|AIDA|AROA)[A-Z0-9]{16}\\b",
      "hintPrefix": 4
    },
    {
      "id": "aws_secret_access_key",
      "name": "AWS secret access key",
      "confidence": "high",
      "pattern": "(?i)aws[_-]?secret[_-]?access[_-]?key[\"']?\\s*[:=]\\s*[\"']?([A-Za-z0-9/+=]{40})",
      "group": 1,
      "hintPrefix": 0
    },
    {
      "id": "anthropic_api_key",
      "name": "Anthropic API key",
      "confidence": "high",
      "pattern": "\\bsk-ant-[A-Za-z0-9_-]{20,}",
      "hintPrefix": 7
    },
    {
      "id": "openai_api_key",
      "name": "OpenAI API key",
      "confidence": "high",
      "pattern": "\\bsk-(?:proj-|svcacct-|admin-)?[A-Za-z0-9_-]{20,}",
      "hintPrefix": 3
    },
    {
      "id": "github_token",
      "name": "GitHub token",
      "confidence": "high",
      "pattern": "\\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36}\\b",
      "hintPrefix": 4
    },
    {
      "id": "github_fine_grained_token",
      "name": "GitHub token",
      "confidence": "high",
      "pattern": "\\bgithub_pat_[A-Za-z0-9_]{60,}\\b",
      "hintPrefix": 11
    },
    {
      "id": "gitlab_token",
      "name": "GitLab token",
      "confidence": "high",
      "pattern": "\\bglpat-[A-Za-z0-9_-]{20,}",
      "hintPrefix": 6
    },
    {
      "id": "stripe_live_key",
      "name": "Stripe live key",
      "confidence": "high",
      "pattern": "\\b(?:sk|rk)_live_[A-Za-z0-9]{20,}\\b",
      "hintPrefix": 8
    },
    {
      "id": "stripe_test_key",
      "name": "Stripe test key",
      "confidence": "medium",
      "pattern": "\\b(?:sk|rk)_test_[A-Za-z0-9]{20,}\\b",
      "hintPrefix": 8
    },
    {
      "id": "slack_token",
      "name": "Slack token",
      "confidence": "high",
      "pattern": "\\bxox[abposr]-[A-Za-z0-9-]{10,}",
      "hintPrefix": 5
    },
    {
      "id": "slack_webhook",
      "name": "Slack webhook URL",
      "confidence": "high",
      "pattern": "https://hooks\\.slack\\.com/services/[A-Za-z0-9/]{20,}",
      "hintPrefix": 23
    },
    {
      "id": "google_api_key",
      "name": "Google API key",
      "confidence": "high",
      "pattern": "\\bAIza[0-9A-Za-z_-]{35}\\b",
      "hintPrefix": 4
    },
    {
      "id": "npm_token",
      "name": "npm token",
      "confidence": "high",
      "pattern": "\\bnpm_[A-Za-z0-9]{36}\\b",
      "hintPrefix": 4
    },
    {
      "id": "jwt",
      "name": "JSON Web Token",
      "confidence": "high",
      "pattern": "\\beyJ[A-Za-z0-9_-]{8,}\\.eyJ[A-Za-z0-9_-]{8,}\\.[A-Za-z0-9_-]{8,}",
      "hintPrefix": 3
    },
    {
      "id": "bearer_header",
      "name": "Bearer token",
      "confidence": "high",
      "pattern": "(?i)authorization:\\s*bearer\\s+([A-Za-z0-9._~+/=-]{16,})",
      "group": 1,
      "hintPrefix": 0
    },
    {
      "id": "env_secret",
      "name": "Secret in a config line",
      "confidence": "medium",
      "pattern": "(?m)(?:^|(?<=\\s))[ \\t]*(?:export[ \\t]+)?[A-Z0-9_]*(?:SECRET|TOKEN|PASSWORD|PASSWD|API_?KEY|PRIVATE_?KEY|ACCESS_?KEY)[A-Z0-9_]*[ \\t]*=[ \\t]*[\"']?([^\\s\"']{8,})",
      "group": 1,
      "hintPrefix": 0
    },
    {
      "id": "password_assignment",
      "name": "Password or secret",
      "confidence": "medium",
      "pattern": "(?i)\\b(?:password|passwd|pwd|secret|token|api[_-]?key)\\b[\"']?\\s*[:=]\\s*[\"']?([^\\s\"',;]{8,})",
      "group": 1,
      "hintPrefix": 0,
      "minEntropy": 3.0
    },
    {
      "id": "credit_card",
      "name": "Card number",
      "confidence": "medium",
      "pattern": "\\b[3-6](?:[ -]?\\d){12,18}\\b",
      "hintPrefix": 0,
      "checksum": "luhn"
    },
    {
      "id": "iban",
      "name": "IBAN",
      "confidence": "medium",
      "pattern": "\\b[A-Z]{2}\\d{2}(?: ?[A-Z0-9]{4}){3,7}(?: ?[A-Z0-9]{1,3})?\\b",
      "hintPrefix": 2,
      "checksum": "iban"
    },
    {
      "id": "us_ssn",
      "name": "US Social Security number",
      "confidence": "medium",
      "pattern": "\\b(?!000|666|9\\d\\d)\\d{3}-(?!00)\\d{2}-(?!0000)\\d{4}\\b",
      "hintPrefix": 0
    },
    {
      "id": "high_entropy_token",
      "name": "Key-like token",
      "confidence": "medium",
      "pattern": "(?<![A-Za-z0-9+/=_-])[A-Za-z0-9+/_-]{32,}={0,2}(?![A-Za-z0-9+/=_-])",
      "hintPrefix": 0,
      "minEntropy": 4.2,
      "minCharClasses": 3,
      "rejectIdentifiers": true
    }
  ]
}
