granttrace 2.4.0__tar.gz → 2.5.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 (86) hide show
  1. {granttrace-2.4.0 → granttrace-2.5.0}/CHANGELOG.md +101 -0
  2. {granttrace-2.4.0 → granttrace-2.5.0}/CONTRIBUTING.md +1 -1
  3. {granttrace-2.4.0/granttrace.egg-info → granttrace-2.5.0}/PKG-INFO +68 -21
  4. granttrace-2.5.0/README.md +128 -0
  5. {granttrace-2.4.0 → granttrace-2.5.0}/VERIFICATION.md +167 -0
  6. {granttrace-2.4.0 → granttrace-2.5.0}/api_sentinel.py +226 -23
  7. {granttrace-2.4.0 → granttrace-2.5.0}/core/__init__.py +1 -1
  8. {granttrace-2.4.0 → granttrace-2.5.0}/core/auditor.py +12 -6
  9. {granttrace-2.4.0 → granttrace-2.5.0}/core/config_validator.py +4 -1
  10. granttrace-2.5.0/core/demo.py +235 -0
  11. granttrace-2.5.0/core/demo_assets/__init__.py +1 -0
  12. granttrace-2.5.0/core/demo_assets/demo-config.json +82 -0
  13. granttrace-2.5.0/core/demo_assets/mock-data.json +40 -0
  14. granttrace-2.5.0/core/demo_assets/openapi.json +278 -0
  15. {granttrace-2.4.0 → granttrace-2.5.0}/core/evidence.py +12 -12
  16. {granttrace-2.4.0 → granttrace-2.5.0}/core/generator.py +3 -3
  17. granttrace-2.5.0/core/onboarding.py +166 -0
  18. {granttrace-2.4.0 → granttrace-2.5.0}/core/parameters.py +2 -2
  19. {granttrace-2.4.0 → granttrace-2.5.0}/core/parser.py +8 -8
  20. {granttrace-2.4.0 → granttrace-2.5.0}/core/reporter.py +78 -1
  21. granttrace-2.5.0/core/reproduction.py +231 -0
  22. granttrace-2.5.0/core/sarif.py +186 -0
  23. granttrace-2.5.0/docs/advanced.md +180 -0
  24. granttrace-2.5.0/docs/configuration.md +137 -0
  25. granttrace-2.5.0/docs/release-checklist.md +282 -0
  26. {granttrace-2.4.0 → granttrace-2.5.0}/examples/README.md +5 -3
  27. {granttrace-2.4.0 → granttrace-2.5.0}/examples/sample_report.html +152 -91
  28. {granttrace-2.4.0 → granttrace-2.5.0}/examples/sample_result.json +97 -95
  29. {granttrace-2.4.0 → granttrace-2.5.0/granttrace.egg-info}/PKG-INFO +68 -21
  30. {granttrace-2.4.0 → granttrace-2.5.0}/granttrace.egg-info/SOURCES.txt +16 -0
  31. {granttrace-2.4.0 → granttrace-2.5.0}/pyproject.toml +6 -2
  32. {granttrace-2.4.0 → granttrace-2.5.0}/scripts/verify_install.py +66 -0
  33. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_config_validation.py +3 -1
  34. granttrace-2.5.0/tests/test_curl_report.py +443 -0
  35. granttrace-2.5.0/tests/test_demo.py +501 -0
  36. granttrace-2.5.0/tests/test_first_run_guidance.py +162 -0
  37. granttrace-2.5.0/tests/test_onboarding.py +241 -0
  38. granttrace-2.5.0/tests/test_onboarding_cli.py +645 -0
  39. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_rc2_security_hardening.py +1 -1
  40. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_report_usability.py +2 -1
  41. granttrace-2.5.0/tests/test_reproduction.py +365 -0
  42. granttrace-2.5.0/tests/test_sarif.py +410 -0
  43. granttrace-2.5.0/tests/test_sarif_cli.py +269 -0
  44. granttrace-2.4.0/README.md +0 -81
  45. granttrace-2.4.0/docs/advanced.md +0 -59
  46. granttrace-2.4.0/docs/configuration.md +0 -104
  47. granttrace-2.4.0/docs/release-checklist.md +0 -74
  48. {granttrace-2.4.0 → granttrace-2.5.0}/LICENSE +0 -0
  49. {granttrace-2.4.0 → granttrace-2.5.0}/MANIFEST.in +0 -0
  50. {granttrace-2.4.0 → granttrace-2.5.0}/SECURITY.md +0 -0
  51. {granttrace-2.4.0 → granttrace-2.5.0}/config.example.json +0 -0
  52. {granttrace-2.4.0 → granttrace-2.5.0}/config.schema.json +0 -0
  53. {granttrace-2.4.0 → granttrace-2.5.0}/core/config_scaffold.py +0 -0
  54. {granttrace-2.4.0 → granttrace-2.5.0}/core/diff.py +0 -0
  55. {granttrace-2.4.0 → granttrace-2.5.0}/core/models.py +0 -0
  56. {granttrace-2.4.0 → granttrace-2.5.0}/core/transactions.py +0 -0
  57. {granttrace-2.4.0 → granttrace-2.5.0}/docs/assets/report-preview.png +0 -0
  58. {granttrace-2.4.0 → granttrace-2.5.0}/docs/business-scenarios.md +0 -0
  59. {granttrace-2.4.0 → granttrace-2.5.0}/docs/parameter-serialization.md +0 -0
  60. {granttrace-2.4.0 → granttrace-2.5.0}/granttrace.egg-info/dependency_links.txt +0 -0
  61. {granttrace-2.4.0 → granttrace-2.5.0}/granttrace.egg-info/entry_points.txt +0 -0
  62. {granttrace-2.4.0 → granttrace-2.5.0}/granttrace.egg-info/requires.txt +0 -0
  63. {granttrace-2.4.0 → granttrace-2.5.0}/granttrace.egg-info/top_level.txt +0 -0
  64. {granttrace-2.4.0 → granttrace-2.5.0}/mock_server/__init__.py +0 -0
  65. {granttrace-2.4.0 → granttrace-2.5.0}/mock_server/server.py +0 -0
  66. {granttrace-2.4.0 → granttrace-2.5.0}/openapi.json +0 -0
  67. {granttrace-2.4.0 → granttrace-2.5.0}/scripts/verify_business_scenarios.py +0 -0
  68. {granttrace-2.4.0 → granttrace-2.5.0}/scripts/verify_examples.py +0 -0
  69. {granttrace-2.4.0 → granttrace-2.5.0}/setup.cfg +0 -0
  70. {granttrace-2.4.0 → granttrace-2.5.0}/test_suite.py +0 -0
  71. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_auditor_integration.py +0 -0
  72. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_business_authorization.py +0 -0
  73. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_config_scaffold.py +0 -0
  74. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_diff.py +0 -0
  75. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_diff_hardening.py +0 -0
  76. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_evidence.py +0 -0
  77. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_parameter_serialization.py +0 -0
  78. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_parser_generator_hardening.py +0 -0
  79. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_rc3_hardening.py +0 -0
  80. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_release_bola.py +0 -0
  81. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_release_config.py +0 -0
  82. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_release_evidence.py +0 -0
  83. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_release_identity.py +0 -0
  84. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_release_transactions.py +0 -0
  85. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_schema_regressions.py +0 -0
  86. {granttrace-2.4.0 → granttrace-2.5.0}/tests/test_v22_auditor_hardening.py +0 -0
