From f04a2032ec00bb35b4d40e4249b75a90d6de16ea Mon Sep 17 00:00:00 2001 From: aksamlan Date: Sun, 27 Sep 2026 08:29:01 +0200 Subject: [PATCH] Detect Grafana service account tokens --- repodx.py | 5 +++-- tests/test_repodx.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/repodx.py b/repodx.py index 28f878f..a4e7d89 100644 --- a/repodx.py +++ b/repodx.py @@ -366,6 +366,7 @@ def check_readme(repo_path): ("GitHub token", r"\bgh[pousr]_[A-Za-z0-9]{36,}\b"), ("GitHub token", r"\bgithub_pat_[A-Za-z0-9_]{60,}\b"), ("GitLab token", r"\bglpat-[A-Za-z0-9_\-]{20,}"), + ("Grafana service account token", r"\bglsa_[A-Za-z0-9]{32}_[a-fA-F0-9]{8}\b"), ("npm access token", r"\bnpm_[A-Za-z0-9]{36}\b"), ("Shopify token", r"\bshp(?:at|ca|pa|ss)_[a-fA-F0-9]{32}\b"), ("DigitalOcean token", r"\bdo[op]_v1_[a-f0-9]{64}\b"), @@ -425,8 +426,8 @@ def check_readme(repo_path): # Every pattern above contains one of these strings, so lines without them are skipped quickly. CANDIDATE_LITERALS = [ "sk-", "AKIA", "ASIA", "ghp_", "gho_", "ghu_", "ghs_", "ghr_", "github_pat_", "glpat-", "_live_", - "sb_secret_", "xox", "hf_", "npm_", "gsk_", "pplx-", "r8_", "SG.", ":AA", "AIza", "eyJ", "://", "shpat_", - "shpca_", "shppa_", "shpss_", "dop_v1_", "doo_v1_", "pypi-", + "glsa_", "sb_secret_", "xox", "hf_", "npm_", "gsk_", "pplx-", "r8_", "SG.", ":AA", "AIza", "eyJ", "://", + "shpat_", "shpca_", "shppa_", "shpss_", "dop_v1_", "doo_v1_", "pypi-", ] diff --git a/tests/test_repodx.py b/tests/test_repodx.py index b2647b7..e6b3155 100644 --- a/tests/test_repodx.py +++ b/tests/test_repodx.py @@ -581,6 +581,7 @@ def test_detects_provider_keys(self): "AWS access key": fake("AKIA", "Q7ZT4MWX9RB2KD5N"), "GitHub token": fake("ghp", "_", "q7ZT4mWx9Rb2Kd5Nf8Lp3Hs6Vc1Yj0GuE4tA"), "GitLab token": fake("glpat", "-", "Q7zT4mWx9Rb2Kd5Nf8Lp"), + "Grafana service account token": fake("glsa", "_", "A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6", "_", "1a2B3c4D"), "npm access token": fake("npm_", "A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8"), "Shopify token": fake("shpat", "_", "9f4e6a2b7c8d0a1b2c3d4e5f6a7b8c9d"), "DigitalOcean token": fake("dop_v1_", "f1e2d3c4b5a69788796a5b4c3d2e1f0af9e8d7c6b5a49382716f0e1d2c3ba4b7"),