Build authorization-gated tenancy evidence harness
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a0260c-4067-7052-9647-ad000d576e38
This commit is contained in:
parent
2c8e1d41ad
commit
beab2a04d1
32 changed files with 1816 additions and 11 deletions
31
src/whitehat_security/reporting.py
Normal file
31
src/whitehat_security/reporting.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from .model import RunReport
|
||||
|
||||
|
||||
def write_report(report: RunReport, output: str | Path) -> None:
|
||||
path = Path(output)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(json.dumps(report.as_dict(), indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
def risk_nexus_message(report: RunReport) -> str:
|
||||
lines = [
|
||||
f"Whitehat run `{report.run_id}`: **{report.outcome}**",
|
||||
"",
|
||||
f"- evidence class: `{report.evidence_class}`",
|
||||
f"- target: `{report.target}` at `{report.target_revision}`",
|
||||
f"- posture/model: `{report.posture_claim}` / `{report.attacker_model}`",
|
||||
f"- engagement/authorization: `{report.engagement_id}` / `{report.authorization_id}`",
|
||||
f"- attempted operations: {report.attempted_operations}",
|
||||
f"- interval: {report.started_at} to {report.ended_at}",
|
||||
"",
|
||||
report.assurance_statement,
|
||||
]
|
||||
if report.outcome == "finding":
|
||||
lines.extend(["", "Reporter supplies facts only; risk-nexus owns severity and disclosure."])
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue