sec-report-kit 0.7.2__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/CHANGELOG.md +9 -0
  2. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/PKG-INFO +32 -1
  3. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/README.md +31 -0
  4. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/pyproject.toml +1 -1
  5. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/__init__.py +1 -1
  6. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/cli.py +63 -5
  7. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/generate_consolidated_security_report.py +2 -0
  8. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/server.py +31 -7
  9. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/models.py +26 -0
  10. sec_report_kit-0.8.0/src/sec_report_kit/parsers/accepted.py +24 -0
  11. sec_report_kit-0.8.0/src/sec_report_kit/parsers/trivy.py +111 -0
  12. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/report/html_renderer.py +195 -16
  13. sec_report_kit-0.8.0/src/sec_report_kit/services/scan_warnings.py +68 -0
  14. sec_report_kit-0.8.0/tests/test_accepted_risks.py +285 -0
  15. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_cli.py +14 -0
  16. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_html_renderer.py +14 -0
  17. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_mcp_server.py +45 -0
  18. sec_report_kit-0.8.0/tests/test_scan_warnings.py +161 -0
  19. sec_report_kit-0.7.2/src/sec_report_kit/parsers/trivy.py +0 -26
  20. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.gitattributes +0 -0
  21. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.github/workflows/pip-audit.yml +0 -0
  22. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.github/workflows/publish-pypi.yml +0 -0
  23. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.github/workflows/publish-testpypi.yml +0 -0
  24. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.github/workflows/trivy-fs-audit.yml +0 -0
  25. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.github/workflows/unit-test-coverage-gate.yml +0 -0
  26. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/.gitignore +0 -0
  27. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/bandit-gaps-vs-sast-open-source-tools.md +0 -0
  28. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/check_assets.py +0 -0
  29. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/requirements.txt +0 -0
  30. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/download_safety_db.bat +0 -0
  31. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/download_safety_db.py +0 -0
  32. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/download_safety_db.sh +0 -0
  33. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/install_external_clis.py +0 -0
  34. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/install_tools.bat +0 -0
  35. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/install_tools.sh +0 -0
  36. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/mcp_add_workspace_filesystem.bat +0 -0
  37. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/mcp_add_workspace_filesystem.sh +0 -0
  38. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/mcp_add_workspace_filesystem_help.md +0 -0
  39. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_bandit_html.bat +0 -0
  40. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_bandit_html.sh +0 -0
  41. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_checkov_html.bat +0 -0
  42. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_checkov_html.sh +0 -0
  43. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_codeql_html.bat +0 -0
  44. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_codeql_html.sh +0 -0
  45. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_consolidated_html.bat +0 -0
  46. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_consolidated_html.sh +0 -0
  47. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_gitleaks_html.bat +0 -0
  48. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_gitleaks_html.sh +0 -0
  49. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_osv_scanner_html.bat +0 -0
  50. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_osv_scanner_html.sh +0 -0
  51. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_pip_audit_html.bat +0 -0
  52. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_pip_audit_html.sh +0 -0
  53. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_safety_html.bat +0 -0
  54. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_safety_html.sh +0 -0
  55. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_semgrep_html.bat +0 -0
  56. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_semgrep_html.sh +0 -0
  57. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_tfsec_html.bat +0 -0
  58. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_tfsec_html.sh +0 -0
  59. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_trivy_html.bat +0 -0
  60. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_trivy_html.sh +0 -0
  61. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_trufflehog_html.bat +0 -0
  62. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/render_trufflehog_html.sh +0 -0
  63. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_all_security_scans.bat +0 -0
  64. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_all_security_scans.sh +0 -0
  65. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_bandit.bat +0 -0
  66. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_bandit.sh +0 -0
  67. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_checkov.bat +0 -0
  68. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_checkov.sh +0 -0
  69. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_codeql.bat +0 -0
  70. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_codeql.sh +0 -0
  71. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_gitleaks.bat +0 -0
  72. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_gitleaks.sh +0 -0
  73. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_osv_scanner.bat +0 -0
  74. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_osv_scanner.sh +0 -0
  75. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_pip_audit.bat +0 -0
  76. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_pip_audit.sh +0 -0
  77. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_safety.bat +0 -0
  78. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_safety.sh +0 -0
  79. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_semgrep.bat +0 -0
  80. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_semgrep.sh +0 -0
  81. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_tfsec.bat +0 -0
  82. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_tfsec.sh +0 -0
  83. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_trivy.bat +0 -0
  84. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_trivy.sh +0 -0
  85. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_trufflehog.bat +0 -0
  86. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_trufflehog.sh +0 -0
  87. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_unit_tests_with_coverage.bat +0 -0
  88. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/scripts/run_unit_tests_with_coverage.sh +0 -0
  89. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/__main__.py +0 -0
  90. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/__init__.py +0 -0
  91. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/catalog.py +0 -0
  92. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/paths.py +0 -0
  93. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/prompts.py +0 -0
  94. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/protocol.py +0 -0
  95. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/mcp/resources.py +0 -0
  96. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/__init__.py +0 -0
  97. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/bandit.py +0 -0
  98. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/checkov.py +0 -0
  99. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/codeql.py +0 -0
  100. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/cyclonedx.py +0 -0
  101. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/gitleaks.py +0 -0
  102. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/osv_scanner.py +0 -0
  103. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/pip_audit.py +0 -0
  104. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/safety.py +0 -0
  105. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/semgrep.py +0 -0
  106. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/tfsec.py +0 -0
  107. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/parsers/trufflehog.py +0 -0
  108. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/report/__init__.py +0 -0
  109. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/report/charts.py +0 -0
  110. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/report/sbom_renderer.py +0 -0
  111. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/services/__init__.py +0 -0
  112. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/services/normalize.py +0 -0
  113. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/src/sec_report_kit/services/summarize.py +0 -0
  114. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_charts.py +0 -0
  115. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_cyclonedx.py +0 -0
  116. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_mcp_prompts_resources.py +0 -0
  117. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_mcp_security.py +0 -0
  118. {sec_report_kit-0.7.2 → sec_report_kit-0.8.0}/tests/test_parsers.py +0 -0
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 0.8.0 - 2026-11-11
6
+
7
+ ### Added
8
+ - Accepted risks: findings Trivy suppresses with `--ignorefile` or `--vex` (kept in the JSON with `--show-suppressed`, under `ExperimentalModifiedFindings`) are parsed and listed in their own **Accepted risks** section of the Trivy HTML report and the consolidated dashboard, with severity, status, justification and source file. They are never counted as findings. The dashboard gets an "Accepted risks (not counted)" card and a navigation link. Vulnerability, secret, misconfiguration and license suppressions are supported.
9
+ - `srk render trivy` / `srk render consolidated` print `Accepted risks (not counted): N`. The MCP tools `summarize_json` and `render_report_from_json` return `accepted_risks`, and `summarize_json` also returns `accepted_counts`.
10
+ - `srk render consolidated --warnings FILE` shows scan warnings on the dashboard. These are non-finding messages such as scanner warnings, partial coverage or skipped inputs, given as `[{tool, message, level, category, source}]`. They appear in a "Scan warnings" panel with a summary card and navigation link, with `runtime` messages (deprecations, JVM notices) collapsed. They are never counted as findings. The CLI prints `Scan warnings: N (+M scanner runtime messages)`.
11
+ - Input files the consolidated renderer cannot read are listed as scan warnings on the dashboard, not only in the console.
12
+ - The consolidated dashboard shows the sec-report-kit version that generated it, in the header and the footer.
13
+
5
14
  ## 0.7.2 - 2026-11-04
