test_check_ok_security.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
2 days ago
| 1 | """Security — Check-if-OK refuses path escape; no secrets in scaffold.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from datetime import date |
| 6 | from pathlib import Path |
| 7 | |
| 8 | import pytest |
| 9 | |
| 10 | from cli.kit_root import kit_root |
| 11 | from tests.support import git_status_runner, run_cli, write_config |
| 12 | from tools.check_ok.scaffold import render_side_check_markdown, scaffold_side_check |
| 13 | |
| 14 | |
| 15 | def test_scaffold_rejects_escape(tmp_path: Path) -> None: |
| 16 | with pytest.raises(ValueError, match="path-escape"): |
| 17 | scaffold_side_check(tmp_path, path="../../etc/passwd") |
| 18 | |
| 19 | |
| 20 | def test_cli_rejects_escape(tmp_path: Path) -> None: |
| 21 | write_config(tmp_path, "config-git-only.yaml") |
| 22 | code = run_cli( |
| 23 | ["check-ok", "--path", "../../etc/passwd", "--scaffold-only"], |
| 24 | cwd=tmp_path, |
| 25 | runner=git_status_runner(), |
| 26 | kit=kit_root(), |
| 27 | ) |
| 28 | assert code == 4 |
| 29 | |
| 30 | |
| 31 | def test_scaffold_body_has_no_secret_placeholders() -> None: |
| 32 | body = render_side_check_markdown( |
| 33 | topic="sec", |
| 34 | phase_id="check-ok-sec", |
| 35 | scope="security tier", |
| 36 | output_path="docs/reviews/x.md", |
| 37 | date_stamp="2026-07-17", |
| 38 | ) |
| 39 | lowered = body.lower() |
| 40 | assert "api_key" not in lowered |
| 41 | assert "private_key" not in lowered |
| 42 | assert "password" not in lowered |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
2 days ago