fix(security): ignorer les placeholders URL documentaires

This commit is contained in:
2026-09-12 15:17:54 +02:00
parent 573705a3d0
commit 0ff6e687b6
2 changed files with 30 additions and 1 deletions
+3 -1
View File
@@ -37,6 +37,7 @@ _URL_SECRET_RE = re.compile(
r"(?ix)[?&](?:api[_-]?key|access[_-]?token|auth(?:orization)?|icalsecurise|password|secret|token)"
r"=([^&#\s]{3,})"
)
_URL_PLACEHOLDER_RE = re.compile(r"(?x)^(?:\{[^{}\r\n]+\}|<[^<>\r\n]+>|\.+|[•…*]+)$")
_EXTRA_NAMES = frozenset({"pronote_sync"})
@@ -185,7 +186,8 @@ def find_secrets(
)
if is_literal_secret:
findings.append(SecretFinding(relative_path, number, "affectation-litterale"))
if _URL_SECRET_RE.search(line):
url_match = _URL_SECRET_RE.search(line)
if url_match and not _URL_PLACEHOLDER_RE.fullmatch(url_match.group(1)):
findings.append(SecretFinding(relative_path, number, "parametre-url"))
return sorted(findings, key=lambda finding: (str(finding.path), finding.line, finding.rule))