@@ -1,5 +1,106 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.5.0 - 2026-10-04
4
+
5
+ ### Added
6
+
7
+ - Export SARIF 2.1.0 with `--export-sarif`, alongside HTML and JSON reports.
8
+ Only existing CONFIRMED findings produce results: BOLA / IDOR maps to
9
+ `GT-BOLA-001` / `CWE-639`, and Mass Assignment to `GT-MASS-001` / `CWE-915`.
10
+ A safely represented OpenAPI file inside the workspace supplies the artifact
11
+ location for GitHub Code Scanning; no source lines or endpoint files are invented.
12
+ - Add safe cURL reproduction templates and copy buttons to confirmed HTML finding
13
+ cards. Use the actual tested URL and confirmed injected payload where safe,
14
+ Visitor credential placeholders, POSIX shell quoting and `curl --globoff`.
15
+ Clipboard fallback supports offline reports; manual selection works without
16
+ JavaScript. Real credentials never enter the templates, including when sensitive
17
+ report evidence is enabled.
18
+ - Guide configuration onboarding from draft generation and manual review through
19
+ validation, a local dry-run and a read-only first real scan. Distinguish
20
+ config-only from spec-aware validation, summarize dry-run counts, and format
21
+ next-step commands safely for POSIX shells or PowerShell.
22
+
23
+ ### Changed
24
+
25
+ - Align README, configuration and advanced guidance with the first API onboarding
26
+ flow and the SARIF / cURL outputs, without changing configuration formats.
27
+ - Explain validation scope, warnings and dry-run write eligibility more clearly.
28
+ An active PATCH configuration is separate from enabling active execution;
29
+ the recommended first real scan remains read-only.
30
+ - Promote the release source to `2.5.0` across package metadata, runtime version
31
+ and generated examples; prepare the release checklist and OIDC workflow for
32
+ the new tag without publishing it during release preparation.
33
+
34
+ ### Security / Safety
35
+
36
+ - Preserve BOLA / IDOR verdicts and Mass Assignment detection criteria, default
37
+ read-only auditing, and the existing TLS / HTTP / redirect / proxy boundaries.
38
+ - Active PATCH still requires explicit `--allow-write-tests`, an explicit write
39
+ allowlist, independent GET readback, original-state snapshots, rollback and
40
+ rollback verification. Failed recovery still halts further writes.
41
+ - SARIF, cURL templates and onboarding output do not expose real credentials;
42
+ onboarding also omits configured resource values. Workspace-external specs
43
+ never expose absolute local paths in SARIF.
44
+ - Validation and dry-run remain offline; dry-run sends zero requests. No active
45
+ POST / PUT testing or automated OAuth / login is added.
46
+
47
+ ### Quality
48
+
49
+ - Retain the 486-test baseline, Python 3.9 / 3.12 / 3.14 CI, blocking mypy and Ruff,
50
+ Runtime dependency audit, CodeQL and the branch-aware coverage gate of 80%.
51
+ - Fresh release-prep acceptance passes all 486 tests with **82.78%** branch-aware
52
+ local coverage, mypy reporting no issues in 18 source files, Ruff and the runtime
53
+ dependency audit. All six bundled business scenarios match their expected
54
+ outcomes; JSON / YAML scans restore the full mock database. A fresh wheel
55
+ installed outside the checkout passes both demo modes and verifies version
56
+ `2.5.0`, read-only 0 PATCH, active rollback and local server shutdown. See
57
+ [VERIFICATION.md](VERIFICATION.md) for the exact scope and remote check results.
58
+
59
+ ## 2.4.1 - 2026-10-03
60
+
61
+ ### Added
62
+
63
+ - Add `granttrace demo` with packaged OpenAPI, configuration and fictional mock
64
+ data, so an installed wheel can demonstrate identity comparison, BOLA / IDOR,
65
+ Mass Assignment, independent readback and rollback verification outside a Git
66
+ checkout without user credentials or external API access.
67
+ - Start the disposable mock on a dynamic loopback port, close it on completion
68
+ or failure, and retain HTML / JSON reports in a unique output directory.
69
+ - Add `--output-dir` and optional `--read-only` controls for the built-in demo.
70
+
71
+ ### Changed
72
+
73
+ - Put the single-command installed-package demo before the source-checkout
74
+ walkthrough and retain configuration onboarding and safety boundaries. During
75
+ release preparation, distinguish the upcoming package from the published stable
76
+ version and do not claim an unpublished PyPI release is available.
77
+ - Give missing spec/config files and offline configuration failures a concise
78
+ next step; an empty write allowlist still sends no PATCH requests.
79
+ - Promote the 2.4.1.dev0 development package to 2.4.1 consistently across runtime,
80
+ package metadata and generated reports; update the release acceptance checklist.
81
+
82
+ ### Quality
83
+
84
+ - Resolve the existing 20 mypy errors in six files using accurate annotations and
85
+ type narrowing, without new suppression directives or weaker mypy settings.
86
+ - Make mypy a blocking CI check and add a minimum 80% branch-aware coverage gate.
87
+ - Add weekly Dependabot checks for pip dependencies and GitHub Actions, without
88
+ automatic merging; exclude the release workflow from dependency updates.
89
+ - Verify installed demo resources, source-independent startup, both demo modes,
90
+ complete database restoration and local server shutdown.
91
+
92
+ ### Security / Safety
93
+
94
+ - The demo accepts no external target or user credentials. Its active PATCH checks
95
+ run only against bundled, disposable data on a dynamic `127.0.0.1` server.
96
+ - Keep auditing users' own APIs read-only by default; `granttrace demo --read-only`
97
+ sends no PATCH requests.
98
+ - Preserve the BOLA / IDOR and Mass Assignment detection criteria, explicit write
99
+ allowlists, independent GET readback, original-state snapshots and rollback
100
+ verification. Failed recovery still blocks subsequent writes.
101
+ - Keep the existing `granttrace --spec ...` CLI, TLS / HTTP / redirect / proxy
102
+ safety boundaries and evidence minimisation unchanged.
103
+
3
104
  ## 2.4.0 - 2026-10-03
