diff options
| author | Claude <noreply@anthropic.com> | 2026-11-10 17:15:06 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-11-10 17:28:34 +0000 |
| commit | c5b331fc98841f8050ec498393ef210b0eb10f13 (patch) | |
| tree | eb1c6cafdb3511d30c61e6fa8f54e8d19bc43c6a /plugins | |
| parent | e40ebd818bd1c6ab39ac9d8aaf6f85baef19b1db (diff) | |
Keep whole fake secrets out of test sources
Co-authored-by: mhegazy <mhegazy@anthropic.com>
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/security-guidance/tests/test_patterns_file_shape.py | 3 | ||||
| -rw-r--r-- | plugins/security-guidance/tests/test_secret_shaped_paths.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/security-guidance/tests/test_patterns_file_shape.py b/plugins/security-guidance/tests/test_patterns_file_shape.py index a63494b6..249a3701 100644 --- a/plugins/security-guidance/tests/test_patterns_file_shape.py +++ b/plugins/security-guidance/tests/test_patterns_file_shape.py @@ -109,7 +109,8 @@ def test_edit_hook_still_warns_with_a_wrong_shape_file_present(project, hook_env payload = { "session_id": "s1", "hook_event_name": "PostToolUse", "tool_name": "Write", "tool_input": {"file_path": str(project / "cfg.py"), - "content": "KEY = 'AKIAABCDEFGHIJKLMNOP'\n"}, + # Split so secret scanners do not flag this made-up value. + "content": "KEY = 'AKIA" + "ABCDEFGHIJKLMNOP'\n"}, "cwd": str(project), "tool_response": {}, } _rc, stdout, stderr = run_hook(payload, env) diff --git a/plugins/security-guidance/tests/test_secret_shaped_paths.py b/plugins/security-guidance/tests/test_secret_shaped_paths.py index b20beef3..7aaf1036 100644 --- a/plugins/security-guidance/tests/test_secret_shaped_paths.py +++ b/plugins/security-guidance/tests/test_secret_shaped_paths.py @@ -95,7 +95,8 @@ def test_rename_away_from_a_secret_name_is_left_out(tmp_path): def test_stop_hook_reports_how_many_files_it_left_out(tmp_path, hook_env, stub_api): repo = make_repo(tmp_path / "repo") run_hook(ups_payload(repo), hook_env) - (repo / "id_ed25519").write_text("-----BEGIN OPENSSH PRIVATE KEY-----\n") + # Split so secret scanners do not flag this made-up value. + (repo / "id_ed25519").write_text("-----BEGIN OPENSSH " + "PRIVATE KEY-----\n") (repo / ".env.local").write_text("TOKEN=abc\n") _rc, stdout, _err = run_hook(stop_payload(repo), hook_env) assert metrics_of(stdout).get("secret_shaped_skipped") == 2 |
