sec-report-kit 0.5.2__tar.gz → 0.7.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.
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/CHANGELOG.md +30 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/PKG-INFO +29 -3
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/README.md +27 -1
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/pyproject.toml +2 -2
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/__init__.py +1 -1
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/cli.py +16 -4
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/catalog.py +161 -0
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/paths.py +92 -0
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/prompts.py +401 -0
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/protocol.py +108 -0
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/resources.py +257 -0
- sec_report_kit-0.7.0/src/sec_report_kit/mcp/server.py +295 -0
- sec_report_kit-0.7.0/src/sec_report_kit/report/charts.py +490 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/report/html_renderer.py +35 -6
- sec_report_kit-0.7.0/tests/test_charts.py +202 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/tests/test_cli.py +28 -2
- sec_report_kit-0.7.0/tests/test_mcp_prompts_resources.py +191 -0
- sec_report_kit-0.7.0/tests/test_mcp_security.py +257 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/tests/test_mcp_server.py +57 -7
- sec_report_kit-0.5.2/src/sec_report_kit/mcp/server.py +0 -152
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.gitattributes +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.github/workflows/pip-audit.yml +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.github/workflows/publish-pypi.yml +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.github/workflows/publish-testpypi.yml +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.github/workflows/trivy-fs-audit.yml +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.github/workflows/unit-test-coverage-gate.yml +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/.gitignore +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/bandit-gaps-vs-sast-open-source-tools.md +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/check_assets.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/requirements.txt +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/download_safety_db.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/download_safety_db.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/download_safety_db.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/install_external_clis.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/install_tools.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/install_tools.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/mcp_add_workspace_filesystem.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/mcp_add_workspace_filesystem.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/mcp_add_workspace_filesystem_help.md +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_bandit_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_bandit_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_checkov_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_checkov_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_codeql_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_codeql_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_consolidated_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_consolidated_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_gitleaks_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_gitleaks_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_osv_scanner_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_osv_scanner_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_pip_audit_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_pip_audit_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_safety_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_safety_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_semgrep_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_semgrep_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_tfsec_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_tfsec_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_trivy_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_trivy_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_trufflehog_html.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/render_trufflehog_html.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_all_security_scans.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_all_security_scans.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_bandit.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_bandit.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_checkov.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_checkov.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_codeql.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_codeql.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_gitleaks.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_gitleaks.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_osv_scanner.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_osv_scanner.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_pip_audit.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_pip_audit.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_safety.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_safety.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_semgrep.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_semgrep.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_tfsec.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_tfsec.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_trivy.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_trivy.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_trufflehog.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_trufflehog.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_unit_tests_with_coverage.bat +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/scripts/run_unit_tests_with_coverage.sh +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/__main__.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/generate_consolidated_security_report.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/mcp/__init__.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/models.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/__init__.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/bandit.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/checkov.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/codeql.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/cyclonedx.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/gitleaks.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/osv_scanner.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/pip_audit.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/safety.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/semgrep.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/tfsec.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/trivy.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/parsers/trufflehog.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/report/__init__.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/report/sbom_renderer.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/services/__init__.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/services/normalize.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/src/sec_report_kit/services/summarize.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/tests/test_cyclonedx.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/tests/test_html_renderer.py +0 -0
- {sec_report_kit-0.5.2 → sec_report_kit-0.7.0}/tests/test_parsers.py +0 -0
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.7.0 - 2026-11-04
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- MCP prompts: `triage_scan`, `validate_scan_file`, `summarize_scan`, `render_scan_report`, `compare_scans`, `review_sbom`, `render_sbom_report` and `consolidated_security_review`. Each is a step-by-step workflow over the MCP tools with scanner-specific remediation guidance.
|
|
9
|
+
- MCP resources: `sec-report-kit://about`, `://source-types`, `://scanners`, `://scanners/{source_type}`, `://severity-model`, `://schemas/finding`, `://schemas/sbom-component` and `://cli` (a CLI reference generated from the Typer app).
|
|
10
|
+
- Titles, full descriptions and annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) on all five MCP tools.
|
|
11
|
+
- `srk mcp serve --root DIR` (repeatable) and the `SRK_MCP_ROOTS` environment variable to set the directories the MCP tools may access.
|
|
12
|
+
|
|
13
|
+
### Security
|
|
14
|
+
- MCP tools only read and write files inside the allowed roots (default: the server's working directory). Paths escaping them via `..`, absolute paths or symlinks are rejected, and reports must be written as `.html`/`.htm`. The server refuses to start with a filesystem root as its root.
|
|
15
|
+
- HTML reports only turn `http(s)` URLs from scan data into links. `javascript:`, `data:` and other schemes are rendered as plain text.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `srk mcp serve` no longer prints the ASCII banner on stdout, which corrupted the JSON-RPC stream. Other commands now print the banner to stderr.
|
|
19
|
+
- Unknown JSON-RPC methods return `-32601 Method not found` (was `-32602`), and calls to unknown tools return `-32602` as the MCP spec requires.
|
|
20
|
+
- Tool calls with unknown arguments are rejected instead of silently ignored, and invalid arguments produce short messages instead of raw pydantic validation output.
|
|
21
|
+
- Files that are neither JSON nor NDJSON produce a clear error naming the first bad line.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- The `mcp` extra now requires `mcp>=1.10.0` (needed for tool titles).
|
|
25
|
+
- MCP setups whose scan files live outside the server's working directory must now pass `--root` (required for Claude Desktop, which starts servers outside your project).
|
|
26
|
+
|
|
27
|
+
## 0.6.0 - 2026-10-03
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Analytics dashboard at the top of the consolidated report: severity and scan-category donut charts, a fix-availability meter, and severity-stacked bar charts for findings per tool, the top 10 vulnerable dependencies, and the top 10 code rules. Charts are self-contained inline SVG/HTML (no CDN, works offline) with hover/focus tooltips and table views.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- The consolidated report's per-tool cards showed 0 findings for pip-audit, Trivy, Bandit, Semgrep, CodeQL and Gitleaks, because findings were grouped by `source_type` (e.g. `codeql-sast`) instead of the tool. `render_consolidated_dashboard_report` now accepts `findings_by_tool`, which `srk render consolidated` passes.
|
|
34
|
+
|
|
5
35
|
## 0.5.2 - 2026-10-03
|
|
6
36
|
|
|
7
37
|
### Security
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sec-report-kit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.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
|
|
@@ -22,7 +22,7 @@ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
|
22
22
|
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
23
23
|
Requires-Dist: twine>=5.0.0; extra == 'dev'
|
|
24
24
|
Provides-Extra: mcp
|
|
25
|
-
Requires-Dist: mcp<2,>=1.
|
|
25
|
+
Requires-Dist: mcp<2,>=1.10.0; extra == 'mcp'
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
|
|
28
28
|
# sec-report-kit
|
|
@@ -101,6 +101,14 @@ This command writes `consolidated-security-report.html` to the output folder.
|
|
|
101
101
|
If `--output` is omitted, it defaults to the same folder passed to `--input`.
|
|
102
102
|
The consolidated renderer reads raw JSON/SARIF inputs, generates the per-tool HTML reports automatically, and then links/embeds those generated HTML files in the dashboard. You do not need to pre-render individual HTML reports first.
|
|
103
103
|
|
|
104
|
+
The top of the consolidated report is an analytics dashboard:
|
|
105
|
+
|
|
106
|
+
- Donut charts of findings by severity and by scan category (dependencies, code, secrets, IaC)
|
|
107
|
+
- The share of dependency findings that list a fixed version
|
|
108
|
+
- Stacked bar charts, split by severity, of findings per tool, the top 10 vulnerable dependencies, and the top 10 code (SAST) rules
|
|
109
|
+
|
|
110
|
+
Charts are inline SVG/HTML with no external libraries, so the report still opens offline. Hover or keyboard focus shows exact values, and every bar chart has a "View as table" option. Dependencies are counted as distinct advisories from the scanner that reports the most, because Trivy, pip-audit and Safety name the same CVE with different IDs.
|
|
111
|
+
|
|
104
112
|
Example with implicit output folder:
|
|
105
113
|
|
|
106
114
|
```bash
|
|
@@ -458,6 +466,22 @@ The vulnerability tools (`summarize_json`, `render_report_from_json`, `validate_
|
|
|
458
466
|
|
|
459
467
|
The SBOM tools (`summarize_sbom`, `render_sbom_from_json`) accept `source_type` (`"cyclonedx"` or `"auto"`) and `input_path`. `render_sbom_from_json` also takes `output_path`, `target`, and an optional `source` label.
|
|
460
468
|
|
|
469
|
+
### File access (allowed roots)
|
|
470
|
+
|
|
471
|
+
The MCP tools only read and write files inside the server's **allowed roots**. Paths that resolve outside them (via `..`, absolute paths or symlinks) are rejected, and reports can only be written as `.html`/`.htm` files. Relative paths resolve against the first root.
|
|
472
|
+
|
|
473
|
+
Roots are taken from, in order:
|
|
474
|
+
|
|
475
|
+
1. `--root <dir>` (repeatable): `srk mcp serve --root /path/to/project --root /path/to/security_reports`
|
|
476
|
+
2. the `SRK_MCP_ROOTS` environment variable (directories separated by `;` on Windows, `:` elsewhere)
|
|
477
|
+
3. the server's current working directory
|
|
478
|
+
|
|
479
|
+
The server refuses to start if the root would be a filesystem root (`/`, `C:\`). Some clients (e.g. Claude Desktop) launch servers from a system directory, so pass `--root` explicitly in those configs. The `sec-report-kit://about` resource reports the active roots.
|
|
480
|
+
|
|
481
|
+
### Prompts and resources
|
|
482
|
+
|
|
483
|
+
The server also exposes MCP prompts (`triage_scan`, `validate_scan_file`, `summarize_scan`, `render_scan_report`, `compare_scans`, `review_sbom`, `render_sbom_report`, `consolidated_security_review`) and reference resources (`sec-report-kit://about`, `://source-types`, `://scanners`, `://scanners/{source_type}`, `://severity-model`, `://schemas/finding`, `://schemas/sbom-component`, `://cli`).
|
|
484
|
+
|
|
461
485
|
---
|
|
462
486
|
|
|
463
487
|
### VS Code (GitHub Copilot Agent / MCP extension)
|
|
@@ -491,12 +515,14 @@ Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Appli
|
|
|
491
515
|
"mcpServers": {
|
|
492
516
|
"sec-report-kit": {
|
|
493
517
|
"command": "srk",
|
|
494
|
-
"args": ["mcp", "serve", "--transport", "stdio"]
|
|
518
|
+
"args": ["mcp", "serve", "--transport", "stdio", "--root", "/path/to/your/project"]
|
|
495
519
|
}
|
|
496
520
|
}
|
|
497
521
|
}
|
|
498
522
|
```
|
|
499
523
|
|
|
524
|
+
Claude Desktop does not start servers in your project folder, so `--root` is required here (see [File access](#file-access-allowed-roots)).
|
|
525
|
+
|
|
500
526
|
---
|
|
501
527
|
|
|
502
528
|
### Cursor
|
|
@@ -74,6 +74,14 @@ This command writes `consolidated-security-report.html` to the output folder.
|
|
|
74
74
|
If `--output` is omitted, it defaults to the same folder passed to `--input`.
|
|
75
75
|
The consolidated renderer reads raw JSON/SARIF inputs, generates the per-tool HTML reports automatically, and then links/embeds those generated HTML files in the dashboard. You do not need to pre-render individual HTML reports first.
|
|
76
76
|
|
|
77
|
+
The top of the consolidated report is an analytics dashboard:
|
|
78
|
+
|
|
79
|
+
- Donut charts of findings by severity and by scan category (dependencies, code, secrets, IaC)
|
|
80
|
+
- The share of dependency findings that list a fixed version
|
|
81
|
+
- Stacked bar charts, split by severity, of findings per tool, the top 10 vulnerable dependencies, and the top 10 code (SAST) rules
|
|
82
|
+
|
|
83
|
+
Charts are inline SVG/HTML with no external libraries, so the report still opens offline. Hover or keyboard focus shows exact values, and every bar chart has a "View as table" option. Dependencies are counted as distinct advisories from the scanner that reports the most, because Trivy, pip-audit and Safety name the same CVE with different IDs.
|
|
84
|
+
|
|
77
85
|
Example with implicit output folder:
|
|
78
86
|
|
|
79
87
|
```bash
|
|
@@ -431,6 +439,22 @@ The vulnerability tools (`summarize_json`, `render_report_from_json`, `validate_
|
|
|
431
439
|
|
|
432
440
|
The SBOM tools (`summarize_sbom`, `render_sbom_from_json`) accept `source_type` (`"cyclonedx"` or `"auto"`) and `input_path`. `render_sbom_from_json` also takes `output_path`, `target`, and an optional `source` label.
|
|
433
441
|
|
|
442
|
+
### File access (allowed roots)
|
|
443
|
+
|
|
444
|
+
The MCP tools only read and write files inside the server's **allowed roots**. Paths that resolve outside them (via `..`, absolute paths or symlinks) are rejected, and reports can only be written as `.html`/`.htm` files. Relative paths resolve against the first root.
|
|
445
|
+
|
|
446
|
+
Roots are taken from, in order:
|
|
447
|
+
|
|
448
|
+
1. `--root <dir>` (repeatable): `srk mcp serve --root /path/to/project --root /path/to/security_reports`
|
|
449
|
+
2. the `SRK_MCP_ROOTS` environment variable (directories separated by `;` on Windows, `:` elsewhere)
|
|
450
|
+
3. the server's current working directory
|
|
451
|
+
|
|
452
|
+
The server refuses to start if the root would be a filesystem root (`/`, `C:\`). Some clients (e.g. Claude Desktop) launch servers from a system directory, so pass `--root` explicitly in those configs. The `sec-report-kit://about` resource reports the active roots.
|
|
453
|
+
|
|
454
|
+
### Prompts and resources
|
|
455
|
+
|
|
456
|
+
The server also exposes MCP prompts (`triage_scan`, `validate_scan_file`, `summarize_scan`, `render_scan_report`, `compare_scans`, `review_sbom`, `render_sbom_report`, `consolidated_security_review`) and reference resources (`sec-report-kit://about`, `://source-types`, `://scanners`, `://scanners/{source_type}`, `://severity-model`, `://schemas/finding`, `://schemas/sbom-component`, `://cli`).
|
|
457
|
+
|
|
434
458
|
---
|
|
435
459
|
|
|
436
460
|
### VS Code (GitHub Copilot Agent / MCP extension)
|
|
@@ -464,12 +488,14 @@ Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Appli
|
|
|
464
488
|
"mcpServers": {
|
|
465
489
|
"sec-report-kit": {
|
|
466
490
|
"command": "srk",
|
|
467
|
-
"args": ["mcp", "serve", "--transport", "stdio"]
|
|
491
|
+
"args": ["mcp", "serve", "--transport", "stdio", "--root", "/path/to/your/project"]
|
|
468
492
|
}
|
|
469
493
|
}
|
|
470
494
|
}
|
|
471
495
|
```
|
|
472
496
|
|
|
497
|
+
Claude Desktop does not start servers in your project folder, so `--root` is required here (see [File access](#file-access-allowed-roots)).
|
|
498
|
+
|
|
473
499
|
---
|
|
474
500
|
|
|
475
501
|
### Cursor
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sec-report-kit"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.7.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"
|
|
@@ -28,7 +28,7 @@ dependencies = [
|
|
|
28
28
|
|
|
29
29
|
[project.optional-dependencies]
|
|
30
30
|
mcp = [
|
|
31
|
-
"mcp>=1.
|
|
31
|
+
"mcp>=1.10.0,<2",
|
|
32
32
|
]
|
|
33
33
|
dev = [
|
|
34
34
|
"pytest>=8.0.0",
|
|
@@ -463,6 +463,7 @@ def render_consolidated(
|
|
|
463
463
|
modified_since=since_dt,
|
|
464
464
|
modified_until=until_dt,
|
|
465
465
|
included_sources=included_sources,
|
|
466
|
+
findings_by_tool=findings_by_parser,
|
|
466
467
|
)
|
|
467
468
|
output_file = output / "consolidated-security-report.html"
|
|
468
469
|
output_file.write_text(report_html, encoding="utf-8")
|
|
@@ -483,12 +484,20 @@ def render_consolidated(
|
|
|
483
484
|
|
|
484
485
|
@mcp_app.command("serve")
|
|
485
486
|
def serve_mcp(
|
|
486
|
-
transport: str = typer.Option("stdio", "--transport", help="MCP transport (currently stdio)")
|
|
487
|
+
transport: str = typer.Option("stdio", "--transport", help="MCP transport (currently stdio)"),
|
|
488
|
+
root: list[Path] = typer.Option(
|
|
489
|
+
[],
|
|
490
|
+
"--root",
|
|
491
|
+
file_okay=False,
|
|
492
|
+
dir_okay=True,
|
|
493
|
+
help="Directory the MCP tools may read from and write to (repeatable). "
|
|
494
|
+
"Defaults to $SRK_MCP_ROOTS, then the current directory.",
|
|
495
|
+
),
|
|
487
496
|
) -> None:
|
|
488
497
|
"""Run the MCP server."""
|
|
489
498
|
from sec_report_kit.mcp.server import run_server
|
|
490
499
|
|
|
491
|
-
run_server(transport=transport)
|
|
500
|
+
run_server(transport=transport, roots=root or None)
|
|
492
501
|
|
|
493
502
|
|
|
494
503
|
ASCII_BANNER = """
|
|
@@ -501,8 +510,11 @@ ASCII_BANNER = """
|
|
|
501
510
|
|
|
502
511
|
|
|
503
512
|
def main() -> None:
|
|
504
|
-
|
|
505
|
-
|
|
513
|
+
args = sys.argv[1:]
|
|
514
|
+
# The banner is decoration: keep it off stdout (so piped output stays clean)
|
|
515
|
+
# and suppress it entirely for `mcp`, where stdout carries the JSON-RPC stream.
|
|
516
|
+
if not any(flag in args for flag in ("--help", "-h", "--version")) and "mcp" not in args[:1]:
|
|
517
|
+
typer.echo(ASCII_BANNER, err=True)
|
|
506
518
|
app()
|
|
507
519
|
|
|
508
520
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"""Scanner metadata shared by the MCP prompts and resources.
|
|
2
|
+
|
|
3
|
+
Kept in one place so the guidance a prompt gives and the data a resource
|
|
4
|
+
exposes cannot drift apart. Labels and categories come from the dashboard
|
|
5
|
+
(`report.charts`) so the MCP view matches the HTML report.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
|
|
12
|
+
from sec_report_kit.report.charts import TOOL_CATEGORIES, TOOL_LABELS
|
|
13
|
+
|
|
14
|
+
_DEPENDENCY = (
|
|
15
|
+
"Dependency vulnerabilities (known CVEs/advisories in third-party packages). "
|
|
16
|
+
"Fix by upgrading each package to the fixed version shown in the report; when "
|
|
17
|
+
"the vulnerable package is transitive, upgrade the direct dependency that pulls "
|
|
18
|
+
"it in. A finding with no fixed version needs a decision: replace the package, "
|
|
19
|
+
"mitigate it, or formally accept the risk."
|
|
20
|
+
)
|
|
21
|
+
_SAST = (
|
|
22
|
+
"Static analysis (SAST) findings: insecure code patterns in first-party source. "
|
|
23
|
+
"Fix the code at the reported location. Check each one for false positives "
|
|
24
|
+
"(test code, unreachable paths, inputs that are already validated) before "
|
|
25
|
+
"recommending a change, and say why you think a finding is real or not."
|
|
26
|
+
)
|
|
27
|
+
_SECRETS = (
|
|
28
|
+
"Leaked secrets (API keys, tokens, passwords, private keys) in files or git "
|
|
29
|
+
"history. Treat every confirmed secret as compromised: revoke or rotate it at "
|
|
30
|
+
"the provider FIRST, then remove it from the code and history, then add "
|
|
31
|
+
"prevention (pre-commit hook, secret manager). Never repeat a secret value in "
|
|
32
|
+
"your answer."
|
|
33
|
+
)
|
|
34
|
+
_IAC = (
|
|
35
|
+
"Infrastructure-as-code misconfigurations (Terraform, CloudFormation, Kubernetes, "
|
|
36
|
+
"etc.). Fix the resource configuration named by the policy/check ID. Weigh "
|
|
37
|
+
"internet exposure, encryption and IAM issues above hygiene checks."
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
CATEGORY_GUIDANCE = {
|
|
41
|
+
"Dependencies": _DEPENDENCY,
|
|
42
|
+
"Code": _SAST,
|
|
43
|
+
"Secrets": _SECRETS,
|
|
44
|
+
"IaC": _IAC,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True)
|
|
49
|
+
class ScannerInfo:
|
|
50
|
+
source_type: str
|
|
51
|
+
summary: str
|
|
52
|
+
json_command: str
|
|
53
|
+
input_formats: tuple[str, ...] = ("json",)
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def label(self) -> str:
|
|
57
|
+
return TOOL_LABELS[self.source_type]
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def category(self) -> str:
|
|
61
|
+
return TOOL_CATEGORIES[self.source_type]
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def guidance(self) -> str:
|
|
65
|
+
return f"{self.label}: {self.summary} {CATEGORY_GUIDANCE[self.category]}"
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def report_filename(self) -> str:
|
|
69
|
+
return f"{self.source_type}-report.html"
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> dict:
|
|
72
|
+
return {
|
|
73
|
+
"source_type": self.source_type,
|
|
74
|
+
"label": self.label,
|
|
75
|
+
"category": self.category,
|
|
76
|
+
"summary": self.summary,
|
|
77
|
+
"remediation_guidance": CATEGORY_GUIDANCE[self.category],
|
|
78
|
+
"input_formats": list(self.input_formats),
|
|
79
|
+
"produce_json": self.json_command,
|
|
80
|
+
"render_command": (
|
|
81
|
+
f"srk render {self.source_type} --input <file> --output <report.html> "
|
|
82
|
+
"--target <label>"
|
|
83
|
+
),
|
|
84
|
+
"consolidated_report_filename": self.report_filename,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Commands mirror scripts/run_<tool>.sh; placeholders are in <angle brackets>.
|
|
89
|
+
SCANNERS: dict[str, ScannerInfo] = {
|
|
90
|
+
s.source_type: s
|
|
91
|
+
for s in (
|
|
92
|
+
ScannerInfo(
|
|
93
|
+
"trivy",
|
|
94
|
+
"container image, OS package and language dependency vulnerabilities. "
|
|
95
|
+
"OS-package findings are usually fixed by rebuilding on a newer or slimmer "
|
|
96
|
+
"base image; language-package findings by upgrading the package.",
|
|
97
|
+
"trivy image --format json --output trivy.json <image>",
|
|
98
|
+
),
|
|
99
|
+
ScannerInfo(
|
|
100
|
+
"pip-audit",
|
|
101
|
+
"Python dependency advisories from PyPI.",
|
|
102
|
+
"pip-audit -r requirements.txt -f json -o pip-audit.json",
|
|
103
|
+
),
|
|
104
|
+
ScannerInfo(
|
|
105
|
+
"safety",
|
|
106
|
+
"Python dependency advisories from the Safety database.",
|
|
107
|
+
"safety check --json --file requirements.txt --save-json safety.json",
|
|
108
|
+
),
|
|
109
|
+
ScannerInfo(
|
|
110
|
+
"osv-scanner",
|
|
111
|
+
"multi-ecosystem dependency advisories from OSV.dev.",
|
|
112
|
+
"osv-scanner scan --recursive <path> --format json --output osv-scanner.json",
|
|
113
|
+
),
|
|
114
|
+
ScannerInfo(
|
|
115
|
+
"bandit",
|
|
116
|
+
"Python static analysis.",
|
|
117
|
+
"bandit -r <path> -f json -o bandit.json",
|
|
118
|
+
),
|
|
119
|
+
ScannerInfo(
|
|
120
|
+
"semgrep",
|
|
121
|
+
"multi-language static analysis.",
|
|
122
|
+
"semgrep scan --config auto --json --output semgrep.json <path>",
|
|
123
|
+
),
|
|
124
|
+
ScannerInfo(
|
|
125
|
+
"codeql",
|
|
126
|
+
"dataflow-aware static analysis, read from SARIF.",
|
|
127
|
+
"codeql database analyze <database> <query-suite> --format=sarifv2.1.0 "
|
|
128
|
+
"--output=codeql.sarif.json",
|
|
129
|
+
("sarif", "sarif.json", "json"),
|
|
130
|
+
),
|
|
131
|
+
ScannerInfo(
|
|
132
|
+
"gitleaks",
|
|
133
|
+
"secret detection in files and git history.",
|
|
134
|
+
"gitleaks detect --source <path> --report-format json --report-path gitleaks.json",
|
|
135
|
+
),
|
|
136
|
+
ScannerInfo(
|
|
137
|
+
"trufflehog",
|
|
138
|
+
"secret detection, sometimes with live verification of the credential.",
|
|
139
|
+
"trufflehog filesystem <path> --json > trufflehog.json",
|
|
140
|
+
("ndjson", "jsonl", "json"),
|
|
141
|
+
),
|
|
142
|
+
ScannerInfo(
|
|
143
|
+
"checkov",
|
|
144
|
+
"IaC policy checks across Terraform, CloudFormation, Kubernetes and more.",
|
|
145
|
+
"checkov -d <path> -o json > checkov.json",
|
|
146
|
+
),
|
|
147
|
+
ScannerInfo(
|
|
148
|
+
"tfsec",
|
|
149
|
+
"Terraform security checks.",
|
|
150
|
+
"tfsec <path> --format json --out tfsec.json",
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
FINDING_SOURCE_TYPES = tuple(SCANNERS)
|
|
156
|
+
SBOM_SOURCE_TYPES = ("cyclonedx",)
|
|
157
|
+
|
|
158
|
+
SBOM_JSON_COMMANDS = (
|
|
159
|
+
"trivy image --format cyclonedx --output bom.cdx.json <image>",
|
|
160
|
+
"syft <target> -o cyclonedx-json > bom.cdx.json",
|
|
161
|
+
)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Filesystem confinement for the MCP server.
|
|
2
|
+
|
|
3
|
+
MCP tool arguments come from a model that may be steered by untrusted content
|
|
4
|
+
(including the scan files themselves), so every path a tool reads or writes is
|
|
5
|
+
resolved (following symlinks and ``..``) and must land inside one of the
|
|
6
|
+
configured root directories.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Iterable
|
|
14
|
+
|
|
15
|
+
ROOTS_ENV_VAR = "SRK_MCP_ROOTS"
|
|
16
|
+
OUTPUT_SUFFIXES = (".html", ".htm")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PathPolicyError(ValueError):
|
|
20
|
+
"""A path argument was rejected by the policy."""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _norm(path: Path) -> str:
|
|
24
|
+
return os.path.normcase(str(path))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PathPolicy:
|
|
28
|
+
def __init__(self, roots: Iterable[str | Path]):
|
|
29
|
+
resolved: list[Path] = []
|
|
30
|
+
for root in roots:
|
|
31
|
+
path = Path(root).expanduser().resolve()
|
|
32
|
+
if not path.is_dir():
|
|
33
|
+
raise PathPolicyError(f"MCP root is not an existing directory: {path}")
|
|
34
|
+
if path == Path(path.anchor):
|
|
35
|
+
raise PathPolicyError(
|
|
36
|
+
f"Refusing to use filesystem root {path} as the MCP root: it would expose "
|
|
37
|
+
"the whole drive. Pass --root <project dir> or set "
|
|
38
|
+
f"{ROOTS_ENV_VAR}."
|
|
39
|
+
)
|
|
40
|
+
resolved.append(path)
|
|
41
|
+
if not resolved:
|
|
42
|
+
raise PathPolicyError("At least one MCP root directory is required.")
|
|
43
|
+
self.roots: tuple[Path, ...] = tuple(resolved)
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def from_config(cls, roots: Iterable[str | Path] | None = None) -> "PathPolicy":
|
|
47
|
+
"""Explicit roots win, then $SRK_MCP_ROOTS (os.pathsep-separated), then the cwd."""
|
|
48
|
+
explicit = [r for r in (roots or []) if str(r).strip()]
|
|
49
|
+
if explicit:
|
|
50
|
+
return cls(explicit)
|
|
51
|
+
env = [p for p in os.environ.get(ROOTS_ENV_VAR, "").split(os.pathsep) if p.strip()]
|
|
52
|
+
if env:
|
|
53
|
+
return cls(env)
|
|
54
|
+
return cls([Path.cwd()])
|
|
55
|
+
|
|
56
|
+
def describe(self) -> str:
|
|
57
|
+
return ", ".join(str(r) for r in self.roots)
|
|
58
|
+
|
|
59
|
+
def _resolve_inside(self, raw: str, arg_name: str) -> Path:
|
|
60
|
+
if not isinstance(raw, str) or not raw.strip():
|
|
61
|
+
raise PathPolicyError(f"{arg_name} must be a non-empty path")
|
|
62
|
+
candidate = Path(raw).expanduser()
|
|
63
|
+
if not candidate.is_absolute():
|
|
64
|
+
# Relative paths are relative to the first root, never the process cwd.
|
|
65
|
+
candidate = self.roots[0] / candidate
|
|
66
|
+
resolved = candidate.resolve()
|
|
67
|
+
target = _norm(resolved)
|
|
68
|
+
for root in self.roots:
|
|
69
|
+
base = _norm(root)
|
|
70
|
+
try:
|
|
71
|
+
inside = os.path.commonpath([base, target]) == base
|
|
72
|
+
except ValueError: # different drives on Windows
|
|
73
|
+
inside = False
|
|
74
|
+
if inside:
|
|
75
|
+
return resolved
|
|
76
|
+
raise PathPolicyError(
|
|
77
|
+
f"{arg_name} {raw!r} is outside the allowed directories ({self.describe()})"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def input_file(self, raw: str, arg_name: str = "input_path") -> Path:
|
|
81
|
+
path = self._resolve_inside(raw, arg_name)
|
|
82
|
+
if not path.is_file():
|
|
83
|
+
raise PathPolicyError(f"{arg_name} {raw!r} does not exist or is not a file")
|
|
84
|
+
return path
|
|
85
|
+
|
|
86
|
+
def output_file(self, raw: str, arg_name: str = "output_path") -> Path:
|
|
87
|
+
path = self._resolve_inside(raw, arg_name)
|
|
88
|
+
if path.suffix.lower() not in OUTPUT_SUFFIXES:
|
|
89
|
+
raise PathPolicyError(f"{arg_name} must end in .html or .htm, got {raw!r}")
|
|
90
|
+
if path.exists() and not path.is_file():
|
|
91
|
+
raise PathPolicyError(f"{arg_name} {raw!r} exists and is not a regular file")
|
|
92
|
+
return path
|