fix(security): ignorer les placeholders URL documentaires
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user