Add reports/report.gohtml
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
{{- /*
|
||||
report.gohtml — IEC 62443-3-3 SL2 Compliance Report Template
|
||||
|
||||
An external Go template rendered by reports/render.go. Receives the full
|
||||
JSON document as an untyped map[string]any. Access fields via (index . "key").
|
||||
|
||||
Template functions (registered by render.go):
|
||||
passIcon v → "✅ PASS" / "❌ FAIL" / "❓ MANUAL"
|
||||
severityIcon s → 🔴/🟠/🟡/🟢/⚪
|
||||
title s → "Hello World" (capitalizes words)
|
||||
divf a b → a / b * 100.0 (percentage)
|
||||
add a b / sub a b → integer arithmetic
|
||||
|
||||
To customize: copy this file, modify, run:
|
||||
go run reports/render.go reports/*.json my-custom.gohtml
|
||||
*/ -}}
|
||||
╔══════════════════════════════════════════════════════════════════════════╗
|
||||
║ IEC 62443-3-3 SECURITY LEVEL 2 — COMPLIANCE REPORT ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ Target: {{ (index .meta "target") }}
|
||||
║ Standard: {{ (index .meta "standard") }}
|
||||
║ Level: {{ (index .meta "security_level") }}
|
||||
║ Timestamp: {{ (index .meta "timestamp") }}
|
||||
║ Executed by: {{ (index .meta "executed_by") }}
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ EXECUTIVE SUMMARY ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ ║
|
||||
║ TOTAL PASSED FAILED REVIEW COMPLIANCE ║
|
||||
║ ───── ────── ────── ────── ────────── ║
|
||||
║ {{ printf "%-8d" (index .summary "total") }} {{ printf "%-9d" (index .summary "passed") }} {{ printf "%-9d" (index .summary "failed") }} {{ printf "%-9d" (index .summary "skipped") }} {{ if gt (index .summary "total") 0 }}{{ printf "%.1f%%" (divf (index .summary "passed") (index .summary "total")) }}{{ else }}N/A{{ end }}
|
||||
║ ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ RESULTS BY REQUIREMENT ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ ║
|
||||
{{- $results := index . "results" }}
|
||||
{{- range $i, $r := $results }}
|
||||
║ {{ severityIcon (index $r "severity") }} [{{ index $r "test_id" }}] {{ passIcon (index $r "passed") }} {{ index $r "description" }}
|
||||
║ Requirement: {{ index $r "requirement" }}
|
||||
║ Expected: {{ index $r "expected" }}
|
||||
║ Actual: {{ index $r "actual" }}
|
||||
{{- if not (index $r "passed") }}
|
||||
║ Fix: {{ index $r "remediation" }}
|
||||
{{- end }}
|
||||
║ ║
|
||||
{{- end }}
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ FAILURE DETAIL ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
{{- $failures := index . "failures" }}
|
||||
{{- if $failures }}
|
||||
{{- range $i, $f := $failures }}
|
||||
║ ❌ {{ index $f "test_id" }} — {{ index $f "description" }}
|
||||
║ Severity: {{ index $f "severity" | title }}
|
||||
║ Remediation: {{ index $f "remediation" }}
|
||||
║ ║
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
║ ✅ ALL CONTROLS PASSED ║
|
||||
{{- end }}
|
||||
╚══════════════════════════════════════════════════════════════════════════╝
|
||||
Reference in New Issue
Block a user