6
15
 
7
16
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sec-report-kit
3
- Version: 0.7.2
3
+ Version: 0.8.0
4
4
  Summary: Generate HTML security reports from Trivy, pip-audit, Safety, Bandit, and Gitleaks JSON
5
5
  Author: Ravi Konduru
6
6
  License: MIT
@@ -71,6 +71,17 @@ Render Trivy JSON:
71
71
  srk render trivy --input security_reports/trivy-image-report-v1.0.21.json --output security_reports/report-trivy.html --source trivy --target shankonduru/cpkc-poc:v1.0.21
72
72
  ```
73
73
 
74
+ #### Accepted risks (Trivy ignore files and VEX)
75
+
76
+ If you suppress findings with `--ignorefile` or `--vex`, run Trivy with `--show-suppressed`. Suppressed findings then stay in the JSON output. They show up in an **Accepted risks** section of the Trivy report and the consolidated dashboard, with status, justification (the ignore file's `statement`) and source file. They are not counted in the totals or severity counts, so accepting a risk does not hide it from reviewers.
77
+
78
+ ```bash
79
+ trivy fs --ignorefile trivy-accepted-risks.yaml --show-suppressed --format json --output trivy.json .
80
+ srk render trivy --input trivy.json --output trivy.html
81
+ ```
82
+
83
+ The MCP tools `summarize_json` and `render_report_from_json` also return `accepted_risks` (plus `accepted_counts` from `summarize_json`).
84
+
74
85
  Render a CycloneDX SBOM into an HTML component inventory:
75
86
 
76
87
  ```bash
