Files
violin/tests/pentest_docs/test_pentest_docs_task8_detection_engineering.py
Violin ea7e094528 Remediate audit P0/P1 findings; migrate tests to green
- state.py: fcntl/msvcrt file locking, reservation+finalization, history
  verification, remove dead subprocess bridges (p1-lock)
- hypotheses.py: enforce canonical status, phase/host/service/port match,
  reject unrelated hypotheses (p1-hyp)
- tools.py/__init__.py: retain kwargs (task_id), lifecycle hooks wired
  (REGISTERED_TOOLS + no-op-then-active hooks) (p1-life)
- Migrate tests from tests/*.py to tests/guard + tests/pentest_docs; align
  to actual API (handle_target returns ips[0], handle_exec_burst fail-closed,
  PTT self-certify uses real batch_id, post-exploitation requires hypothesis)
- scoping.md: add checkpoint.json continuity-artifact drift note
- pyproject.toml: v1.2.0, per-file-ignores for tests/scripts (E402/S101)
- Add .pytest-tmp-plugin/ to .gitignore

64 passed; ruff clean.
2026-07-12 20:57:55 +01:00

65 lines
1.7 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
PENTEST = ROOT / "skills/pentest"
REPORTING = PENTEST / "playbooks/reporting.md"
TEMPLATE = PENTEST / "templates/report-template.md"
DETECTION_TEMPLATE = PENTEST / "templates/detection-engineering.md"
def _text(path: Path) -> str:
return path.read_text(encoding="utf-8")
def test_detection_engineering_template_exists_with_required_fields():
text = _text(DETECTION_TEMPLATE)
required = [
"# Detection Engineering Deliverable",
"Finding ID",
"Detection Objective",
"Data Sources",
"Log Source / Product",
"Detection Logic",
"Sigma",
"Splunk SPL",
"Elastic KQL",
"Triage Steps",
"False Positive Notes",
"Validation Command or Replay",
"Evidence Path",
"Owner",
]
for marker in required:
assert marker in text
def test_reporting_requires_detection_deliverable_for_actionable_findings():
text = _text(REPORTING)
required = [
"Detection Engineering Deliverable",
"templates/detection-engineering.md",
"data sources",
"detection logic",
"triage steps",
"false positive notes",
"validation command or replay",
"Do not invent telemetry",
]
for marker in required:
assert marker in text
def test_report_template_has_detection_section_linking_to_findings():
text = _text(TEMPLATE)
required = [
"## Detection Engineering",
"Finding ID",
"Detection Deliverable",
"Data Sources",
"Detection Status",
"Validation Evidence",
"False Positive Notes",
]
for marker in required:
assert marker in text