4
105
 
5
106
  ### Added
@@ -28,7 +28,7 @@ python -m coverage xml
28
28
  python -m coverage json
29
29
  ```
30
30
 
31
- Mypy is advisory while existing dynamic JSON type issues are tracked:
31
+ Mypy is a blocking CI check and must report zero errors; coverage must be at least 80%:
32
32
 
33
33
  ```bash
34
34
  python -m mypy
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: granttrace
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Summary: Safety-first OpenAPI authorization auditing tool for BOLA, IDOR and Mass Assignment testing
5
5
  Author: GrantTrace contributors
6
6
  License-Expression: Apache-2.0
@@ -31,7 +31,7 @@ Dynamic: license-file
31
31
  ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
32
32
  ![License](https://img.shields.io/badge/license-Apache--2.0-green)
33
33
 
34
- **Stable:** [v2.4.0](https://github.com/ysc070528/granttrace/releases/tag/v2.4.0)
34
+ **Release source:** v2.5.0 · [GitHub Releases](https://github.com/ysc070528/granttrace/releases) · [PyPI](https://pypi.org/project/granttrace/)
35
35
 
36
36
  An OpenAPI authorization auditor that compares identities, verifies persisted changes, and reports restoration evidence.
37
37
 
@@ -49,49 +49,96 @@ An OpenAPI authorization auditor that compares identities, verifies persisted ch
49
49
 
50
50
  ## 五分钟体验
51
51
 
52
- 需要 Python 3.9+。在终端中克隆、安装并启动本机演示服务:
52
+ 需要 Python 3.9+。最新发布与可安装版本以 [GitHub Releases](https://github.com/ysc070528/granttrace/releases) 和 [PyPI](https://pypi.org/project/granttrace/) 为准。安装包包含内置 `granttrace demo`,首次体验只需:
53
53
 
54
54
  ```bash
55
- git clone https://github.com/ysc070528/granttrace.git
56
- cd granttrace
57
- python -m pip install -e .
58
- python mock_server/server.py
55
+ python -m pip install --upgrade granttrace
56
+ granttrace --version
57
+ granttrace demo
59
58
  ```
60
59
 
61
- 另开终端,进入同一目录执行首次只读扫描:
60
+ 安装后可在任意目录运行,无需 clone、准备配置、另开终端或访问外部 API。Demo 自动启动动态端口的 `127.0.0.1` 靶场,比较身份访问、演示 BOLA / IDOR 与 Mass Assignment,并通过独立读回与恢复核验展示 PATCH 测试证据。**主动写操作仅发生在内置、可丢弃的本机靶场**;demo 不接受外部 target 或用户凭据,结束时关闭靶场。
61
+
62
+ HTML / JSON 报告保留在当前目录的 `granttrace-demo/` 唯一子目录,终端会输出绝对路径,不覆盖已有报告。可选用 `granttrace demo --output-dir PATH` 指定报告父目录,或 `granttrace demo --read-only` 仅体验只读身份访问,发送 **0 PATCH**。
63
+
64
+ 完整离线示例:[HTML 报告](examples/sample_report.html)(下载后用浏览器打开)与 [JSON 结果](examples/sample_result.json)。
65
+
66
+ ## 接入自己的 API
67
+
68
+ 推荐按以下顺序首次接入;前四步只处理本地文件:
69
+
70
+ 1. **生成草稿和清单**:
62
71
 
63
72
  ```bash
64
- granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --export-json result.local.json
73
+ granttrace --spec your-openapi.yaml --init-config config.local.json
65
74
  ```
66
75
 
67
- 用浏览器打开默认生成的 **`granttrace_report.html`**:先查看发现与修复建议,再按状态筛选端点、展开证据。预期结果为 **1 个 CONFIRMED、1 个 PUBLIC、1 个 SECURE、2 个 SKIPPED**,确定性覆盖率 **60%**。两个 PATCH 因默认只读而跳过。JSON 结果写入 `result.local.json`;两个本地产物均由 `.gitignore` 忽略。
76
+ 2. **人工填写并核对**:打开配置和 checklist,填写不同的 Owner / Visitor 测试账户、可丢弃资源与业务授权预期。候选 PATCH 字段和 GET 路径只是接口合同提示;确认所需读回映射,删除不用的读回草稿,替换全部 `__GRANTTRACE_INPUT__:` 占位值,最后移除 `_granttrace_draft`。草稿未完成时会阻止验证、计划与扫描;`write_allowlist` 默认为空。
68
77
 
69
- 在这个可丢弃的本地靶场体验写测试和恢复核验:
78
+ 3. **离线验证配置与规范**,检查终端中的 scope、模式、警告和下一步:
70
79
 
71
80
  ```bash
72
- granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --allow-write-tests --export-json result.local.json
81
+ granttrace --spec your-openapi.yaml --config config.local.json --validate-config
73
82
  ```
74
83
 
75
- 再次打开 **`granttrace_report.html`**。预期 **2 个 CONFIRMED、1 个 PUBLIC、2 个 SECURE**,确定性覆盖率 **100%**,批量赋值发现的 `rollback_verified` 为 `true`。本次扫描更新同名 HTML / JSON 文件;这些结果只属于内置五个演示端点。
84
+ 4. **生成并人工检查本地计划**;dry-run 发送 **0 请求**:
76
85
 
77
- 完整离线示例:[HTML 报告](examples/sample_report.html)(下载后用浏览器打开)与 [JSON 结果](examples/sample_result.json)。
86
+ ```bash
87
+ granttrace --spec your-openapi.yaml --config config.local.json --dry-run --export-json plan.local.json
88
+ ```
78
89
 
79
- ## 接入自己的 API
90
+ 5. **第一次真实扫描保持只读**:确认计划后,将下例地址替换为已授权的测试目标;这一步会发送读取请求,默认 **0 PATCH**。
91
+
92
+ ```bash
93
+ granttrace --spec your-openapi.yaml --target https://authorized-test.example \
94
+ --config config.local.json --export-json result.local.json
95
+ ```
96
+
97
+ 6. **以后需要时再考虑主动 PATCH**:只有在专用可丢弃资源、独立 GET readback、字段映射、一致性和恢复路径均经人工确认后,才配置明确的 `write_allowlist` 并在真实扫描中单独添加 `--allow-write-tests`。允许清单存在不表示写测试已开启,运行时仍须满足写入与恢复条件。
80
98
 
81
- 先从规范生成配置草稿和待填清单:
99
+ OpenAPI 和离线验证不能证明资源归属、业务授权策略、合法测试权限、生产读回一致性或实际恢复能力;检查通过只代表配置结构及支持的语义通过当前检查。账户、API Key / Cookie、合法共享和管理员访问见 [配置指南](docs/configuration.md),输出与自动化兼容性见 [命令行说明](docs/advanced.md)。支持的数组、布尔值及 `style` / `explode` 编码见 [参数规则](docs/parameter-serialization.md)。接入实测前请核对 [安全边界](SECURITY.md)。
100
+
101
+ ## SARIF 导出
102
+
103
+ `--export-sarif PATH` 可与 HTML / JSON 同时使用:
82
104
 
83
105
  ```bash
84
- granttrace --spec your-openapi.yaml --init-config config.local.json
106
+ granttrace --spec your-openapi.yaml --config config.local.json \
107
+ --export-json result.local.json --export-sarif granttrace.sarif -o report.html
85
108
  ```
86
109
 
87
- 填写不同的测试账户、各自资源、授权预期和必要读回信息,再按清单移除草稿标记与全部占位值。草稿未完成时会阻止预检、计划与扫描;写允许清单默认为空。
110
+ SARIF 2.1.0 **只包含 CONFIRMED 的 BOLA / IDOR 与 Mass Assignment**;SUSPICIOUS / INCONCLUSIVE 不升级为漏洞,完整状态仍见 HTML / JSON。SARIF 始终脱敏且不导出原始响应或 headers,不能与 `--dry-run` 同用;各输出路径须独立。当前工作目录内的真实 OpenAPI spec 会作为相对 artifact location,不伪造源码行号,API endpoint 仍放在 message / properties。在 GitHub Actions 中从 checkout 的仓库根目录运行,再用 `upload-sarif` 上传;workspace 外的 spec 省略 location,绝不导出本机绝对路径,其结果无法展示为 GitHub Code Scanning alert。详见 [兼容说明](docs/advanced.md#sarif-导出)。
111
+
112
+ ## cURL 复现模板
113
+
114
+ HTML 确认漏洞卡片可提供安全的 POSIX shell cURL 模板和“复制 cURL”按钮。所有认证值均为 Visitor 占位符,即使使用 `--include-sensitive-evidence` 也不会放入模板。请只在明确授权的测试环境中填入自己的测试凭据;脱敏值需人工补全,信息不足时不提供按钮。离线报告支持复制 fallback,也可直接选择命令文本。详见 [复现说明](docs/advanced.md#curl-复现模板)。
115
+
116
+ ## 从源码开发 / 运行仓库 mock
117
+
118
+ 需要查看源码或手工运行仓库靶场时:
88
119
 
89
120
  ```bash
90
- granttrace --spec your-openapi.yaml --config config.local.json --validate-config
91
- granttrace --spec your-openapi.yaml --config config.local.json --dry-run --export-json plan.local.json
121
+ git clone https://github.com/ysc070528/granttrace.git
122
+ cd granttrace
123
+ python -m pip install -e .
124
+ python mock_server/server.py
125
+ ```
126
+
127
+ 另开终端,进入同一目录执行首次只读扫描:
128
+
129
+ ```bash
130
+ granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --export-json result.local.json
131
+ ```
132
+
133
+ 用浏览器打开默认生成的 **`granttrace_report.html`**:先查看发现与修复建议,再按状态筛选端点、展开证据。预期结果为 **1 个 CONFIRMED、1 个 PUBLIC、1 个 SECURE、2 个 SKIPPED**,确定性覆盖率 **60%**。两个 PATCH 因默认只读而跳过。JSON 结果写入 `result.local.json`;两个本地产物均由 `.gitignore` 忽略。
134
+
135
+ 在这个可丢弃的本地靶场体验写测试和恢复核验:
136
+
137
+ ```bash
138
+ granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --allow-write-tests --export-json result.local.json
92
139
  ```
93
140
 
94
- 账户、API Key / Cookie、合法共享和管理员访问配置见 [配置指南](docs/configuration.md)。支持的数组、布尔值及 `style` / `explode` 编码见 [参数规则](docs/parameter-serialization.md)。接入实测前请核对 [安全边界](SECURITY.md)。
141
+ 再次打开 **`granttrace_report.html`**。预期 **2 个 CONFIRMED、1 个 PUBLIC、2 个 SECURE**,确定性覆盖率 **100%**,批量赋值发现的 `rollback_verified` 为 `true`。本次扫描更新同名 HTML / JSON 文件;这些结果只属于内置五个演示端点。
95
142
 
96
143
  ## 验证与边界
97
144
 
@@ -0,0 +1,128 @@
1
+ # GrantTrace
2
+
3
+ ![CI](https://github.com/ysc070528/granttrace/actions/workflows/test.yml/badge.svg)
4
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
5
+ ![License](https://img.shields.io/badge/license-Apache--2.0-green)
6
+
7
+ **Release source:** v2.5.0 · [GitHub Releases](https://github.com/ysc070528/granttrace/releases) · [PyPI](https://pypi.org/project/granttrace/)
8
+
9
+ An OpenAPI authorization auditor that compares identities, verifies persisted changes, and reports restoration evidence.
10
+
11
+ 安全优先、证据驱动的 OpenAPI 权限审计工具。检查 BOLA / IDOR 与 Mass Assignment,输出身份对比、持久化变更及恢复核验的 HTML / JSON 报告。默认只读;主动写测试须显式开启并配置允许清单与独立读回。
12
+
13
+ [五分钟体验](#五分钟体验) · [完整示例报告](examples/sample_report.html) · [配置指南](docs/configuration.md) · [命令行与迁移](docs/advanced.md) · [验收记录](VERIFICATION.md) · [发布自检](docs/release-checklist.md)
14
+
15
+ ## 为什么是 GrantTrace / Why GrantTrace
16
+
17
+ - **Compare identities**:比较 Owner / Visitor / Anonymous 等身份访问同一资源的结果。
18
+ - **Verify real side effects**:通过独立读回验证状态是否真正持久化,不只看 HTTP 状态码。
19
+ - **Restore safely**:主动 PATCH 测试使用显式 allowlist、原始状态快照、恢复与恢复验证。
20
+
21
+ <img src="docs/assets/report-preview.png" alt="GrantTrace 报告:身份访问摘要、修复建议和端点筛选" width="900">
22
+
23
+ ## 五分钟体验
24
+
25
+ 需要 Python 3.9+。最新发布与可安装版本以 [GitHub Releases](https://github.com/ysc070528/granttrace/releases) 和 [PyPI](https://pypi.org/project/granttrace/) 为准。安装包包含内置 `granttrace demo`,首次体验只需:
26
+
27
+ ```bash
28
+ python -m pip install --upgrade granttrace
29
+ granttrace --version
30
+ granttrace demo
31
+ ```
32
+
33
+ 安装后可在任意目录运行,无需 clone、准备配置、另开终端或访问外部 API。Demo 自动启动动态端口的 `127.0.0.1` 靶场,比较身份访问、演示 BOLA / IDOR 与 Mass Assignment,并通过独立读回与恢复核验展示 PATCH 测试证据。**主动写操作仅发生在内置、可丢弃的本机靶场**;demo 不接受外部 target 或用户凭据,结束时关闭靶场。
34
+
35
+ HTML / JSON 报告保留在当前目录的 `granttrace-demo/` 唯一子目录,终端会输出绝对路径,不覆盖已有报告。可选用 `granttrace demo --output-dir PATH` 指定报告父目录,或 `granttrace demo --read-only` 仅体验只读身份访问,发送 **0 PATCH**。
36
+
37
+ 完整离线示例:[HTML 报告](examples/sample_report.html)(下载后用浏览器打开)与 [JSON 结果](examples/sample_result.json)。
38
+
39
+ ## 接入自己的 API
40
+
41
+ 推荐按以下顺序首次接入;前四步只处理本地文件:
42
+
43
+ 1. **生成草稿和清单**:
44
+
45
+ ```bash
46
+ granttrace --spec your-openapi.yaml --init-config config.local.json
47
+ ```
48
+
49
+ 2. **人工填写并核对**:打开配置和 checklist,填写不同的 Owner / Visitor 测试账户、可丢弃资源与业务授权预期。候选 PATCH 字段和 GET 路径只是接口合同提示;确认所需读回映射,删除不用的读回草稿,替换全部 `__GRANTTRACE_INPUT__:` 占位值,最后移除 `_granttrace_draft`。草稿未完成时会阻止验证、计划与扫描;`write_allowlist` 默认为空。
50
+
51
+ 3. **离线验证配置与规范**,检查终端中的 scope、模式、警告和下一步:
52
+
53
+ ```bash
54
+ granttrace --spec your-openapi.yaml --config config.local.json --validate-config
55
+ ```
56
+
57
+ 4. **生成并人工检查本地计划**;dry-run 发送 **0 请求**:
58
+
59
+ ```bash
60
+ granttrace --spec your-openapi.yaml --config config.local.json --dry-run --export-json plan.local.json
61
+ ```
62
+
63
+ 5. **第一次真实扫描保持只读**:确认计划后,将下例地址替换为已授权的测试目标;这一步会发送读取请求,默认 **0 PATCH**。
64
+
65
+ ```bash
66
+ granttrace --spec your-openapi.yaml --target https://authorized-test.example \
67
+ --config config.local.json --export-json result.local.json
68
+ ```
69
+
70
+ 6. **以后需要时再考虑主动 PATCH**:只有在专用可丢弃资源、独立 GET readback、字段映射、一致性和恢复路径均经人工确认后,才配置明确的 `write_allowlist` 并在真实扫描中单独添加 `--allow-write-tests`。允许清单存在不表示写测试已开启,运行时仍须满足写入与恢复条件。
71
+
72
+ OpenAPI 和离线验证不能证明资源归属、业务授权策略、合法测试权限、生产读回一致性或实际恢复能力;检查通过只代表配置结构及支持的语义通过当前检查。账户、API Key / Cookie、合法共享和管理员访问见 [配置指南](docs/configuration.md),输出与自动化兼容性见 [命令行说明](docs/advanced.md)。支持的数组、布尔值及 `style` / `explode` 编码见 [参数规则](docs/parameter-serialization.md)。接入实测前请核对 [安全边界](SECURITY.md)。
73
+
74
+ ## SARIF 导出
75
+
76
+ `--export-sarif PATH` 可与 HTML / JSON 同时使用:
77
+
78
+ ```bash
79
+ granttrace --spec your-openapi.yaml --config config.local.json \
80
+ --export-json result.local.json --export-sarif granttrace.sarif -o report.html
81
+ ```
82
+
83
+ SARIF 2.1.0 **只包含 CONFIRMED 的 BOLA / IDOR 与 Mass Assignment**;SUSPICIOUS / INCONCLUSIVE 不升级为漏洞,完整状态仍见 HTML / JSON。SARIF 始终脱敏且不导出原始响应或 headers,不能与 `--dry-run` 同用;各输出路径须独立。当前工作目录内的真实 OpenAPI spec 会作为相对 artifact location,不伪造源码行号,API endpoint 仍放在 message / properties。在 GitHub Actions 中从 checkout 的仓库根目录运行,再用 `upload-sarif` 上传;workspace 外的 spec 省略 location,绝不导出本机绝对路径,其结果无法展示为 GitHub Code Scanning alert。详见 [兼容说明](docs/advanced.md#sarif-导出)。
84
+
85
+ ## cURL 复现模板
86
+
87
+ HTML 确认漏洞卡片可提供安全的 POSIX shell cURL 模板和“复制 cURL”按钮。所有认证值均为 Visitor 占位符,即使使用 `--include-sensitive-evidence` 也不会放入模板。请只在明确授权的测试环境中填入自己的测试凭据;脱敏值需人工补全,信息不足时不提供按钮。离线报告支持复制 fallback,也可直接选择命令文本。详见 [复现说明](docs/advanced.md#curl-复现模板)。
88
+
89
+ ## 从源码开发 / 运行仓库 mock
90
+
91
+ 需要查看源码或手工运行仓库靶场时:
92
+
93
+ ```bash
94
+ git clone https://github.com/ysc070528/granttrace.git
95
+ cd granttrace
96
+ python -m pip install -e .
97
+ python mock_server/server.py
98
+ ```
99
+
100
+ 另开终端,进入同一目录执行首次只读扫描:
101
+
102
+ ```bash
103
+ granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --export-json result.local.json
104
+ ```
105
+
106
+ 用浏览器打开默认生成的 **`granttrace_report.html`**:先查看发现与修复建议,再按状态筛选端点、展开证据。预期结果为 **1 个 CONFIRMED、1 个 PUBLIC、1 个 SECURE、2 个 SKIPPED**,确定性覆盖率 **60%**。两个 PATCH 因默认只读而跳过。JSON 结果写入 `result.local.json`;两个本地产物均由 `.gitignore` 忽略。
107
+
108
+ 在这个可丢弃的本地靶场体验写测试和恢复核验:
109
+
110
+ ```bash
111
+ granttrace --spec openapi.json --target http://127.0.0.1:8080 --config config.example.json --allow-write-tests --export-json result.local.json
112
+ ```
113
+
114
+ 再次打开 **`granttrace_report.html`**。预期 **2 个 CONFIRMED、1 个 PUBLIC、2 个 SECURE**,确定性覆盖率 **100%**,批量赋值发现的 `rollback_verified` 为 `true`。本次扫描更新同名 HTML / JSON 文件;这些结果只属于内置五个演示端点。
115
+
116
+ ## 验证与边界
117
+
118
+ ```bash
119
+ python -m unittest discover -s tests
120
+ python scripts/verify_business_scenarios.py
121
+ python scripts/verify_install.py
122
+ ```
123
+
124
+ 测试直接使用仓库中的 `config.example.json`,无需创建本地凭据文件。[业务场景验收](docs/business-scenarios.md) 单独记录团队共享、管理员读取、跨租户拒绝和故意越权的真值、误报与漏报;[验收记录](VERIFICATION.md) 标明实际测试环境和范围。
125
+
126
+ “没有确认漏洞”不等于系统安全。检查覆盖率、错误、可疑和不确定项;显式授权预期只适用于本次身份与资源组合。仅在具备专用测试账户、独立读回和恢复方案的隔离环境启用写测试。远程 `$ref`、GraphQL、gRPC、自动 OAuth / mTLS 登录以及 POST / PUT 主动测试尚未实现。更多规则与迁移说明见 [操作指南](docs/advanced.md)。
127
+
128
+ Apache License 2.0。
@@ -1,5 +1,172 @@
1
1
  # GrantTrace 验收记录
2
2
 
3
+ ## 2026-10-04 v2.5.0 发布前验收
4
+
5
+ 这是 **发布前验收**,不表示 v2.5.0 已在 GitHub Release 或 PyPI 发布。
6
+ Base main commit 为
7
+ [`7e40de4d5c2b1ff7e2d8e01b7a36c0366a1d3bec`](https://github.com/ysc070528/granttrace/commit/7e40de4d5c2b1ff7e2d8e01b7a36c0366a1d3bec),
8
+ Release Prep 分支为 `codex/v2.5.0-release`,源码版本统一为 `2.5.0`。
9
+ v2.5.0 功能已经冻结;本轮只提升正式版本、同步文档与生成示例、扩展历史保留的
10
+ manual release option,并重新执行验收,不新增功能或重构检测代码。
11
+
12
+ ### 已合并的功能与安全范围
13
+
14
+ - SARIF 2.1.0:`--export-sarif` 只导出 CONFIRMED,BOLA / IDOR 对应
15
+ `GT-BOLA-001` / `CWE-639`,Mass Assignment 对应 `GT-MASS-001` / `CWE-915`。
16
+ workspace 内的 OpenAPI spec 提供安全相对 artifact location,不虚构源码行号;
17
+ 外部 spec 不泄漏绝对路径。保留凭据脱敏及 dry-run 禁止 SARIF 的边界。
18
+ - 安全 cURL:confirmed finding 卡片保留凭据占位符、POSIX 引用、`curl --globoff`、
19
+ 已确认的安全 URL / payload / Content-Type,以及离线复制 fallback。
20
+ `--include-sensitive-evidence` 不解除 cURL 凭据限制。
21
+ - 配置引导:保留草稿阻断、人工核对、config-only / spec-aware 范围区分、离线计划
22
+ 和首次只读扫描建议;allowlist 存在不等于启用 PATCH,引导不展示凭据或资源值。
23
+ - BOLA / IDOR / Mass Assignment 的判定、ConfigValidator、默认只读、显式 write
24
+ allowlist、独立 GET readback、snapshot、rollback verification、恢复失败停写、
25
+ TLS / HTTP / redirect / proxy 和 loopback demo 安全边界均未修改。
26
+ 没有新增 POST / PUT 主动测试、自动 OAuth / login 或其他检测能力。
27
+
28
+ ### 本轮实际本地执行
29
+
30
+ 本地 Windows / Python 3.14.5 重新执行,未引用旧功能 PR 的绿灯作为本轮结果:
31
+
32
+ | 检查 | 实际结果 |
33
+ |---|---|
34
+ | `python -m unittest discover -s tests` | **486 passed**,0 failures / errors / skipped;未删除或跳过测试,仅同步一处当前版本断言 |
35
+ | mypy | `Success: no issues found in 18 source files`,**0 errors** |
36
+ | Ruff | `All checks passed!` |
37
+ | coverage erase / run / report / xml / json | 总覆盖率 **82.78%**;保留 branch-aware source 范围和 `fail_under = 80` |
38
+ | 业务场景 | **6/6** 本机模型符合预期:团队共享、租户管理员为 AUTHORIZED;未共享、跨租户隔离为 SECURE;两种泄漏为 CONFIRMED |
39
+ | 官方 examples 脚本 | 先 `--update-examples`,再不带更新参数复验;JSON / YAML 和完整数据库恢复通过 |
40
+ | read-only example | 1 CONFIRMED、1 PUBLIC、1 SECURE、2 SKIPPED,conclusive coverage 60% |
41
+ | active JSON / YAML | 2 CONFIRMED、1 PUBLIC、2 SECURE,conclusive coverage 100%,Mass Assignment rollback_verified=true |
42
+ | `verify_install.py` | fresh 2.5.0 wheel 在源码目录外的新虚拟环境安装通过;CLI、metadata、JSON/YAML plan、草稿阻断与安装资源通过 |
43
+ | 安装后版本链 | CLI 为 `GrantTrace 2.5.0`;project / runtime / wheel / installed metadata / JSON 均为 `2.5.0`;HTML 为 `v2.5.0`;实际 HTTP User-Agent 为 `GrantTrace/2.5.0` |
44
+ | installed read-only demo | **0 PATCH**,database_restored=true、server_stopped=true |
45
+ | installed active demo | 1 BOLA、1 Mass Assignment CONFIRMED;rollback_verified=true、database_restored=true、server_stopped=true;动态 127.0.0.1 端口正常关闭 |
46
+ | 安装后用户扫描 / 本地计划 | 默认扫描 **0 PATCH**;主动扫描独立读回和完整恢复通过;offline plan requests_sent=0 |
47
+ | pip check / 本地 strict pip-audit | 无依赖冲突;`No known vulnerabilities found`,未忽略漏洞或降低审计要求 |
48
+ | build / twine | 清理已核对的旧构建范围后执行 `python -m build`;2.5.0 wheel / sdist 生成,`twine check --strict` 均 PASSED |
49
+ | wheel / sdist 内容 | Name=granttrace、Version=2.5.0、Python>=3.9、Apache-2.0、PyYAML>=6.0 与 CLI entry point 正确;demo assets、SARIF / cURL / onboarding 模块以及 sdist 的 docs / examples / scripts 完整 |
50
+ | 发行物卫生 | 检查包内文件名与实际主机路径变体,未发现缓存、私有配置、临时报告、.git、真实主机用户名或本机路径;原有虚构 mock 凭据和隐私回归路径 fixture 保留,不将通用 secret scanner 宣称为绝对保证 |
51
+ | 安装后 SARIF 本机扫描 | SARIF 2.1.0 / driver 2.5.0;只读 1 result、主动 2 results,仅 CONFIRMED,两个 rule/CWE 正确;location 为 openapi.json,无伪造行号、凭据或绝对路径;两个输出通过官方 OASIS SARIF 2.1.0 schema |
52
+ | 安装后 cURL 报告 | 2 份 confirmed 模板,BOLA GET / Mass Assignment PATCH;真实测试 URL、application/json、已确认 role=admin payload 与自定义 Visitor 凭据占位符正确,无 demo 原始认证值 |
53
+ | 安装后离线引导 | 实际 init/validate/dry-run:socket / DNS / HTTP 调用计数均为 0;生成空 allowlist 草稿和 checklist、spec-aware 说明及只读下一步,plan requests_sent=0 |
54
+ | 报告复制 fallback | 实际生成的 JavaScript 在 Node 离线 DOM harness 中通过无 Clipboard API 成功/失败与 API reject fallback 三种模式;此验证不是浏览器 UI 验收 |
55
+
56
+ 两个生成示例只由 `scripts/verify_examples.py --update-examples` 更新;版本、时间和
57
+ 动态 loopback 端口更新不改变业务结果。构建 SHA-256 只用于 PR branch pre-release
58
+ 资产检查;最终 Release 资产必须基于最终合并 / tagged commit 重新构建或核实,不能
59
+ 把本轮分支的 hash 当作最终发布 hash。
60
+
61
+ ### 本轮首次远程发布准备验收
62
+
63
+ [PR #23](https://github.com/ysc070528/granttrace/pull/23) 的 release-prep commit
64
+ `ce84a0b11a5e1450aea7fb6698a5cdaa46e6e86f` 已实际通过
65
+ [GrantTrace CI](https://github.com/ysc070528/granttrace/actions/runs/37192301259) 与
66
+ [CodeQL](https://github.com/ysc070528/granttrace/actions/runs/37192301260):
67
+
68
+ | Python job | unittest | branch-aware coverage | business / examples / install |
69
+ |---|---|---|---|
70
+ | 3.9 | 486 passed | 82.77% | 全部成功 |
71
+ | 3.12 | 486 passed | 82.78% | 全部成功 |
72
+ | 3.14 | 486 passed | 82.78% | 全部成功 |
73
+
74
+ 远程 Mypy 为 0 errors(18 个源码文件),Ruff、Runtime dependency audit、
75
+ Analyze Python 和 CodeQL 全部成功;审计未发现已知漏洞。
76
+ 三个版本的安装验收均确认 2.5.0 metadata、read-only demo 0 PATCH,以及主动 demo
77
+ rollback_verified / database_restored / server_stopped 均为 true。
78
+ 这是上述 commit 的真实执行记录。补入证据后最终 PR HEAD 仍须重新通过门禁,
79
+ 最新结果以 PR #23 的 Checks 为准,不将本记录当作合并后的 main 验收。
80
+
81
+ ### 发布工作流与证据边界
82
+
83
+ release.yml 仅修改 manual default、choices、allowlist 和对应错误说明,支持 v2.5.0
84
+ 并保留 v2.4.0 / v2.4.1。YAML 解析、4 段内嵌 Python 编译及 **35 组隔离校验**通过;
85
+ 外部 HTTP / git 输出均 mock,0 真实网络调用、0 发布动作。本机没有 actionlint,未下载 binary。
86
+ 官方 stable Release、tag/source commit、project/runtime/distribution metadata、SHA256、
87
+ build/publish 分离、`pypi` environment、OIDC 和 v2.4.0 固定 commit 校验保持原样。
88
+
89
+ PowerShell 引用的本轮单元测试通过;此记录不宣称 PowerShell 7 真实命令执行通过。
90
+ 六个业务模型与 demo 只证明所列本机 fixture 结果,不代表生产 API 检测率或零误报。
91
+ 所有目标为隔离本机 mock,凭据为虚构数据,不使用真实生产 API 或凭据。
92
+ 最终合并后的 main commit 与 CI / CodeQL 仍须由维护者在正式发布前复核。
93
+ 本轮 Release Prep PR 保持开放,未合并,未创建 tag / GitHub Release,未发布 PyPI。
94
+ 下方 v2.4.1 及更早版本的验收原文完整保留。
95
+
96
+ ## 2026-10-04 v2.4.1 正式发布验收
97
+
98
+ 发布时 final main commit 为
99
+ [`8ba6cb46c9bbd670449989a5bd54fb233543d81f`](https://github.com/ysc070528/granttrace/commit/8ba6cb46c9bbd670449989a5bd54fb233543d81f)。
100
+ [Release Prep PR #18](https://github.com/ysc070528/granttrace/pull/18) 已合并,
101
+ annotated tag `v2.4.1` 最终解析到该 commit。
102
+
103
+ ### 正式发布证据
104
+
105
+ - [GitHub Release “GrantTrace v2.4.1”](https://github.com/ysc070528/granttrace/releases/tag/v2.4.1)
106
+ 已正式发布,非 draft、非 prerelease。附件包括
107
+ `granttrace-2.4.1-py3-none-any.whl`、`granttrace-2.4.1.tar.gz` 和 `SHA256SUMS`。
108
+ - [Publish to PyPI 工作流](https://github.com/ysc070528/granttrace/actions/runs/37175522087)
109
+ 成功,[PyPI 2.4.1](https://pypi.org/project/granttrace/2.4.1/) 已可安装。
110
+ 使用 OIDC Trusted Publishing,owner 为 `ysc070528`、repository 为
111
+ `granttrace`、workflow 为 `release.yml`、environment 为 `pypi`。
112
+ [PyPI 发布者 provenance](https://pypi.org/integrity/granttrace/2.4.1/granttrace-2.4.1-py3-none-any.whl/provenance)
113
+ 与上述配置一致,未使用 PyPI Token 或用户名/密码。
114
+ - 发布 commit 的 [main CI](https://github.com/ysc070528/granttrace/actions/runs/37137142692)
115
+ 与 [CodeQL](https://github.com/ysc070528/granttrace/actions/runs/37137142656)
116
+ 均成功;Python 3.9 / 3.12 / 3.14 测试通过。
117
+ - `main` Branch Protection 的 required checks 包含 **Mypy**;mypy 是正式
118
+ blocking 门禁,coverage 的 `fail_under = 80` 保持启用。
119
+
120
+ ### 正式测试与 demo 基线
121
+
122
+ | 检查 | 实际结果 |
123
+ |---|---|
124
+ | Python 3.9 / 3.12 / 3.14 unittest | 每个版本均 **304 项通过**,0 failures / errors / skipped |
125
+ | mypy | **0 errors**,15 个源码文件无诊断 |
126
+ | Ruff / Runtime dependency audit / CodeQL | 全部 passed |
127
+ | 真实 unittest 总覆盖率(语句与分支) | Python 3.9:**80.85%**;Python 3.12 / 3.14:**80.83%**,均达到 >=80% 门槛 |
128
+ | 正式 wheel 独立安装 | 在源码目录外的新虚拟环境验证,CLI 为 `GrantTrace 2.4.1`,metadata / HTML / JSON / User-Agent 版本一致 |
129
+ | `granttrace demo --read-only` | **0 PATCH**;数据库保持初始状态,`database_restored=true`、`server_stopped=true` |
130
+ | `granttrace demo` | BOLA / IDOR 与 Mass Assignment 演示正常;独立 GET readback、`rollback_verified=true`、`database_restored=true`、`server_stopped=true` |
131
+ | demo 安全范围 | 只使用动态 `127.0.0.1` 靶场,不接受外部 target,不使用用户凭据;完成后服务端口不可连接 |
132
+
133
+ 本次发布未改变 BOLA / IDOR / Mass Assignment 判定语义或安全边界。
134
+ 用户 API 扫描仍默认只读;主动 PATCH 仍受显式允许、write allowlist、
135
+ 独立 GET readback、状态快照和 rollback verification 限制,恢复失败继续阻断写入。
136
+ 验收只使用虚构数据和隔离本机靶场,不访问生产 API 或使用真实生产凭据。
137
+
138
+ 下方“2026-10-03 2.4.1.dev0 内置 demo 验收”及其后的章节均为历史记录;
139
+ 其中“当前”“未发布”“advisory”等表述指各轮记录当时的状态,历史原文完整保留。
140
+
141
+ ## 2026-10-03 2.4.1.dev0 内置 demo 验收
142
+
143
+ 本轮仅改善安装后的首次体验,稳定版仍为 v2.4.0,开发版本为
144
+ 2.4.1.dev0;本记录不表示开发版已发布。原检测语义、配置验证规则和
145
+ PATCH allowlist / 独立读回 / 回滚限制保持不变,兼容入口保留。
146
+
147
+ 本地 Windows / Python 3.14.5 实际验证结果:
148
+
149
+ - 完整 unittest 与 coverage 运行均为 **304 项通过**,0 失败、0 错误、
150
+ 0 跳过,其中新增 27 项 demo 测试、9 项首次使用提示测试。
151
+ - 总覆盖率 **80.85%**,语句 **83.78%**,分支 **75.17%**;分别高于
152
+ 之前的 79.66% / 82.66% / 74.02%。
153
+ - 业务场景、JSON / YAML 示例、真实 wheel 安装脚本全部通过;Ruff、
154
+ pip check 与严格 pip-audit 通过,未发现已知运行依赖漏洞。
155
+ - mypy 仍为 **20 个问题 / 6 个文件**,新增 demo 未增加类型诊断;保持 advisory。
156
+ - 全新虚拟环境在仓库外的空目录安装 wheel,未复制任何仓库文件,
157
+ `granttrace demo` 成功;环境代理被绕过,靶场只绑定动态 127.0.0.1 端口。
158
+ - 完整 demo 为 **1 BOLA / IDOR + 1 Mass Assignment**;独立 GET 读回、
159
+ `rollback_verified`、整库恢复与服务器关闭均成功。只读 demo 未发送 PATCH。
160
+ - HTML / JSON 报告保留在唯一 run 子目录,不覆盖旧文件;本地安装验收
161
+ 证据另存于被忽略的 `dist/demo-validation/`。
162
+ - 异常回归包含构造/启动/ready 失败、JSON 与报告错误、真实 PATCH 后
163
+ KeyboardInterrupt、读回失败后恢复、回滚证据缺失与整库残留;均可靠关闭
164
+ 靶场,恢复失败或证据不足不会显示 demo 成功。
165
+
166
+ Python 3.9 / 3.12 / 3.14 与 CodeQL 的远程结果以本轮 PR 的实际检查为准。
167
+ 本轮只创建 PR 供审查,不合并、不创建 tag、不发布 GitHub Release 或 PyPI。
168
+ 以下历史记录完整保留。
169
+
3
170
  ## 2026-10-03 v2.4.0 发布前验收
4
171
 
5
172
  本轮在已合并 PR #11 的最新 `main`(`4b65e54`)基础上创建