fix(security): ignorer les placeholders URL documentaires
This commit is contained in:
@@ -118,6 +118,33 @@ def test_main_detects_sensitive_url_parameter(
|
||||
assert sentinel not in output
|
||||
|
||||
|
||||
def test_main_ignores_documentation_url_placeholders(
|
||||
secret_checker: ModuleType, tmp_path: Path, capsys: CaptureFixture[str]
|
||||
) -> None:
|
||||
"""Ignore les marqueurs de remplacement utilisés dans une documentation.
|
||||
|
||||
:param secret_checker: Module du script sous test.
|
||||
:param tmp_path: Répertoire temporaire représentant un dépôt.
|
||||
:param capsys: Fixture de capture de sortie.
|
||||
:return: None
|
||||
"""
|
||||
(tmp_path / "guide.md").write_text(
|
||||
"\n".join(
|
||||
(
|
||||
"https://example.invalid/?icalsecurise={jeton}",
|
||||
"https://example.invalid/?icalsecurise=••••••••",
|
||||
"https://example.invalid/?icalsecurise=<token>",
|
||||
"https://example.invalid/?icalsecurise=...",
|
||||
)
|
||||
)
|
||||
+ "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
assert secret_checker.main([], root=tmp_path) == 0
|
||||
assert "OK:" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_staged_mode_inspects_only_paths_provided_by_git(
|
||||
secret_checker: ModuleType, tmp_path: Path, capsys: CaptureFixture[str]
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user