@@ -115,6 +126,26 @@ Example with implicit output folder:
115
126
  srk render consolidated --input security_reports --source consolidated --target sec-report-kit
116
127
  ```
117
128
 
129
+ #### Scan warnings
130
+
131
+ Scanners also print warnings that are not findings, such as partial coverage, a failed rule download or a deprecated flag. These usually end up only in a log. Pass them in with `--warnings` to show them in a **Scan warnings** panel on the dashboard:
132
+
133
+ ```bash
134
+ srk render consolidated --input security_reports --warnings security_reports/scan-warnings.json
135
+ ```
136
+
137
+ ```json
138
+ [
139
+ {"tool": "pip-audit", "level": "warning", "category": "scan",
140
+ "message": "--no-deps is supported, but users are encouraged to fully hash their pinned dependencies",
141
+ "source": "logs/pip-audit.log"},
142
+ {"tool": "codeql", "level": "warning", "category": "runtime",
143
+ "message": "WARNING: A restricted method in java.lang.System has been called"}
144
+ ]
145
+ ```
146
+
147
+ `level` is `error`, `warning` or `info`, and defaults to `warning`. `category` is `scan` for messages that can affect results, which is the default, or `runtime` for scanner or tooling noise. Runtime messages are collapsed under the scan warnings. An object `{"warnings": [...]}` is accepted too. The warnings file can sit in the `--input` folder, and it is not read as a scanner output. Input files the dashboard cannot read are added as scan warnings automatically. Scan warnings are never counted as findings.
148
+
118
149
  All render commands accept both `--source` and `--target` so callers can control the header values shown as `Source:` and `Target:` in generated HTML.
119
150
 
120
151
  ## Helper Scripts (bat/sh)
@@ -44,6 +44,17 @@ Render Trivy JSON:
44
44
  srk render trivy --input security_reports/trivy-image-report-v1.0.21.json --output security_reports/report-trivy.html --source trivy --target shankonduru/cpkc-poc:v1.0.21
45
45
  ```
46
46
 
47
+ #### Accepted risks (Trivy ignore files and VEX)
48
+
49
+ If you suppress findings with `--ignorefile` or `--vex`, run Trivy with `--show-suppressed`. Suppressed findings then stay in the JSON output. They show up in an **Accepted risks** section of the Trivy report and the consolidated dashboard, with status, justification (the ignore file's `statement`) and source file. They are not counted in the totals or severity counts, so accepting a risk does not hide it from reviewers.
50
+
51
+ ```bash
52
+ trivy fs --ignorefile trivy-accepted-risks.yaml --show-suppressed --format json --output trivy.json .
53
+ srk render trivy --input trivy.json --output trivy.html
54
+ ```
55
+
56
+ The MCP tools `summarize_json` and `render_report_from_json` also return `accepted_risks` (plus `accepted_counts` from `summarize_json`).
57
+
47
58
  Render a CycloneDX SBOM into an HTML component inventory:
48
59
 
49
60
  ```bash
@@ -88,6 +99,26 @@ Example with implicit output folder:
88
99
  srk render consolidated --input security_reports --source consolidated --target sec-report-kit
89
100
  ```
90
101
 
102
+ #### Scan warnings
103
+
104
+ Scanners also print warnings that are not findings, such as partial coverage, a failed rule download or a deprecated flag. These usually end up only in a log. Pass them in with `--warnings` to show them in a **Scan warnings** panel on the dashboard:
105
+
106
+ ```bash
107
+ srk render consolidated --input security_reports --warnings security_reports/scan-warnings.json
108
+ ```
109
+
110
+ ```json
111
+ [
112
+ {"tool": "pip-audit", "level": "warning", "category": "scan",
113
+ "message": "--no-deps is supported, but users are encouraged to fully hash their pinned dependencies",
114
+ "source": "logs/pip-audit.log"},
115
+ {"tool": "codeql", "level": "warning", "category": "runtime",
116
+ "message": "WARNING: A restricted method in java.lang.System has been called"}
117
+ ]
118
+ ```
119
+
120
+ `level` is `error`, `warning` or `info`, and defaults to `warning`. `category` is `scan` for messages that can affect results, which is the default, or `runtime` for scanner or tooling noise. Runtime messages are collapsed under the scan warnings. An object `{"warnings": [...]}` is accepted too. The warnings file can sit in the `--input` folder, and it is not read as a scanner output. Input files the dashboard cannot read are added as scan warnings automatically. Scan warnings are never counted as findings.
121
+
91
122
  All render commands accept both `--source` and `--target` so callers can control the header values shown as `Source:` and `Target:` in generated HTML.
92
123
 
93
124
  ## Helper Scripts (bat/sh)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sec-report-kit"
7
- version = "0.7.2"
7
+ version = "0.8.0"
8
8
  description = "Generate HTML security reports from Trivy, pip-audit, Safety, Bandit, and Gitleaks JSON"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,4 +1,4 @@
1
1
  """sec_report_kit package."""
2
2
 
3
3
  __all__ = ["__version__"]
4
- __version__ = "0.7.2"
4
+ __version__ = "0.8.0"
@@ -10,6 +10,7 @@ import typer
10
10
 
11
11
  from sec_report_kit import __version__
12
12
  from sec_report_kit.parsers import detect_source_type
13
+ from sec_report_kit.parsers.accepted import parse_accepted_risks
13
14
  from sec_report_kit.parsers.bandit import parse_bandit_json
14
15
  from sec_report_kit.parsers.checkov import parse_checkov_json
15
16
  from sec_report_kit.parsers.codeql import parse_codeql_json
@@ -24,6 +25,8 @@ from sec_report_kit.parsers.trufflehog import parse_trufflehog_json
24
25
  from sec_report_kit.parsers.cyclonedx import parse_cyclonedx_sbom
25
26
  from sec_report_kit.report.html_renderer import render_consolidated_dashboard_report, render_html_report
26
27
  from sec_report_kit.report.sbom_renderer import render_sbom_report
28
+ from sec_report_kit.models import ScanWarning
29
+ from sec_report_kit.services.scan_warnings import load_scan_warnings
27
30
  from sec_report_kit.services.summarize import count_by_severity, sort_findings
28
31
 
29
32
  app = typer.Typer(help="Security report kit CLI")
@@ -199,19 +202,29 @@ def _write_report(source_label: str, target_ref: str, input_path: Path, output_p
199
202
  parser = detect_source_type(payload)
200
203
  typer.echo(f"[INFO] Detected source type: {parser}")
201
204
  findings = _parse_findings(payload, parser)
205
+ accepted = parse_accepted_risks(payload, parser)
202
206
 
203
207
  findings = sort_findings(findings)
204
208
  counts = count_by_severity(findings)
205
- report_html = render_html_report(target_ref=target_ref, source_label=source_label, findings=findings, counts=counts)
209
+ report_html = render_html_report(
210
+ target_ref=target_ref, source_label=source_label, findings=findings, counts=counts, accepted=accepted
211
+ )
206
212
  output_path.parent.mkdir(parents=True, exist_ok=True)
207
213
  output_path.write_text(report_html, encoding="utf-8")
208
214
 
209
215
  typer.echo(f"[OK] Report generated: {output_path}")
210
216
  typer.echo(f"[INFO] Total findings: {len(findings)}")
211
217
  typer.echo(f"[INFO] Severity counts: {counts}")
218
+ if accepted:
219
+ typer.echo(f"[INFO] Accepted risks (not counted): {len(accepted)}")
212
220
 
213
221
 
214
- def _write_consolidated_tool_reports(output_dir: Path, target_ref: str, findings_by_parser: dict[str, list[Any]]) -> None:
222
+ def _write_consolidated_tool_reports(
223
+ output_dir: Path,
224
+ target_ref: str,
225
+ findings_by_parser: dict[str, list[Any]],
226
+ accepted_by_parser: dict[str, list[Any]] | None = None,
227
+ ) -> None:
215
228
  for parser, findings in findings_by_parser.items():
216
229
  output_name = _CONSOLIDATED_TOOL_OUTPUT_FILES.get(parser)
217
230
  if output_name is None:
@@ -224,6 +237,7 @@ def _write_consolidated_tool_reports(output_dir: Path, target_ref: str, findings
224
237
  source_label=parser,
225
238
  findings=sorted_findings,
226
239
  counts=counts,
240
+ accepted=(accepted_by_parser or {}).get(parser),
227
241
  )
228
242
  (output_dir / output_name).write_text(report_html, encoding="utf-8")
229
243
 
@@ -416,20 +430,43 @@ def render_consolidated(
416
430
  min=1,
417
431
  help="Maximum number of most recently modified report files to include after filtering",
418
432
  ),
433
+ warnings: Path | None = typer.Option(
434
+ None,
435
+ "--warnings",
436
+ exists=True,
437
+ file_okay=True,
438
+ dir_okay=False,
439
+ readable=True,
440
+ help=(
441
+ "JSON file of scan warnings (non-finding messages such as scanner warnings) to show on the dashboard: "
442
+ '[{"tool", "message", "level": error|warning|info, "category": scan|runtime, "source"}]'
443
+ ),
444
+ ),
419
445
  ) -> None:
420
446
  """Render a consolidated HTML report from all supported report files in a directory."""
421
447
  if output is None:
422
448
  output = input
423
449
 
450
+ scan_warnings: list[ScanWarning] = []
451
+ if warnings is not None:
452
+ try:
453
+ scan_warnings = load_scan_warnings(warnings)
454
+ except (ValueError, OSError) as exc:
455
+ raise typer.BadParameter(str(exc), param_hint="--warnings") from None
456
+
424
457
  candidates = _collect_consolidated_candidates(
425
458
  input_dir=input,
426
459
  modified_since=modified_since,
427
460
  modified_until=modified_until,
428
461
  limit=limit,
429
462
  )
463
+ if warnings is not None:
464
+ # The warnings file may sit next to the scanner outputs; it is not one.
465
+ candidates = [path for path in candidates if path.resolve() != warnings.resolve()]
430
466
 
431
467
  all_findings = []
432
468
  findings_by_parser: dict[str, list[Any]] = {}
469
+ accepted_by_parser: dict[str, list[Any]] = {}
433
470
  included_sources: set[str] = set()
434
471
  included_files = 0
435
472
  skipped_files = 0
@@ -438,17 +475,28 @@ def render_consolidated(
438
475
  payload = _load_json(report_file)
439
476
  parser = detect_source_type(payload)
440
477
  findings = _parse_findings(payload, parser)
478
+ accepted = parse_accepted_risks(payload, parser)
441
479
  all_findings.extend(findings)
442
480
  findings_by_parser.setdefault(parser, []).extend(findings)
481
+ if accepted:
482
+ accepted_by_parser.setdefault(parser, []).extend(accepted)
443
483
  included_sources.add(parser)
444
484
  included_files += 1
445
- typer.echo(f"[INFO] Included {report_file.name} as {parser} ({len(findings)} findings)")
446
- except Exception as exc: # pragma: no cover
485
+ accepted_note = f", {len(accepted)} accepted risks" if accepted else ""
486
+ typer.echo(f"[INFO] Included {report_file.name} as {parser} ({len(findings)} findings{accepted_note})")
487
+ except Exception as exc:
447
488
  skipped_files += 1
448
489
  typer.echo(f"[WARN] Skipping {report_file.name}: {exc}")
490
+ scan_warnings.append(
491
+ ScanWarning(
492
+ tool="sec-report-kit",
493
+ message=f"Skipped {report_file.name}: not included in the dashboard ({exc})",
494
+ source=report_file.name,
495
+ )
496
+ )
449
497
 
450
498
  output.mkdir(parents=True, exist_ok=True)
451
- _write_consolidated_tool_reports(output, target, findings_by_parser)
499
+ _write_consolidated_tool_reports(output, target, findings_by_parser, accepted_by_parser)
452
500
 
453
501
  all_findings = sort_findings(all_findings)
454
502
  counts = count_by_severity(all_findings)
@@ -464,6 +512,8 @@ def render_consolidated(
464
512
  modified_until=until_dt,
465
513
  included_sources=included_sources,
466
514
  findings_by_tool=findings_by_parser,
515
+ accepted_by_tool=accepted_by_parser,
516
+ scan_warnings=scan_warnings,
467
517
  )
468
518
  output_file = output / "consolidated-security-report.html"
469
519
  output_file.write_text(report_html, encoding="utf-8")
@@ -480,6 +530,14 @@ def render_consolidated(
480
530
  typer.echo(f"[INFO] Files skipped: {skipped_files}")
481
531
  typer.echo(f"[INFO] Total findings: {len(all_findings)}")
482
532
  typer.echo(f"[INFO] Severity counts: {counts}")
533
+ accepted_total = sum(len(items) for items in accepted_by_parser.values())
534
+ if accepted_total:
535
+ typer.echo(f"[INFO] Accepted risks (not counted): {accepted_total}")
536
+ if scan_warnings:
537
+ scan_count = sum(1 for w in scan_warnings if w.category == "scan")
538
+ typer.echo(
539
+ f"[INFO] Scan warnings: {scan_count} (+{len(scan_warnings) - scan_count} scanner runtime messages)"
540
+ )
483
541
 
484
542
 
485
543
  @mcp_app.command("serve")
@@ -26,6 +26,7 @@ def main() -> int:
26
26
  type=int,
27
27
  help="Maximum number of most recently modified report files to include after filtering",
28
28
  )
29
+ parser.add_argument("--warnings", help="JSON file of scan warnings to show on the dashboard")
29
30
  args = parser.parse_args()
30
31
 
31
32
  render_consolidated(
@@ -35,6 +36,7 @@ def main() -> int:
35
36
  modified_since=args.modified_since,
36
37
  modified_until=args.modified_until,
37
38
  limit=args.limit,
39
+ warnings=Path(args.warnings) if args.warnings else None,
38
40
  )
39
41
  return 0
40
42
 
@@ -8,6 +8,7 @@ from sec_report_kit.mcp.paths import PathPolicy
8
8
  from sec_report_kit.mcp.prompts import register_prompts
9
9
  from sec_report_kit.mcp.resources import register_resources
10
10
  from sec_report_kit.parsers import detect_source_type
11
+ from sec_report_kit.parsers.accepted import parse_accepted_risks
11
12
  from sec_report_kit.parsers.bandit import parse_bandit_json
12
13
  from sec_report_kit.parsers.checkov import parse_checkov_json
13
14
  from sec_report_kit.parsers.codeql import parse_codeql_json
@@ -55,9 +56,18 @@ def _load_sbom(source_type: str, input_path: str):
55
56
 
56
57
 
57
58
  def _load_payload(source_type: str, input_path: str):
59
+ return _load_findings(source_type, input_path)[0]
60
+
61
+
62
+ def _load_findings(source_type: str, input_path: str):
63
+ """Findings and accepted (suppressed) risks from a scanner output file."""
58
64
  data = _load_raw(input_path)
59
65
  if source_type == "auto":
60
66
  source_type = detect_source_type(data)
67
+ return _parse_payload(source_type, data), parse_accepted_risks(data, source_type)
68
+
69
+
70
+ def _parse_payload(source_type: str, data):
61
71
  if source_type == "trivy":
62
72
  return sort_findings(parse_trivy_json(data))
63
73
  if source_type == "pip-audit":
@@ -147,11 +157,19 @@ def build_server(roots: Iterable[str | Path] | None = None):
147
157
  input_path: Path to the scanner output file, inside the server's
148
158
  allowed directories (relative paths resolve against the first).
149
159
 
150
- Returns {"total": int, "counts": {CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN}}.
160
+ Returns {"total": int, "counts": {CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN},
161
+ "accepted_risks": int, "accepted_counts": {...}}. Accepted risks are
162
+ findings the scanner suppressed by a recorded decision (e.g. a Trivy
163
+ ignore file); they are not included in total or counts.
151
164
  """
152
- findings = _load_payload(source_type=source_type, input_path=str(policy.input_file(input_path)))
165
+ findings, accepted = _load_findings(source_type=source_type, input_path=str(policy.input_file(input_path)))
153
166
  counts = count_by_severity(findings)
154
- return {"total": len(findings), "counts": counts}
167
+ return {
168
+ "total": len(findings),
169
+ "counts": counts,
170
+ "accepted_risks": len(accepted),
171
+ "accepted_counts": count_by_severity(r.finding for r in accepted),
172
+ }
155
173
 
156
174
  @mcp.tool(title="Render scan HTML report", annotations=writes_file)
157
175
  def render_report_from_json(source_type: str, input_path: str, output_path: str, target: str) -> dict:
@@ -167,15 +185,21 @@ def build_server(roots: Iterable[str | Path] | None = None):
167
185
  output_path: Where to write the HTML report.
168
186
  target: Label for what was scanned (image, repo, path), shown in the report.
169
187
 
170
- Returns the output path, total finding count, and counts by severity.
188
+ Accepted risks (findings the scanner suppressed by a recorded decision)
189
+ are listed in their own section and not counted.
190
+
191
+ Returns the output path, total finding count, counts by severity, and
192
+ the number of accepted risks.
171
193
  """
172
194
  out = policy.output_file(output_path)
173
- findings = _load_payload(source_type=source_type, input_path=str(policy.input_file(input_path)))
195
+ findings, accepted = _load_findings(source_type=source_type, input_path=str(policy.input_file(input_path)))
174
196
  counts = count_by_severity(findings)
175
- html = render_html_report(target_ref=target, source_label=source_type, findings=findings, counts=counts)
197
+ html = render_html_report(
198
+ target_ref=target, source_label=source_type, findings=findings, counts=counts, accepted=accepted
199
+ )
176
200
  out.parent.mkdir(parents=True, exist_ok=True)
177
201
  out.write_text(html, encoding="utf-8")
178
- return {"output_path": str(out), "total": len(findings), "counts": counts}
202
+ return {"output_path": str(out), "total": len(findings), "counts": counts, "accepted_risks": len(accepted)}
179
203
 
180
204
  @mcp.tool(title="Validate scanner output", annotations=read_only)
181
205
  def validate_input(source_type: str, input_path: str) -> dict:
@@ -16,6 +16,32 @@ class Finding:
16
16
  primary_url: str
17
17
 
18
18
 
19
+ @dataclass(frozen=True)
20
+ class AcceptedRisk:
21
+ """A finding the scanner suppressed by an explicit decision (for example a
22
+ Trivy ignore file or VEX statement). Reported separately, never counted as a
23
+ finding."""
24
+
25
+ finding: Finding
26
+ status: str
27
+ statement: str
28
+ source: str
29
+
30
+
31
+ @dataclass(frozen=True)
32
+ class ScanWarning:
33
+ """A message from a scan run that is not a finding: a scanner warning, a
34
+ partial-coverage notice, a skipped input. ``category`` is "scan" for
35
+ messages that can affect results and "runtime" for scanner/tooling noise
36
+ (deprecations, JVM notices)."""
37
+
38
+ tool: str
39
+ message: str
40
+ level: str = "warning" # error | warning | info
41
+ category: str = "scan" # scan | runtime
42
+ source: str = ""
43
+
44
+
19
45
  @dataclass(frozen=True)
20
46
  class Component:
21
47
  """A single software component from an SBOM inventory."""
@@ -0,0 +1,24 @@
1
+ """Accepted risks: findings a scanner suppressed by an explicit, recorded decision."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from sec_report_kit.models import AcceptedRisk
6
+ from sec_report_kit.parsers.trivy import parse_trivy_accepted_risks
7
+ from sec_report_kit.services.normalize import SEVERITY_ORDER
8
+
9
+
10
+ def parse_accepted_risks(data, source_type: str) -> list[AcceptedRisk]:
11
+ """Accepted risks recorded in *data* for scanners that report them (currently Trivy).
12
+
13
+ Returns an empty list for every other scanner. Sorted like findings.
14
+ """
15
+ if source_type != "trivy":
16
+ return []
17
+ return sorted(
18
+ parse_trivy_accepted_risks(data),
19
+ key=lambda r: (
20
+ SEVERITY_ORDER[r.finding.severity],
21
+ r.finding.package.lower(),
22
+ r.finding.vulnerability_id.lower(),
23
+ ),
24
+ )
@@ -0,0 +1,111 @@
1
+ from __future__ import annotations
2
+
3
+ from sec_report_kit.models import AcceptedRisk, Finding
4
+ from sec_report_kit.services.normalize import normalize_severity
5
+
6
+
7
+ def parse_trivy_json(data: dict) -> list[Finding]:
8
+ findings: list[Finding] = []
9
+ for result in data.get("Results", []):
10
+ target = result.get("Target", "unknown")
11
+ source_type = result.get("Type", "unknown")
12
+ for vuln in result.get("Vulnerabilities", []) or []:
13
+ findings.append(
14
+ Finding(
15
+ source_type=source_type,
16
+ target=target,
17
+ severity=normalize_severity(vuln.get("Severity")),
18
+ vulnerability_id=vuln.get("VulnerabilityID", "-"),
19
+ package=vuln.get("PkgName", "-"),
20
+ installed_version=vuln.get("InstalledVersion", "-"),
21
+ fixed_version=vuln.get("FixedVersion") or "-",
22
+ title=vuln.get("Title") or "-",
23
+ primary_url=vuln.get("PrimaryURL") or "",
24
+ )
25
+ )
26
+ return findings
27
+
28
+
29
+ # Trivy lists findings suppressed by --ignorefile / VEX under this key when run
30
+ # with --show-suppressed. Accept the unprefixed name too, for when it leaves
31
+ # experimental status.
32
+ _SUPPRESSED_KEYS = ("ExperimentalModifiedFindings", "ModifiedFindings")
33
+
34
+
35
+ def _suppressed_finding(kind: str, item: dict, result: dict) -> Finding:
36
+ target = result.get("Target", "unknown")
37
+ source_type = result.get("Type") or result.get("Class") or "unknown"
38
+ if kind == "secret":
39
+ return Finding(
40
+ source_type=source_type,
41
+ target=target,
42
+ severity=normalize_severity(item.get("Severity")),
43
+ vulnerability_id=item.get("RuleID") or "secret",
44
+ package=f"secret:{item.get('Category') or '-'}",
45
+ installed_version=f"line {item.get('StartLine', '?')}",
46
+ fixed_version="-",
47
+ title=item.get("Title") or "Secret detected",
48
+ primary_url="",
49
+ )
50
+ if kind == "misconfiguration":
51
+ return Finding(
52
+ source_type=source_type,
53
+ target=target,
54
+ severity=normalize_severity(item.get("Severity")),
55
+ vulnerability_id=item.get("AVDID") or item.get("ID") or "misconfig",
56
+ package=f"misconfig:{item.get('Type') or '-'}",
57
+ installed_version="-",
58
+ fixed_version="-",
59
+ title=item.get("Title") or item.get("Message") or "-",
60
+ primary_url=item.get("PrimaryURL") or "",
61
+ )
62
+ if kind == "license":
63
+ return Finding(
64
+ source_type=source_type,
65
+ target=target,
66
+ severity=normalize_severity(item.get("Severity")),
67
+ vulnerability_id=item.get("Name") or "license",
68
+ package=item.get("PkgName") or "-",
69
+ installed_version="-",
70
+ fixed_version="-",
71
+ title=f"License: {item.get('Name') or '-'}",
72
+ primary_url=item.get("Link") or "",
73
+ )
74
+ return Finding(
75
+ source_type=source_type,
76
+ target=target,
77
+ severity=normalize_severity(item.get("Severity")),
78
+ vulnerability_id=item.get("VulnerabilityID") or item.get("ID") or "-",
79
+ package=item.get("PkgName", "-"),
80
+ installed_version=item.get("InstalledVersion", "-"),
81
+ fixed_version=item.get("FixedVersion") or "-",
82
+ title=item.get("Title") or "-",
83
+ primary_url=item.get("PrimaryURL") or "",
84
+ )
85
+
86
+
87
+ def parse_trivy_accepted_risks(data: dict) -> list[AcceptedRisk]:
88
+ """Findings Trivy suppressed (ignore file, VEX, ...), from `--show-suppressed` output.
89
+
90
+ These are not in `Vulnerabilities` and are never counted as findings.
91
+ """
92
+ risks: list[AcceptedRisk] = []
93
+ if not isinstance(data, dict):
94
+ return risks
95
+ for result in data.get("Results") or []:
96
+ if not isinstance(result, dict):
97
+ continue
98
+ for key in _SUPPRESSED_KEYS:
99
+ for modified in result.get(key) or []:
100
+ if not isinstance(modified, dict) or not isinstance(modified.get("Finding"), dict):
101
+ continue
102
+ kind = str(modified.get("Type") or "vulnerability").lower()
103
+ risks.append(
104
+ AcceptedRisk(
105
+ finding=_suppressed_finding(kind, modified["Finding"], result),
106
+ status=modified.get("Status") or "ignored",
107
+ statement=modified.get("Statement") or "",
108
+ source=modified.get("Source") or "",
109
+ )
110
+ )
111
+ return risks