granttrace 2.7.0__tar.gz → 2.7.1__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.
- {granttrace-2.7.0 → granttrace-2.7.1}/CHANGELOG.md +36 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/PKG-INFO +18 -12
- {granttrace-2.7.0 → granttrace-2.7.1}/README.md +17 -11
- {granttrace-2.7.0 → granttrace-2.7.1}/README.zh-CN.md +10 -6
- {granttrace-2.7.0 → granttrace-2.7.1}/SECURITY.md +5 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/VERIFICATION.md +51 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/api_sentinel.py +39 -10
- {granttrace-2.7.0 → granttrace-2.7.1}/core/__init__.py +1 -1
- {granttrace-2.7.0 → granttrace-2.7.1}/core/onboarding.py +43 -1
- {granttrace-2.7.0 → granttrace-2.7.1}/core/scan_safety.py +35 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/advanced.md +1 -0
- granttrace-2.7.1/docs/assets/report-preview.png +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/comparison.md +1 -1
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/windows-portable.md +7 -6
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/README.md +2 -2
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/sample_report.html +100 -100
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/sample_result.json +103 -103
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/PKG-INFO +18 -12
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/SOURCES.txt +1 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/pyproject.toml +1 -1
- granttrace-2.7.1/tests/test_cli_identity_guard.py +280 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_cli_security_hardening.py +1 -1
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_onboarding_cli.py +14 -3
- granttrace-2.7.0/docs/assets/report-preview.png +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/CODE_OF_CONDUCT.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/CONTRIBUTING.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/LICENSE +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/MANIFEST.in +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/config.example.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/config.schema.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/auditor.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/authorization.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/bopla.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_scaffold.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/__init__.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/base.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/bola.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/identities.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/readbacks.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validation/spec_checks.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/config_validator.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/demo.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/demo_assets/__init__.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/demo_assets/demo-config.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/demo_assets/mock-data.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/demo_assets/openapi.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/diff.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/evidence.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/generator.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/models.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/parameters.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/parser.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/remote_refs.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/reporter.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/reproduction.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/request_builder.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/results.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/sarif.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/transactions.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/transport.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/core/yaml_safety.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/assets/report-finding.png +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/authorization-audit-hardening.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/authorization-coverage-audit.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/bopla-readonly.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/business-scenarios.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/case-studies/crapi.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/case-studies/vampi.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/configuration.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/history/release-checklist-history.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/history/release-verification-history.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/parameter-serialization.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/pr42-independent-review.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/pr42-state-authority-review.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/pr43-integration-plan.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/pr43-integration-review.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/release-checklist.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/docs/remote-references.md +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/crapi/no-chatbot.compose.yml +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/crapi/prepare_config.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/vampi/prepare_config.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/examples/vampi/run_vampi.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/dependency_links.txt +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/entry_points.txt +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/requires.txt +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/granttrace.egg-info/top_level.txt +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/mock_server/__init__.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/mock_server/server.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/openapi.json +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/benchmark_read_safety.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/build_windows_portable.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/source_version.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_authorization_coverage.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_business_scenarios.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_examples.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_install.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_pr42_adversarial.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_pr43_integration.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/scripts/verify_windows_portable.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/setup.cfg +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/test_suite.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_auditor_integration.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_auth_cookie_references.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_auth_header_references.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_authorization_evidence_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_authorization_maintenance.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_authorization_policy_preflight.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bola_rejection_evidence.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_collection_grouping.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_integration.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_pending_exports.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_policy.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_policy_counterexamples.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_reports.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_bopla_transport_safety.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_business_authorization.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_cli_config_preflight.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_cli_report_boundaries.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_code_review_regressions.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_committed_examples.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_config_readback_preflight.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_config_scaffold.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_config_validation.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_credential_echo_redaction.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_curl_report.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_demo.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_diff.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_diff_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_english_reasons.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_evidence.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_expanded_detection.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_expanded_report_boundaries.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_first_run_guidance.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_header_cookie_array_object.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_header_cookie_boundaries.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_header_cookie_parameters.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_header_cookie_transport.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_late_private_value_redaction.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_mass_assignment_flow.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_merge_patch_recovery.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_module_boundaries.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_not_found_denial.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_onboarding.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_output_snapshot.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_parameter_compatibility.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_parameter_serialization.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_parser_generator_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_parser_remote_refs.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_parser_replacement_auth.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_patch_readback_strictness.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_pr42_adversarial.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_pr42_state_authority.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_pr43_authorization_evidence.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_pr43_evidence_paths.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_pr43_put_safety.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_problem_details_denials.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_query_auth_parameters.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_rate_limit_retry.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_read_only_path_guards.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_read_only_safety.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_read_safety_cache.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_release_version.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_remote_ref_host_validation.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_remote_refs.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_remote_refs_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_remote_refs_premerge_audit.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_remote_refs_review_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_report_usability.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_reproduction.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_sarif.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_sarif_cli.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_scan_accounting.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_schema_regressions.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_small_review_items.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_spec_config_cross_checks.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_transaction_transport_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_transport.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_unconfigured_query_parameters.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_v27_features.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_v27_hardening.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_version_identity.py +0 -0
- {granttrace-2.7.0 → granttrace-2.7.1}/tests/test_yaml_alias_expansion.py +0 -0
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.7.1 - 2026-11-11
|
|
4
|
+
|
|
5
|
+
A maintenance release. Detectors, evidence standards and report formats are
|
|
6
|
+
unchanged from 2.7.0.
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- A real scan of a target other than a loopback address (`localhost`,
|
|
11
|
+
`127.0.0.0/8`, `::1`) now needs identities from `--config`. Without them the
|
|
12
|
+
CLI exits with code 2 before sending any request and lists the
|
|
13
|
+
`--init-config`, `--validate-config` and `--dry-run` steps. It used to fall
|
|
14
|
+
back to the built-in mock identities, placeholder credentials and resource
|
|
15
|
+
IDs meant only for the bundled mock server, and scan the target with them.
|
|
16
|
+
Look-alike hosts such as `localhost.example.com`, `127.0.0.1.nip.io` or
|
|
17
|
+
integer IPv4 spellings count as remote. A loopback scan without identities
|
|
18
|
+
still runs, with a warning that the mock identities are in use; a dry run
|
|
19
|
+
without identities stays offline and points to `--init-config` instead of a
|
|
20
|
+
scan command. `granttrace demo`, `--init-config`, `--validate-config` and
|
|
21
|
+
scans with configured identities are unchanged (#92).
|
|
22
|
+
- The console shows the scan target before a scan (`Scan target: ...`),
|
|
23
|
+
sanitized like the report's target (#92).
|
|
24
|
+
- `--help` describes GrantTrace as read-only authorization auditing, states
|
|
25
|
+
the default target, and says that active PATCH/PUT checks run only in the
|
|
26
|
+
built-in demo and stop before any write against `--target` (#92).
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
|
|
30
|
+
- The README no longer says GrantTrace "never writes to your API": it sends
|
|
31
|
+
GET requests and query-style POSTs you declare read-only, never PATCH, PUT
|
|
32
|
+
or DELETE, and a declared read-only POST is not proven free of side effects.
|
|
33
|
+
The demo's findings are described as planted test flaws, and the sample
|
|
34
|
+
report link explains that GitHub shows HTML source. The report screenshot is
|
|
35
|
+
retaken from the 2.7.0 demo (#92).
|
|
36
|
+
- `SECURITY.md` and the command-line reference describe the new requirement
|
|
37
|
+
for a non-loopback target (#92).
|
|
38
|
+
|
|
3
39
|
## 2.7.0 - 2026-11-11
|
|
4
40
|
|
|
5
41
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: granttrace
|
|
3
|
-
Version: 2.7.
|
|
3
|
+
Version: 2.7.1
|
|
4
4
|
Summary: Evidence-driven, read-only authorization testing for OpenAPI APIs: BOLA/IDOR, broken authentication, BFLA and property-level checks
|
|
5
5
|
Author: GrantTrace contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -39,8 +39,9 @@ Dynamic: license-file
|
|
|
39
39
|
GrantTrace reads your OpenAPI specification, requests the same resources as an
|
|
40
40
|
**Owner**, a **Visitor** and an **Anonymous** identity, and compares what each
|
|
41
41
|
of them gets back. It reports BOLA / IDOR and related authorization flaws only
|
|
42
|
-
when the responses prove them
|
|
43
|
-
|
|
42
|
+
when the responses prove them and plans every request offline first. Against
|
|
43
|
+
your API it sends GET requests, plus query-style POSTs only where you declare
|
|
44
|
+
them read-only; it never sends PATCH, PUT or DELETE.
|
|
44
45
|
|
|
45
46
|
<img src="https://raw.githubusercontent.com/ysc070528/granttrace/main/docs/assets/report-preview.png" alt="GrantTrace HTML report: summary, coverage and per-endpoint results" width="900">
|
|
46
47
|
|
|
@@ -49,10 +50,12 @@ python -m pip install granttrace
|
|
|
49
50
|
granttrace demo # a disposable local API; no configuration or credentials needed
|
|
50
51
|
```
|
|
51
52
|
|
|
52
|
-
The demo starts a throwaway API on `127.0.0.1
|
|
53
|
-
assignment flaw it
|
|
54
|
-
JSON report.
|
|
55
|
-
|
|
53
|
+
The demo starts a throwaway API on `127.0.0.1` with fictional data, finds the
|
|
54
|
+
BOLA and the mass assignment flaw planted in it, restores its data, stops, and
|
|
55
|
+
writes an HTML and a JSON report. These are the demo's own test flaws, not
|
|
56
|
+
results from a real API. A [sample report](https://github.com/ysc070528/granttrace/blob/main/examples/sample_report.html)
|
|
57
|
+
from the demo is in the repository; GitHub shows its HTML source, so download
|
|
58
|
+
the raw file and open it in a browser.
|
|
56
59
|
|
|
57
60
|
## Why GrantTrace
|
|
58
61
|
|
|
@@ -126,7 +129,10 @@ what each release contains.
|
|
|
126
129
|
## Audit your own API
|
|
127
130
|
|
|
128
131
|
Use a test environment you are authorized to test, two test accounts, and
|
|
129
|
-
resources each of them owns. Steps 1 to 4 only touch local files.
|
|
132
|
+
resources each of them owns. Steps 1 to 4 only touch local files. Step 5 needs
|
|
133
|
+
the configuration's identities: without them GrantTrace refuses to scan any
|
|
134
|
+
target other than a loopback address (`localhost`, `127.0.0.1`, `::1`) and
|
|
135
|
+
sends nothing.
|
|
130
136
|
|
|
131
137
|
```bash
|
|
132
138
|
# 1. Draft a configuration and a review checklist from the specification
|
|
@@ -168,10 +174,10 @@ evidence are in English.
|
|
|
168
174
|
|
|
169
175
|
## Safety
|
|
170
176
|
|
|
171
|
-
Only test systems you are explicitly authorized to test. GrantTrace
|
|
172
|
-
|
|
173
|
-
rules cannot prove that
|
|
174
|
-
before a scan. Report vulnerabilities in GrantTrace itself privately, as
|
|
177
|
+
Only test systems you are explicitly authorized to test. GrantTrace sends no
|
|
178
|
+
PATCH, PUT or DELETE to your API and refuses writes to external targets, but
|
|
179
|
+
static rules cannot prove that a GET, or a POST you declare read-only, has no
|
|
180
|
+
side effects, so review the dry-run plan before a scan. Report vulnerabilities in GrantTrace itself privately, as
|
|
175
181
|
described in [SECURITY.md](https://github.com/ysc070528/granttrace/blob/main/SECURITY.md).
|
|
176
182
|
|
|
177
183
|
## Documentation
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
GrantTrace reads your OpenAPI specification, requests the same resources as an
|
|
13
13
|
**Owner**, a **Visitor** and an **Anonymous** identity, and compares what each
|
|
14
14
|
of them gets back. It reports BOLA / IDOR and related authorization flaws only
|
|
15
|
-
when the responses prove them
|
|
16
|
-
|
|
15
|
+
when the responses prove them and plans every request offline first. Against
|
|
16
|
+
your API it sends GET requests, plus query-style POSTs only where you declare
|
|
17
|
+
them read-only; it never sends PATCH, PUT or DELETE.
|
|
17
18
|
|
|
18
19
|
<img src="https://raw.githubusercontent.com/ysc070528/granttrace/main/docs/assets/report-preview.png" alt="GrantTrace HTML report: summary, coverage and per-endpoint results" width="900">
|
|
19
20
|
|
|
@@ -22,10 +23,12 @@ python -m pip install granttrace
|
|
|
22
23
|
granttrace demo # a disposable local API; no configuration or credentials needed
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
The demo starts a throwaway API on `127.0.0.1
|
|
26
|
-
assignment flaw it
|
|
27
|
-
JSON report.
|
|
28
|
-
|
|
26
|
+
The demo starts a throwaway API on `127.0.0.1` with fictional data, finds the
|
|
27
|
+
BOLA and the mass assignment flaw planted in it, restores its data, stops, and
|
|
28
|
+
writes an HTML and a JSON report. These are the demo's own test flaws, not
|
|
29
|
+
results from a real API. A [sample report](https://github.com/ysc070528/granttrace/blob/main/examples/sample_report.html)
|
|
30
|
+
from the demo is in the repository; GitHub shows its HTML source, so download
|
|
31
|
+
the raw file and open it in a browser.
|
|
29
32
|
|
|
30
33
|
## Why GrantTrace
|
|
31
34
|
|
|
@@ -99,7 +102,10 @@ what each release contains.
|
|
|
99
102
|
## Audit your own API
|
|
100
103
|
|
|
101
104
|
Use a test environment you are authorized to test, two test accounts, and
|
|
102
|
-
resources each of them owns. Steps 1 to 4 only touch local files.
|
|
105
|
+
resources each of them owns. Steps 1 to 4 only touch local files. Step 5 needs
|
|
106
|
+
the configuration's identities: without them GrantTrace refuses to scan any
|
|
107
|
+
target other than a loopback address (`localhost`, `127.0.0.1`, `::1`) and
|
|
108
|
+
sends nothing.
|
|
103
109
|
|
|
104
110
|
```bash
|
|
105
111
|
# 1. Draft a configuration and a review checklist from the specification
|
|
@@ -141,10 +147,10 @@ evidence are in English.
|
|
|
141
147
|
|
|
142
148
|
## Safety
|
|
143
149
|
|
|
144
|
-
Only test systems you are explicitly authorized to test. GrantTrace
|
|
145
|
-
|
|
146
|
-
rules cannot prove that
|
|
147
|
-
before a scan. Report vulnerabilities in GrantTrace itself privately, as
|
|
150
|
+
Only test systems you are explicitly authorized to test. GrantTrace sends no
|
|
151
|
+
PATCH, PUT or DELETE to your API and refuses writes to external targets, but
|
|
152
|
+
static rules cannot prove that a GET, or a POST you declare read-only, has no
|
|
153
|
+
side effects, so review the dry-run plan before a scan. Report vulnerabilities in GrantTrace itself privately, as
|
|
148
154
|
described in [SECURITY.md](https://github.com/ysc070528/granttrace/blob/main/SECURITY.md).
|
|
149
155
|
|
|
150
156
|
## Documentation
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
**证据驱动、默认只读的 OpenAPI 授权测试工具。**
|
|
11
11
|
|
|
12
12
|
GrantTrace 读取 OpenAPI 规范,分别以 **Owner**、**Visitor** 和 **Anonymous** 三种身份请求同一资源,
|
|
13
|
-
比较各自拿到的结果。只有响应本身能证明问题时才报告 BOLA / IDOR
|
|
14
|
-
|
|
13
|
+
比较各自拿到的结果。只有响应本身能证明问题时才报告 BOLA / IDOR 等授权缺陷;所有请求先离线生成计划。
|
|
14
|
+
对你的 API 只发送 GET 请求,以及你声明为只读的查询类 POST;从不发送 PATCH、PUT 或 DELETE。
|
|
15
15
|
|
|
16
16
|
<img src="https://raw.githubusercontent.com/ysc070528/granttrace/main/docs/assets/report-preview.png" alt="GrantTrace HTML 报告:汇总、覆盖率和逐个端点的结果" width="900">
|
|
17
17
|
|
|
@@ -20,8 +20,10 @@ python -m pip install granttrace
|
|
|
20
20
|
granttrace demo # 内置可丢弃的本机 API,无需配置或凭据
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Demo 在 `127.0.0.1`
|
|
24
|
-
|
|
23
|
+
Demo 在 `127.0.0.1` 启动一个使用虚构数据的临时 API,找出其中预置的 BOLA 和 Mass Assignment 缺陷,
|
|
24
|
+
恢复数据后关闭,并生成 HTML 和 JSON 报告。这些是 Demo 自带的测试缺陷,不是真实 API 的检测结果。
|
|
25
|
+
仓库中有一份 Demo 生成的[示例报告](https://github.com/ysc070528/granttrace/blob/main/examples/sample_report.html);
|
|
26
|
+
GitHub 只显示其 HTML 源码,请下载原始文件后用浏览器打开。
|
|
25
27
|
|
|
26
28
|
## 为什么用 GrantTrace
|
|
27
29
|
|
|
@@ -77,6 +79,8 @@ Mass Assignment 测试需要写入资源,GrantTrace 只在能核验资源实
|
|
|
77
79
|
## 审计自己的 API
|
|
78
80
|
|
|
79
81
|
请使用获得授权的测试环境、两个测试账号,以及它们各自拥有的资源。第 1 到 4 步只处理本地文件。
|
|
82
|
+
第 5 步需要配置中的 identities:没有时,GrantTrace 拒绝扫描回环地址(`localhost`、`127.0.0.1`、`::1`)
|
|
83
|
+
以外的任何目标,且不发送任何请求。
|
|
80
84
|
|
|
81
85
|
```bash
|
|
82
86
|
# 1. 根据规范生成配置草稿和核对清单
|
|
@@ -113,8 +117,8 @@ HTML 报告的界面文字目前为中文,检查理由和证据为英文。
|
|
|
113
117
|
|
|
114
118
|
## 安全
|
|
115
119
|
|
|
116
|
-
只测试明确获得授权的系统。GrantTrace
|
|
117
|
-
|
|
120
|
+
只测试明确获得授权的系统。GrantTrace 不会向你的 API 发送 PATCH、PUT 或 DELETE,并拒绝对外部目标写入;
|
|
121
|
+
但静态规则无法证明 GET 或你声明为只读的 POST 没有副作用,扫描前请核对 dry-run 计划。
|
|
118
122
|
GrantTrace 自身的漏洞请按 [SECURITY.md](https://github.com/ysc070528/granttrace/blob/main/SECURITY.md) 私下报告。
|
|
119
123
|
|
|
120
124
|
## 文档
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
GrantTrace sends requests to the target named on the command line. Use it
|
|
4
4
|
only against systems for which you have explicit authorization.
|
|
5
5
|
|
|
6
|
+
A scan of a target other than a loopback address (`localhost`, `127.0.0.0/8`,
|
|
7
|
+
`::1`) needs identities from `--config`. Without them the CLI refuses before
|
|
8
|
+
sending any request, instead of falling back to the built-in mock identities,
|
|
9
|
+
which exist only for the bundled mock server.
|
|
10
|
+
|
|
6
11
|
The default mode does not execute mutation checks. Since 2.6.0, write checks
|
|
7
12
|
against a target named on the command line also stop before any write: GrantTrace
|
|
8
13
|
cannot independently verify an external API's authoritative resource state, so
|
|
@@ -3,6 +3,57 @@
|
|
|
3
3
|
Detailed historical release verification records are archived in
|
|
4
4
|
[release verification history](docs/history/release-verification-history.md).
|
|
5
5
|
|
|
6
|
+
## v2.7.1 pre-release acceptance - 2026-11-11
|
|
7
|
+
|
|
8
|
+
Status: **accepted for release; v2.7.1 is not published.** Release candidate:
|
|
9
|
+
commit `37eef7b` (head of PR #93: main `61f7e05`, the merge of #92, plus the
|
|
10
|
+
version, the changelog date, the publishing workflow's manual choice, the
|
|
11
|
+
regenerated examples and release-specific documentation); the commit after it
|
|
12
|
+
adds only this record. PyPI's latest is 2.7.0; there is no `v2.7.1` tag or
|
|
13
|
+
Release.
|
|
14
|
+
|
|
15
|
+
Environment: Linux x86_64 container; CPython **3.13.18** for coverage, acceptance
|
|
16
|
+
scripts and the build, plus CPython **3.9.25**, **3.12.3** and **3.14.6**; PyYAML
|
|
17
|
+
**6.0.3**, pytest **9.2.0** (**8.4.2** on 3.9), coverage **7.17.2** (**7.10.7** on
|
|
18
|
+
3.9), Ruff **0.17.4**, Mypy **2.4.1**, build **1.6.1**, Twine **7.0.0**, setuptools
|
|
19
|
+
**84.2.1**, wheel **0.48.0**, pip-audit **2.10.1**. The Windows package was built
|
|
20
|
+
and checked by the GitHub-hosted `windows-2025` runner; no Windows host was used
|
|
21
|
+
locally.
|
|
22
|
+
|
|
23
|
+
| Check | Result |
|
|
24
|
+
|---|---|
|
|
25
|
+
| CI on main after #92 (`61f7e05`) | GrantTrace CI [run 42977306638](https://github.com/ysc070528/granttrace/actions/runs/42977306638), Windows x64 portable [run 42977306654](https://github.com/ysc070528/granttrace/actions/runs/42977306654) and CodeQL [run 42977306497](https://github.com/ysc070528/granttrace/actions/runs/42977306497): all passed |
|
|
26
|
+
| CI on the candidate (`37eef7b`) | 9 of 9 passed: Ruff, Mypy, tests on 3.9 / 3.12 / 3.14 and runtime dependency audit ([run 42978755482](https://github.com/ysc070528/granttrace/actions/runs/42978755482)), Windows x64 portable ([run 42978755524](https://github.com/ysc070528/granttrace/actions/runs/42978755524)), Analyze Python ([run 42978755518](https://github.com/ysc070528/granttrace/actions/runs/42978755518)) and CodeQL |
|
|
27
|
+
| Full regression suite | 1335 passed and 2478 subtests passed on CPython 3.12.3, 3.13.18 and 3.14.6; 1335 passed on 3.9.25; full unittest (1335 tests) passed on all four |
|
|
28
|
+
| Branch-aware coverage | 90.03% combined on 3.13.18 (statements 7324 / 7964, branches 3492 / 4050 = 86.22%); 89.94% on 3.9.25, 90.03% on 3.12.3 and 90.04% on 3.14.6; required minimum 80% |
|
|
29
|
+
| Mypy / Ruff | No Mypy issues in 32 source files; Ruff passed |
|
|
30
|
+
| Acceptance scripts | On each of the four interpreters: PR42 adversarial (28 tests); PR43 integration (89 tests, source `37eef7b`, clean tree); authorization coverage, authoritative and generic HTTP; business scenarios 6 / 6 (0 false positives, false negatives or inconclusive results); JSON / YAML examples (read-only exit 0, active exit 2 with external PATCH stopped before any write, 60% conclusive coverage, the mock database restored) |
|
|
31
|
+
| Runtime dependency audit | `pip-audit --strict` on the candidate: PyYAML 6.0.3, no known vulnerabilities |
|
|
32
|
+
| Generated examples | Regenerated with `scripts/verify_examples.py --update-examples`; they declare 2.7.1. Against the 2.7.0 files only the version, generation time, loopback port, result order and the User-Agent's version differ: 5 operations, 2 confirmed, 1 public and 2 secure results, 100% conclusive coverage, 21 requests |
|
|
33
|
+
| Wheel / sdist | Isolated `python -m build` from `git archive` of `37eef7b`; `twine check --strict` passed for both. Wheel: 43 files, no tests, caches or local configurations. Sdist: 196 entries (2.7.0: 195); against the 2.7.0 sdist built the same way, the only new file is `tests/test_cli_identity_guard.py` and none is missing. Metadata: `Version: 2.7.1`, the unchanged `Summary`, `Requires-Python: >=3.9`, `Requires-Dist: PyYAML>=6.0`, `License-Expression: Apache-2.0` |
|
|
34
|
+
| Clean installations | The wheel in new virtual environments on CPython 3.9.25, 3.13.18 and 3.14.6, and the sdist on 3.13.18, each outside the checkout: `granttrace --version` prints `GrantTrace 2.7.1` and `core` loads from `site-packages`; `granttrace demo` exits 0 with BOLA and mass assignment confirmed, rollback verified, the database restored and the server stopped; a scan of `https://api.example.test` without `--config` exits 2 with the refusal and writes no report. `scripts/verify_install.py --wheel` passed on the built wheel with 3.9.25 and 3.13.18: versions consistent, 0 PATCH in read-only and external active scans (the external active scan is blocked without state authority), 0 requests for the offline plan. Run from inside a virtual environment of uv's standalone CPython 3.9, the script's own venv creation fails before GrantTrace runs (the nested venv finds no standard library); it passed on 3.12.3, 3.13.18 and 3.14.6 that way |
|
|
35
|
+
| Version consistency | `pyproject.toml`, `core.__version__`, CLI, HTML and JSON reports and the HTTP User-Agent say 2.7.1. The Windows build and verification scripts, the Windows workflow's ZIP and artifact names (`GrantTrace-v2.7.1-Windows-x64`) and the packaged README and launcher derive it through `scripts/source_version.py`; the publishing workflow's manual choices include v2.7.1 |
|
|
36
|
+
| Windows x64 portable | Built from `37eef7b` (clean tree) in run 42978755524 on Windows Server 2025 with Python 3.14.5 and PyInstaller 6.22.3: `GrantTrace-v2.7.1-Windows-x64.zip`, 10,750,494 bytes, SHA256 `e69a28f35b2524ca8d53fa5dd8be43c34108bd2ce44667ced78711ed7691180b`. `scripts/verify_windows_portable.py` passed: extraction to paths with spaces and Chinese characters outside the checkout, no Python on the child PATH, `--version` and `--help`, active and read-only demos, an offline YAML plan with 0 requests, `Start-Demo.bat`, the loopback port closed and no package process left. The ZIP was not downloaded and rehashed here, and no one double-clicked it on a clean Windows machine |
|
|
37
|
+
| 2.7.1 changes | The refusal of a non-loopback scan without identities, the loopback parsing, the mock-identity warning and the dry-run guidance are covered by `tests/test_cli_identity_guard.py` (13 tests, 76 subtests), including a real scan of the loopback mock and the demo through `main()`. Detectors, evidence standards and report formats are unchanged: the JSON and HTML output snapshots are identical to 2.7.0, and the console snapshot gains only the `Scan target` line. VAmPI and crAPI were not re-run for this candidate |
|
|
38
|
+
| Secrets | A pattern scan of all 195 tracked files found no keys, tokens or JWTs; the only match is a dummy private-key marker in a redaction test. GitHub secret scanning is not enabled for the repository |
|
|
39
|
+
| Documentation | 27 Markdown files, 136 relative and same-repository links and anchors: 0 problems. `SECURITY.md`, the READMEs and the command-line reference describe the new requirement (#92); release-specific pages updated in #93 |
|
|
40
|
+
|
|
41
|
+
Local candidate hashes, built from `37eef7b` in the container:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
ca904dc0745f3d5c87d3293f8179564a3be545d56d3867812022e78d84a8a198 granttrace-2.7.1-py3-none-any.whl
|
|
45
|
+
78b09e95f05c823baa692c01e307c9145fc1e8cf20081ca3cd496659b2189155 granttrace-2.7.1.tar.gz
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The publishing workflow builds the uploaded distributions from the tag. The
|
|
49
|
+
Release's Windows ZIP and `SHA256SUMS.txt` come from the Windows workflow run on
|
|
50
|
+
the release commit itself; their hashes differ from the builds above because the
|
|
51
|
+
build records its source commit.
|
|
52
|
+
|
|
53
|
+
Still to do: CI on the release commit, then the tag, the GitHub Release with the
|
|
54
|
+
Windows assets, PyPI publishing and the post-release checks in the
|
|
55
|
+
[release checklist](docs/release-checklist.md), including a clean Windows machine.
|
|
56
|
+
|
|
6
57
|
## v2.7.0 pre-release acceptance - 2026-11-11
|
|
7
58
|
|
|
8
59
|
Status: **accepted for release; v2.7.0 is not published.** Release candidate:
|
|
@@ -21,13 +21,15 @@ from core.evidence import (
|
|
|
21
21
|
)
|
|
22
22
|
from core.models import parse_operation_key
|
|
23
23
|
from core.onboarding import (
|
|
24
|
-
display_path, init_guidance,
|
|
24
|
+
builtin_identities_warning, display_path, init_guidance, missing_identities_refusal, plan_guidance,
|
|
25
|
+
validation_failure_guidance, validation_guidance,
|
|
25
26
|
)
|
|
26
27
|
from core.parser import OpenAPIParser
|
|
27
28
|
from core.remote_refs import InvalidRemoteRefHostError, RemoteRefConfig, normalize_remote_ref_host
|
|
28
29
|
from core.reporter import SecurityReportGenerator
|
|
29
30
|
from core.reproduction import build_reproduction_templates
|
|
30
31
|
from core.sarif import SarifReportGenerator
|
|
32
|
+
from core.scan_safety import is_loopback_target
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
BANNER = rf"""
|
|
@@ -42,22 +44,29 @@ BANNER = rf"""
|
|
|
42
44
|
|
|
43
45
|
def build_argument_parser() -> argparse.ArgumentParser:
|
|
44
46
|
parser = argparse.ArgumentParser(
|
|
45
|
-
description="
|
|
47
|
+
description=("Evidence-driven, read-only authorization auditing for OpenAPI APIs: compares what "
|
|
48
|
+
"Owner, Visitor and Anonymous identities receive (BOLA/IDOR, broken authentication, "
|
|
49
|
+
"BFLA and property-level checks)"),
|
|
46
50
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
47
|
-
epilog=("Built-in local demo: granttrace demo (no spec, config or credentials needed
|
|
51
|
+
epilog=("Built-in local demo: granttrace demo (no spec, config or credentials needed; the only place\n"
|
|
52
|
+
"where active mass-assignment checks with verified rollback run)\n\n"
|
|
48
53
|
"Recommended onboarding (local preparation before any target requests):\n"
|
|
49
54
|
" 1. granttrace --spec API.yaml --init-config config.local.json\n"
|
|
50
55
|
" 2. Review and fill the config + checklist manually.\n"
|
|
51
56
|
" 3. granttrace --spec API.yaml --config config.local.json --validate-config\n"
|
|
52
57
|
" 4. granttrace --spec API.yaml --config config.local.json --dry-run\n"
|
|
53
|
-
" 5.
|
|
58
|
+
" 5. Run the read-only scan with --config and --target. A scan of a non-loopback\n"
|
|
59
|
+
" target is refused unless the configuration defines identities."),
|
|
54
60
|
)
|
|
55
61
|
parser.add_argument("--spec", "-s", default=None,
|
|
56
62
|
help="OpenAPI/Swagger JSON or YAML (default: openapi.json)")
|
|
57
63
|
parser.add_argument(
|
|
58
|
-
"--target", "-t", default="http://127.0.0.1:8080",
|
|
64
|
+
"--target", "-t", default="http://127.0.0.1:8080",
|
|
65
|
+
help="Target API base URL (default: http://127.0.0.1:8080, the bundled mock server)",
|
|
59
66
|
)
|
|
60
|
-
parser.add_argument("--config", "-c", default=None,
|
|
67
|
+
parser.add_argument("--config", "-c", default=None,
|
|
68
|
+
help="Identity, parameter and policy JSON config; its identities are required to "
|
|
69
|
+
"scan a non-loopback target")
|
|
61
70
|
parser.add_argument(
|
|
62
71
|
"--init-config", metavar="CONFIG.json", default=None,
|
|
63
72
|
help="Create an incomplete offline config and companion checklist from --spec; never overwrite files",
|
|
@@ -98,14 +107,16 @@ def build_argument_parser() -> argparse.ArgumentParser:
|
|
|
98
107
|
parser.add_argument(
|
|
99
108
|
"--allow-write-tests",
|
|
100
109
|
action="store_true",
|
|
101
|
-
help="
|
|
110
|
+
help=("Request allowlisted PATCH/PUT mass-assignment checks. Only the built-in demo can verify "
|
|
111
|
+
"state and rollback; against --target these checks stop before any write (INCONCLUSIVE)"),
|
|
102
112
|
)
|
|
103
113
|
parser.add_argument(
|
|
104
114
|
"--write-endpoint",
|
|
105
115
|
action="append",
|
|
106
116
|
default=[],
|
|
107
117
|
metavar="'PATCH /path'",
|
|
108
|
-
help="
|
|
118
|
+
help=("Select one PATCH operation for --allow-write-tests, replacing the configured allowlist; "
|
|
119
|
+
"repeat as needed. No write is sent to --target"),
|
|
109
120
|
)
|
|
110
121
|
parser.add_argument(
|
|
111
122
|
"--include-sensitive-evidence",
|
|
@@ -494,6 +505,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
|
494
505
|
_validate_report_paths(args, auditor.parser.source_files)
|
|
495
506
|
if args.dry_run:
|
|
496
507
|
return _print_dry_run(args, auditor, spec_path, config)
|
|
508
|
+
print("Scan target: " + sanitize_log_text(_display_target(args, auditor)))
|
|
497
509
|
started = time.time()
|
|
498
510
|
auditor.run()
|
|
499
511
|
elapsed = time.time() - started
|
|
@@ -589,6 +601,16 @@ def _load_scan_configuration(
|
|
|
589
601
|
print(f"[ERROR] {safe_err}", file=sys.stderr)
|
|
590
602
|
return 2, {}
|
|
591
603
|
|
|
604
|
+
# Without configured identities the auditor falls back to the built-in mock
|
|
605
|
+
# identities. Refuse a real scan of anything but this machine before any
|
|
606
|
+
# validation that could reach the network; offline dry runs stay available.
|
|
607
|
+
if not args.dry_run and not config.get("identities"):
|
|
608
|
+
safe_spec = _next_path(spec_path, _onboarding_private_values(config))
|
|
609
|
+
if not is_loopback_target(args.target):
|
|
610
|
+
_print_onboarding(missing_identities_refusal(safe_spec))
|
|
611
|
+
return 2, {}
|
|
612
|
+
_print_onboarding(builtin_identities_warning(safe_spec))
|
|
613
|
+
|
|
592
614
|
# Validate write_endpoint options if provided on CLI
|
|
593
615
|
if args.write_endpoint:
|
|
594
616
|
for item in args.write_endpoint:
|
|
@@ -647,10 +669,18 @@ def _print_dry_run(args: argparse.Namespace, auditor: APISentinelAuditor, spec_p
|
|
|
647
669
|
_print_onboarding(plan_guidance(
|
|
648
670
|
_next_path(spec_path, private_values) or "<OPENAPI_FILE>",
|
|
649
671
|
_next_path(args.config, private_values), plan,
|
|
672
|
+
builtin_identities=not config.get("identities"),
|
|
650
673
|
))
|
|
651
674
|
return 0
|
|
652
675
|
|
|
653
676
|
|
|
677
|
+
def _display_target(args: argparse.Namespace, auditor: APISentinelAuditor) -> str:
|
|
678
|
+
"""The target as reports and the console show it: sanitized, or omitted for BOPLA scans."""
|
|
679
|
+
if auditor.bopla_config:
|
|
680
|
+
return "[BOPLA TARGET OMITTED]"
|
|
681
|
+
return sanitize_url(args.target, secret_values=auditor.secret_values())
|
|
682
|
+
|
|
683
|
+
|
|
654
684
|
def _export_reports(args: argparse.Namespace, auditor: APISentinelAuditor, spec_path: str,
|
|
655
685
|
elapsed: float) -> None:
|
|
656
686
|
"""Write the HTML report and the optional JSON and SARIF exports."""
|
|
@@ -669,8 +699,7 @@ def _export_reports(args: argparse.Namespace, auditor: APISentinelAuditor, spec_
|
|
|
669
699
|
reproduction_templates = build_reproduction_templates(
|
|
670
700
|
report_findings, auditor.identity_headers("visitor"), reproduction_secrets,
|
|
671
701
|
)
|
|
672
|
-
report_target = (
|
|
673
|
-
sanitize_url(args.target, secret_values=auditor.secret_values()))
|
|
702
|
+
report_target = _display_target(args, auditor)
|
|
674
703
|
report_rbac = auditor.rbac_matrix_record()
|
|
675
704
|
SecurityReportGenerator.generate(
|
|
676
705
|
stats=report_stats,
|
|
@@ -66,6 +66,43 @@ def _first_scan(spec_path: Optional[str], config_path: Optional[str]) -> list[st
|
|
|
66
66
|
]
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
def _configure_identities(spec_path: Optional[str]) -> list[str]:
|
|
70
|
+
draft = "config.local.json"
|
|
71
|
+
return [
|
|
72
|
+
"[NEXT] 1. Draft a configuration offline (no requests are sent):",
|
|
73
|
+
_command([*_arguments(spec_path, None), "--init-config", draft]),
|
|
74
|
+
"[NEXT] 2. Fill in the Owner / Visitor test identities and resources, then validate offline:",
|
|
75
|
+
_command([*_arguments(spec_path, draft), "--validate-config"]),
|
|
76
|
+
"[NEXT] 3. Review the request plan offline:",
|
|
77
|
+
_command([*_arguments(spec_path, draft), "--dry-run", "--export-json", "plan.local.json"]),
|
|
78
|
+
"[NEXT] 4. Run the read-only scan with that configuration:",
|
|
79
|
+
_command([*_arguments(spec_path, draft), "--target", "<AUTHORIZED_TARGET_URL>",
|
|
80
|
+
"--export-json", "result.local.json"]),
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def missing_identities_refusal(spec_path: Optional[str]) -> list[str]:
|
|
85
|
+
"""Explain why a scan of a non-loopback target without identities was refused."""
|
|
86
|
+
return [
|
|
87
|
+
"[ERROR] Refusing to scan a non-loopback target without configured identities. No requests were sent.",
|
|
88
|
+
"[REASON] No identities were configured (no --config, or a configuration without an \"identities\" "
|
|
89
|
+
"section). GrantTrace would otherwise use its built-in mock identities, which exist only for the bundled "
|
|
90
|
+
"local mock server.",
|
|
91
|
+
*_configure_identities(spec_path),
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def builtin_identities_warning(spec_path: Optional[str]) -> list[str]:
|
|
96
|
+
"""Warn that the built-in mock identities, not the user's accounts, are in use."""
|
|
97
|
+
return [
|
|
98
|
+
"[WARNING] No identities configured: using GrantTrace's built-in MOCK identities (placeholder Owner and "
|
|
99
|
+
"Visitor credentials and resource IDs).",
|
|
100
|
+
"[WARNING] They exist only for the bundled local mock server. Results for any other API are not meaningful, "
|
|
101
|
+
"and a scan of a non-loopback target without configured identities is refused.",
|
|
102
|
+
*_configure_identities(spec_path),
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
|
|
69
106
|
def init_guidance(spec_path: str, config_path: str, checklist_path: str) -> list[str]:
|
|
70
107
|
return [
|
|
71
108
|
"[REVIEW] This is intentionally incomplete. No credentials, resource ownership, authorization policy, "
|
|
@@ -141,6 +178,7 @@ def validation_guidance(
|
|
|
141
178
|
|
|
142
179
|
def plan_guidance(
|
|
143
180
|
spec_path: str, config_path: Optional[str], plan: Mapping[str, object],
|
|
181
|
+
builtin_identities: bool = False,
|
|
144
182
|
) -> list[str]:
|
|
145
183
|
raw_operations = plan.get("operations")
|
|
146
184
|
operations = [item for item in raw_operations if isinstance(item, Mapping)] if isinstance(raw_operations, list) else []
|
|
@@ -165,5 +203,9 @@ def plan_guidance(
|
|
|
165
203
|
else:
|
|
166
204
|
lines.append("[MODE] Read-only plan: no active PATCH testing is enabled.")
|
|
167
205
|
lines.append("[NOTE] This local plan does not prove business authorization, readback reliability or rollback safety.")
|
|
168
|
-
|
|
206
|
+
if builtin_identities:
|
|
207
|
+
# The plan used the built-in mock identities; a real scan needs the user's own.
|
|
208
|
+
lines.extend(builtin_identities_warning(spec_path))
|
|
209
|
+
else:
|
|
210
|
+
lines.extend(_first_scan(spec_path, config_path))
|
|
169
211
|
return lines
|
|
@@ -14,11 +14,46 @@ read-only.
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
+
import ipaddress
|
|
17
18
|
import re
|
|
18
19
|
from typing import Any, Dict, Optional
|
|
19
20
|
from urllib.parse import unquote, urlsplit
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
def is_loopback_target(url: str) -> bool:
|
|
24
|
+
"""Return True only when a target URL unambiguously names this machine.
|
|
25
|
+
|
|
26
|
+
Accepted hosts are the exact name ``localhost`` and IP literals in a
|
|
27
|
+
loopback range (127.0.0.0/8, ::1 and IPv4-mapped loopback). Everything else
|
|
28
|
+
counts as remote, including look-alike names (``localhost.example.com``,
|
|
29
|
+
``127.0.0.1.nip.io``), a trailing-dot ``localhost.``, shortened, integer or
|
|
30
|
+
non-ASCII IPv4 spellings, IPv6 zone indexes, user information, and any URL
|
|
31
|
+
with whitespace, control characters or backslashes that parsers may read
|
|
32
|
+
differently. A wrong "remote" answer only makes the caller stricter.
|
|
33
|
+
"""
|
|
34
|
+
if not isinstance(url, str) or any(ord(character) <= 32 or ord(character) == 127 for character in url):
|
|
35
|
+
return False
|
|
36
|
+
try:
|
|
37
|
+
parts = urlsplit(url)
|
|
38
|
+
hostname = parts.hostname
|
|
39
|
+
_ = parts.port # an invalid port raises ValueError here
|
|
40
|
+
except ValueError:
|
|
41
|
+
return False
|
|
42
|
+
if (parts.scheme not in {"http", "https"} or not hostname or not hostname.isascii()
|
|
43
|
+
or "\\" in parts.netloc or "%" in hostname
|
|
44
|
+
or parts.username is not None or parts.password is not None):
|
|
45
|
+
return False
|
|
46
|
+
if hostname == "localhost":
|
|
47
|
+
return True
|
|
48
|
+
try:
|
|
49
|
+
address = ipaddress.ip_address(hostname)
|
|
50
|
+
except ValueError:
|
|
51
|
+
return False
|
|
52
|
+
if isinstance(address, ipaddress.IPv6Address) and address.ipv4_mapped is not None:
|
|
53
|
+
return address.ipv4_mapped.is_loopback
|
|
54
|
+
return address.is_loopback
|
|
55
|
+
|
|
56
|
+
|
|
22
57
|
_PATH_CONTROL = re.compile(r"[\x00-\x1f\x7f-\x9f\\]")
|
|
23
58
|
_BAD_PATH_ESCAPE = re.compile(r"%(?![0-9a-fA-F]{2})")
|
|
24
59
|
_PATH_ESCAPE = re.compile(r"%[0-9a-fA-F]{2}")
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
| 参数 | 含义 |
|
|
8
8
|
|---|---|
|
|
9
|
+
| `--target URL` | 目标 API 基础地址,默认 `http://127.0.0.1:8080`(仓库自带的 mock)。真实扫描回环地址(`localhost`、`127.0.0.0/8`、`::1`)以外的目标时,必须由 `--config` 提供 identities;否则拒绝运行、返回 2,且不发送任何请求,而不是改用只适用于自带 mock 的内置 Mock 身份。`--init-config`、`--validate-config`、`--dry-run` 不受影响 |
|
|
9
10
|
| `--init-config FILE` | 离线生成待填写配置和相邻 checklist;未完成草稿不能扫描 |
|
|
10
11
|
| `--validate-config` | 离线检查配置并退出(检查通过含 warning 返回 0,错误返回 2),不发送网络请求 |
|
|
11
12
|
| `--allow-write-tests` | 允许执行允许清单内的 PATCH 写入、读回和回滚检查。对命令行指定的外部目标,工具无法核验权威资源状态,这些检查在任何写入前停止并记为 `INCONCLUSIVE`(`unverified_state_authority`);完整写入流程只在内置 demo 中运行 |
|
|
Binary file
|
|
@@ -54,7 +54,7 @@ not detection rates: none of these tools was run on the targets of the
|
|
|
54
54
|
re-authentication with its chains.
|
|
55
55
|
- **Write operations, any HTTP method, or flows across requests:** the Burp
|
|
56
56
|
extensions, ZAP and Akto send whatever their tables, contexts or templates
|
|
57
|
-
contain. GrantTrace 2.7.
|
|
57
|
+
contain. GrantTrace 2.7.1 reads only: GET, plus query-style POST operations
|
|
58
58
|
you declare `read_only`.
|
|
59
59
|
- **API discovery from live traffic and a large test library:** Akto builds its
|
|
60
60
|
inventory from traffic connectors and runs templated tests across many
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
# GrantTrace 2.7.
|
|
1
|
+
# GrantTrace 2.7.1 Windows 便携包
|
|
2
2
|
|
|
3
|
-
分发文件为 `GrantTrace-v2.7.
|
|
3
|
+
分发文件为 `GrantTrace-v2.7.1-Windows-x64.zip`。用户解压整个 ZIP 后双击
|
|
4
4
|
`Start-Demo.bat` 即可运行内置 demo,无需安装 Python 或修改系统 PATH。
|
|
5
|
-
程序版本为 `GrantTrace 2.7.
|
|
6
|
-
|
|
5
|
+
程序版本为 `GrantTrace 2.7.1`,是 2.7.0 的维护版本:没有配置 identities 时拒绝扫描
|
|
6
|
+
本机以外的目标,并修正命令行说明和文档;检测器与证据标准不变,详见 [CHANGELOG](../CHANGELOG.md)。
|
|
7
|
+
内置 demo 的行为与 2.7.0 相同。
|
|
7
8
|
推荐 Windows 10 / 11(64 位)。启动器自动打开 HTML 并打印确切路径;报告保存在
|
|
8
9
|
解压目录的 `granttrace-demo/session-*/run-*/`,每次运行使用新的目录。
|
|
9
10
|
|
|
@@ -41,7 +42,7 @@ $version = .\dist\windows-build-env\Scripts\python.exe scripts/source_version.py
|
|
|
41
42
|
- `dist/windows-portable-build.json`:记录源码 commit、工具版本、EXE / ZIP 大小与哈希。
|
|
42
43
|
- `dist/windows-portable-verification.json`:记录实际验证结果,供维护者复核。
|
|
43
44
|
|
|
44
|
-
验证时使用 ZIP 解压后的程序,确认 `--version` 输出 `GrantTrace 2.7.
|
|
45
|
+
验证时使用 ZIP 解压后的程序,确认 `--version` 输出 `GrantTrace 2.7.1`,
|
|
45
46
|
`--help` 可用,内置 demo 能生成 HTML / JSON 报告,关闭本机服务并完整恢复数据。
|
|
46
47
|
每次重新构建后,维护者仍应在含空格和中文的目录人工双击 `Start-Demo.bat`,确认正常完成且报告可以打开。
|
|
47
48
|
自动验证会实际将 ZIP 解压到仓库外的空格、中文路径,从空目录启动程序;
|
|
@@ -64,7 +65,7 @@ CI 为避免打开浏览器设置 `GRANTTRACE_DEMO_NO_OPEN=1`;正常双击仍
|
|
|
64
65
|
|
|
65
66
|
这些步骤用于维护者验证构建产物,不会替换已经提供的 Release 附件。
|
|
66
67
|
|
|
67
|
-
构建与验收结果记录在 [VERIFICATION.md](../VERIFICATION.md)。2.6.0 与 2.7.
|
|
68
|
+
构建与验收结果记录在 [VERIFICATION.md](../VERIFICATION.md)。2.6.0、2.7.0 与 2.7.1 的发布准备均在 Linux 上进行,
|
|
68
69
|
没有本地 Windows 构建;便携包由 Windows x64 portable CI 在发布提交上构建并自动验收,
|
|
69
70
|
Release 附件取自该次运行的 artifact。2.5.3 的历史本地准备输出曾位于 `dist/v2.5.3-windows/`。
|
|
70
71
|
自动 smoke 通过 `GRANTTRACE_DEMO_NO_OPEN=1`
|
|
@@ -18,8 +18,8 @@ bundled mock, then copies the reports of a fresh demo run here.
|
|
|
18
18
|
`tests/test_committed_examples.py` fails when the committed reports no longer
|
|
19
19
|
match a fresh demo run.
|
|
20
20
|
|
|
21
|
-
These reports were regenerated from the built-in demo for 2.7.
|
|
22
|
-
version 2.7.
|
|
21
|
+
These reports were regenerated from the built-in demo for 2.7.1 and declare
|
|
22
|
+
version 2.7.1; see [CHANGELOG.md](../CHANGELOG.md) for the changes since 2.7.0.
|
|
23
23
|
The demo's results are recorded in completion order, which can differ between
|
|
24
24
|
runs. The JSON records
|
|
25
25
|
the UTC generation time; the demo chose the loopback port for that run, so the
|