websec-validator 0.20.0__tar.gz → 0.21.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 (236) hide show
  1. {websec_validator-0.20.0/src/websec_validator.egg-info → websec_validator-0.21.0}/PKG-INFO +23 -8
  2. {websec_validator-0.20.0 → websec_validator-0.21.0}/README.md +22 -7
  3. {websec_validator-0.20.0 → websec_validator-0.21.0}/pyproject.toml +1 -1
  4. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/calibration.json +1 -1
  5. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/calibration.py +26 -7
  6. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/cli.py +14 -2
  7. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/coverage.py +9 -4
  8. websec_validator-0.21.0/src/websec_validator/extractors/assigned_flow.py +251 -0
  9. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/authz.py +56 -10
  10. websec_validator-0.21.0/src/websec_validator/extractors/connexion_routes.py +242 -0
  11. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/crypto_usage.py +216 -5
  12. websec_validator-0.21.0/src/websec_validator/extractors/django_responses.py +139 -0
  13. websec_validator-0.21.0/src/websec_validator/extractors/framework_auth.py +157 -0
  14. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/llm_security.py +59 -2
  15. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/pii_exposure.py +40 -5
  16. websec_validator-0.21.0/src/websec_validator/extractors/python_uploads.py +258 -0
  17. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/routes.py +25 -12
  18. websec_validator-0.21.0/src/websec_validator/extractors/schemas.py +286 -0
  19. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/sql_flow.py +27 -9
  20. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/surface.py +72 -3
  21. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/syntax.py +25 -1
  22. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/transport_security.py +25 -0
  23. websec_validator-0.21.0/src/websec_validator/extractors/trpc_routes.py +219 -0
  24. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/upload_security.py +124 -27
  25. websec_validator-0.21.0/src/websec_validator/literal_yaml.py +198 -0
  26. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/mcp_server.py +39 -0
  27. websec_validator-0.21.0/src/websec_validator/templates/probes/race-conditions.py +93 -0
  28. {websec_validator-0.20.0 → websec_validator-0.21.0/src/websec_validator.egg-info}/PKG-INFO +23 -8
  29. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator.egg-info/SOURCES.txt +20 -0
  30. websec_validator-0.21.0/tests/test_brief_artifacts.py +93 -0
  31. websec_validator-0.21.0/tests/test_compare_reports.py +205 -0
  32. websec_validator-0.21.0/tests/test_connexion_yaml.py +151 -0
  33. websec_validator-0.21.0/tests/test_container_contracts.py +83 -0
  34. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_detector_fp_followups.py +7 -3
  35. websec_validator-0.21.0/tests/test_django_responses.py +120 -0
  36. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_explained_brief.py +22 -5
  37. websec_validator-0.21.0/tests/test_language_fixtures.py +54 -0
  38. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_mcp_security.py +43 -0
  39. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_pii_projection_fp.py +6 -1
  40. websec_validator-0.21.0/tests/test_precommit_lifecycle.py +106 -0
  41. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_probe_transport_boundaries.py +68 -6
  42. websec_validator-0.21.0/tests/test_python_uploads.py +146 -0
  43. websec_validator-0.21.0/tests/test_retained_calibration.py +98 -0
  44. websec_validator-0.21.0/tests/test_retained_flows.py +123 -0
  45. websec_validator-0.21.0/tests/test_retained_frameworks.py +379 -0
  46. websec_validator-0.21.0/tests/test_retained_precision.py +276 -0
  47. websec_validator-0.21.0/tests/test_trpc_routes.py +139 -0
  48. websec_validator-0.20.0/src/websec_validator/extractors/schemas.py +0 -153
  49. websec_validator-0.20.0/src/websec_validator/templates/probes/race-conditions.py +0 -99
  50. {websec_validator-0.20.0 → websec_validator-0.21.0}/LICENSE +0 -0
  51. {websec_validator-0.20.0 → websec_validator-0.21.0}/setup.cfg +0 -0
  52. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/__init__.py +0 -0
  53. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/agenthook.py +0 -0
  54. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/attest.py +0 -0
  55. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/attribution.py +0 -0
  56. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/baseline.py +0 -0
  57. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/briefing.py +0 -0
  58. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/clusters.py +0 -0
  59. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/constitution.py +0 -0
  60. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/corpus.json +0 -0
  61. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/dast_ingest.py +0 -0
  62. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/dast_predict.py +0 -0
  63. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/demo.py +0 -0
  64. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/diffscope.py +0 -0
  65. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/dynamic.py +0 -0
  66. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/enrichment.py +0 -0
  67. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/explain.py +0 -0
  68. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/__init__.py +0 -0
  69. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/agent_config.py +0 -0
  70. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/auth.py +0 -0
  71. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/authz_dataflow.py +0 -0
  72. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/base.py +0 -0
  73. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/client_exposure.py +0 -0
  74. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/client_integrity.py +0 -0
  75. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/dependencies.py +0 -0
  76. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/django_urls.py +0 -0
  77. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/graphql.py +0 -0
  78. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/iac_ci.py +0 -0
  79. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/integrations.py +0 -0
  80. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/policy_consistency.py +0 -0
  81. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/profiles.py +0 -0
  82. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/stack.py +0 -0
  83. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/tenant.py +0 -0
  84. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/extractors/webext.py +0 -0
  85. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/feedback.py +0 -0
  86. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/findings.py +0 -0
  87. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/fixprompt.py +0 -0
  88. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/formats.py +0 -0
  89. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/fpfilter.py +0 -0
  90. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/gate.py +0 -0
  91. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/git_read.py +0 -0
  92. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/graph_enrich.py +0 -0
  93. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/hooks.py +0 -0
  94. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/init_scope.py +0 -0
  95. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/install.py +0 -0
  96. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/intel.py +0 -0
  97. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/inventory.py +0 -0
  98. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/openapi.py +0 -0
  99. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/output.py +0 -0
  100. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/pairs.json +0 -0
  101. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/probes.py +0 -0
  102. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/proof.py +0 -0
  103. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/provenance.py +0 -0
  104. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/recon.py +0 -0
  105. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/registry.py +0 -0
  106. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/repairs.py +0 -0
  107. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/report.py +0 -0
  108. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/research/control-scope-cases.json +0 -0
  109. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/research/example.json +0 -0
  110. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/research/profile-cases.json +0 -0
  111. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/research.py +0 -0
  112. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
  113. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
  114. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/sarif_ingest.py +0 -0
  115. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/scanners.py +0 -0
  116. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/schemas/coverage.schema.json +0 -0
  117. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/schemas/facts.schema.json +0 -0
  118. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/schemas/ledger.schema.json +0 -0
  119. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/synthetic.py +0 -0
  120. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/demo/app.py.txt +0 -0
  121. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
  122. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/_lib.bash +0 -0
  123. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/_lib.py +0 -0
  124. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
  125. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
  126. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
  127. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
  128. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
  129. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
  130. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
  131. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
  132. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
  133. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
  134. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/forged-token.sh +0 -0
  135. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
  136. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
  137. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
  138. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
  139. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
  140. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
  141. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
  142. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
  143. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
  144. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
  145. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
  146. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
  147. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
  148. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
  149. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
  150. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
  151. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/testplan.py +0 -0
  152. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator/updates.py +0 -0
  153. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator.egg-info/dependency_links.txt +0 -0
  154. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator.egg-info/entry_points.txt +0 -0
  155. {websec_validator-0.20.0 → websec_validator-0.21.0}/src/websec_validator.egg-info/top_level.txt +0 -0
  156. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_action_contracts.py +0 -0
  157. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_adoption_contracts.py +0 -0
  158. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_agent_hook.py +0 -0
  159. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_agent_hosts.py +0 -0
  160. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_agent_launch_specs.py +0 -0
  161. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_analysis_scope.py +0 -0
  162. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_assurance_regressions.py +0 -0
  163. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_attest.py +0 -0
  164. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_attribution.py +0 -0
  165. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_auth_control_scope.py +0 -0
  166. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_calibration_claimspec.py +0 -0
  167. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_calibration_review.py +0 -0
  168. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_calibration_scoring.py +0 -0
  169. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_constitution.py +0 -0
  170. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_control_scope_research.py +0 -0
  171. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_coverage.py +0 -0
  172. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_crypto_comparisons.py +0 -0
  173. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_dast_ingest.py +0 -0
  174. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_dast_predict.py +0 -0
  175. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_demo.py +0 -0
  176. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_detector_precision.py +0 -0
  177. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_diffscope.py +0 -0
  178. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_django_routes.py +0 -0
  179. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_dynamic_login_shape.py +0 -0
  180. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_enrichment.py +0 -0
  181. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_entitlement_webext.py +0 -0
  182. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_evidence_verdicts.py +0 -0
  183. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_explain.py +0 -0
  184. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_extension_controls.py +0 -0
  185. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_feedback.py +0 -0
  186. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_feedback_calibration_loop.py +0 -0
  187. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_field_report_2026_09.py +0 -0
  188. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_fixprompt_fpfilter.py +0 -0
  189. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_formats.py +0 -0
  190. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_fp_sources.py +0 -0
  191. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_gate_and_bypass_record.py +0 -0
  192. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_gate_command.py +0 -0
  193. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_gate_policy_and_scope.py +0 -0
  194. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_gitleaks_worktree.py +0 -0
  195. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_graph_enrich.py +0 -0
  196. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_hardening.py +0 -0
  197. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_hooks.py +0 -0
  198. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_hooks_contracts.py +0 -0
  199. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_ignore_claimspec.py +0 -0
  200. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_install.py +0 -0
  201. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_install_contracts.py +0 -0
  202. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_intel.py +0 -0
  203. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_inventory.py +0 -0
  204. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_issue_147_sarif_locations.py +0 -0
  205. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_lifecycle.py +0 -0
  206. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_mcp.py +0 -0
  207. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_openapi.py +0 -0
  208. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_output_boundaries.py +0 -0
  209. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_pentest_regressions.py +0 -0
  210. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_profiles.py +0 -0
  211. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_proof_revisions.py +0 -0
  212. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_provenance.py +0 -0
  213. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_public_precision.py +0 -0
  214. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_read_boundary.py +0 -0
  215. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_read_performance.py +0 -0
  216. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_recon.py +0 -0
  217. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_registry_existence.py +0 -0
  218. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_remaining_control_scope.py +0 -0
  219. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_research.py +0 -0
  220. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_research_cli.py +0 -0
  221. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_sarif_ingest.py +0 -0
  222. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_sarif_workbench.py +0 -0
  223. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_scanner_contracts.py +0 -0
  224. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_security_fix_boundaries.py +0 -0
  225. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_source_budget.py +0 -0
  226. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_sql_flow.py +0 -0
  227. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_stack_metadata.py +0 -0
  228. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_synthetic_pairs.py +0 -0
  229. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_testplan.py +0 -0
  230. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_transport_pii_scope.py +0 -0
  231. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_transport_stack_scope.py +0 -0
  232. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_triage.py +0 -0
  233. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_unanalyzed_cli.py +0 -0
  234. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_unanalyzed_coverage.py +0 -0
  235. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_updates.py +0 -0
  236. {websec_validator-0.20.0 → websec_validator-0.21.0}/tests/test_workbench_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: websec-validator
3
- Version: 0.20.0
3
+ Version: 0.21.0
4
4
  Summary: Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app.
5
5
  Author: Ricardo Accioly
6
6
  License: MIT
@@ -41,19 +41,21 @@ A senior pentester's "here's what to test and how" handoff — auto-generated fr
41
41
  <!-- docguard:quality negation-load off — "no LLM / no server / no running app / not a SaaS / never touches prod" is this tool's core positioning; defining it by contrast with the scanners-and-SaaS it deliberately is NOT is intentional, not a phrasing defect. -->
42
42
 
43
43
  > Local-first security recon that **briefs your AI coding agent**. It does the deterministic
44
- > half — read the repo, map the full attack surface, and stage a probe library tailored to what it
44
+ > half — read supported source, map the visible attack surface, and stage a probe library tailored to what it
45
45
  > found — then hands your agent (Claude Code, Codex, Gemini, Cursor) a marching-orders briefing.
46
46
  > `websec run` needs nothing but the code; add `--scan` to also run and de-duplicate whichever
47
- > static scanners you have installed. **Code in, artifacts out. No LLM in the tool, no server, no
48
- > running app required.**
47
+ > static scanners you have installed. **Code in, artifacts out. No LLM in the tool; no server or
48
+ > running app required for the core pass.**
49
49
 
50
50
  [![websec-validator demo](assets/demo.gif)](assets/demo.gif)
51
51
 
52
52
  **New here?** Read the eight-page technical brief — what it reads, how a finding earns its severity,
53
53
  what it refuses to say, and the field evidence:
54
54
  **[raccioly.github.io/websec-validator](https://raccioly.github.io/websec-validator/websec-explained.html)**
55
- · [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). Every number in it is
56
- asserted against this tree by `tests/test_explained_brief.py`, so it cannot drift silently.
55
+ · [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). The reviewed v0.21.0 snapshot
56
+ has selected fact assertions in `tests/test_explained_brief.py` and an HTML/PDF/renderer hash binding
57
+ in `tests/test_brief_artifacts.py`. Prose accuracy and rendered layout still require review;
58
+ see [rebuilding the brief](CONTRIBUTING.md#publishing-the-technical-brief).
57
59
 
58
60
  It is *not* an autonomous scanner and *not* a SaaS. It's the missing front-half: the thing that
59
61
  turns a repo into a precise, fact-grounded security brief an AI agent (with a human in the loop)
@@ -123,8 +125,8 @@ Requires **Python 3.11+** (on stock macOS, `python3` is often 3.9 — use `pipx`
123
125
  interpreter, or install via Homebrew/pyenv). Zero Python runtime dependencies: it shells out to
124
126
  scanners (Trivy, OSV-Scanner, Gitleaks, Semgrep/OpenGrep, Checkov, Prowler) and Noir **when present**,
125
127
  plus **per-language SAST auto-selected by stack** — Bandit (Python), gosec (Go), Brakeman (Rails) —
126
- each fired only when its language is detected. It reports what's missing and never hard-fails if a tool
127
- is absent.
128
+ each fired only when its language is detected. Unselected missing tools are reported as limitations;
129
+ a missing explicitly requested scanner is an execution gap and cannot pass completeness gating.
128
130
 
129
131
  ### Or run via Docker (scanners bundled, zero install)
130
132
 
@@ -144,6 +146,11 @@ Noir is the route engine and runs on every `run`, but the four static scanners e
144
146
  `--scan` — a plain `run` lists them and prints `(add --scan to execute them)`, exactly as it does
145
147
  outside Docker. Mount your repo at `/scan`; artifacts land in `/scan/websec-out`.
146
148
 
149
+ For a scanner-free image, use `docker build --target core -t websec-core .`. Both image targets
150
+ run non-root and explicitly disable recurring health checks for the one-shot CLI. Native amd64 and
151
+ arm64 contract jobs execute source-only fixtures and bundled executable version checks. Base/archive
152
+ digest checks do not make apt/transitive builds fully reproducible or certify every scanner adapter.
153
+
147
154
  ## Usage
148
155
 
149
156
  ```bash
@@ -761,6 +768,14 @@ The [remaining-work specification](specs/001-continuous-security-improvement/spe
761
768
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
762
769
  Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
763
770
 
771
+ 0.21.0 adds bounded Connexion JSON/literal-YAML registration, FastAPI dependency and mounted tRPC
772
+ middleware observations, returned-template Django CSP, actual Flask model columns, and local assigned
773
+ SQL/command/upload provenance. These source observations are not whole-program or deployment proof.
774
+ It also hardens MCP overload handling, separates reviewed calibration labels and validates real
775
+ disposable hook/native container contracts. The [0.21.0 migration notes](docs/MIGRATING-0.21.0.md)
776
+ explain changed findings and unchanged consent/exit contracts. Offline competitor-report imports are
777
+ documented in [BENCHMARKS.md](BENCHMARKS.md); no head-to-head or agent-benefit measurement is claimed.
778
+
764
779
  ## Using it as a Claude Code skill / plugin
765
780
 
766
781
  This repo **is** a Claude Code plugin. Install it once —
@@ -12,19 +12,21 @@ A senior pentester's "here's what to test and how" handoff — auto-generated fr
12
12
  <!-- docguard:quality negation-load off — "no LLM / no server / no running app / not a SaaS / never touches prod" is this tool's core positioning; defining it by contrast with the scanners-and-SaaS it deliberately is NOT is intentional, not a phrasing defect. -->
13
13
 
14
14
  > Local-first security recon that **briefs your AI coding agent**. It does the deterministic
15
- > half — read the repo, map the full attack surface, and stage a probe library tailored to what it
15
+ > half — read supported source, map the visible attack surface, and stage a probe library tailored to what it
16
16
  > found — then hands your agent (Claude Code, Codex, Gemini, Cursor) a marching-orders briefing.
17
17
  > `websec run` needs nothing but the code; add `--scan` to also run and de-duplicate whichever
18
- > static scanners you have installed. **Code in, artifacts out. No LLM in the tool, no server, no
19
- > running app required.**
18
+ > static scanners you have installed. **Code in, artifacts out. No LLM in the tool; no server or
19
+ > running app required for the core pass.**
20
20
 
21
21
  [![websec-validator demo](assets/demo.gif)](assets/demo.gif)
22
22
 
23
23
  **New here?** Read the eight-page technical brief — what it reads, how a finding earns its severity,
24
24
  what it refuses to say, and the field evidence:
25
25
  **[raccioly.github.io/websec-validator](https://raccioly.github.io/websec-validator/websec-explained.html)**
26
- · [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). Every number in it is
27
- asserted against this tree by `tests/test_explained_brief.py`, so it cannot drift silently.
26
+ · [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). The reviewed v0.21.0 snapshot
27
+ has selected fact assertions in `tests/test_explained_brief.py` and an HTML/PDF/renderer hash binding
28
+ in `tests/test_brief_artifacts.py`. Prose accuracy and rendered layout still require review;
29
+ see [rebuilding the brief](CONTRIBUTING.md#publishing-the-technical-brief).
28
30
 
29
31
  It is *not* an autonomous scanner and *not* a SaaS. It's the missing front-half: the thing that
30
32
  turns a repo into a precise, fact-grounded security brief an AI agent (with a human in the loop)
@@ -94,8 +96,8 @@ Requires **Python 3.11+** (on stock macOS, `python3` is often 3.9 — use `pipx`
94
96
  interpreter, or install via Homebrew/pyenv). Zero Python runtime dependencies: it shells out to
95
97
  scanners (Trivy, OSV-Scanner, Gitleaks, Semgrep/OpenGrep, Checkov, Prowler) and Noir **when present**,
96
98
  plus **per-language SAST auto-selected by stack** — Bandit (Python), gosec (Go), Brakeman (Rails) —
97
- each fired only when its language is detected. It reports what's missing and never hard-fails if a tool
98
- is absent.
99
+ each fired only when its language is detected. Unselected missing tools are reported as limitations;
100
+ a missing explicitly requested scanner is an execution gap and cannot pass completeness gating.
99
101
 
100
102
  ### Or run via Docker (scanners bundled, zero install)
101
103
 
@@ -115,6 +117,11 @@ Noir is the route engine and runs on every `run`, but the four static scanners e
115
117
  `--scan` — a plain `run` lists them and prints `(add --scan to execute them)`, exactly as it does
116
118
  outside Docker. Mount your repo at `/scan`; artifacts land in `/scan/websec-out`.
117
119
 
120
+ For a scanner-free image, use `docker build --target core -t websec-core .`. Both image targets
121
+ run non-root and explicitly disable recurring health checks for the one-shot CLI. Native amd64 and
122
+ arm64 contract jobs execute source-only fixtures and bundled executable version checks. Base/archive
123
+ digest checks do not make apt/transitive builds fully reproducible or certify every scanner adapter.
124
+
118
125
  ## Usage
119
126
 
120
127
  ```bash
@@ -732,6 +739,14 @@ The [remaining-work specification](specs/001-continuous-security-improvement/spe
732
739
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
733
740
  Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
734
741
 
742
+ 0.21.0 adds bounded Connexion JSON/literal-YAML registration, FastAPI dependency and mounted tRPC
743
+ middleware observations, returned-template Django CSP, actual Flask model columns, and local assigned
744
+ SQL/command/upload provenance. These source observations are not whole-program or deployment proof.
745
+ It also hardens MCP overload handling, separates reviewed calibration labels and validates real
746
+ disposable hook/native container contracts. The [0.21.0 migration notes](docs/MIGRATING-0.21.0.md)
747
+ explain changed findings and unchanged consent/exit contracts. Offline competitor-report imports are
748
+ documented in [BENCHMARKS.md](BENCHMARKS.md); no head-to-head or agent-benefit measurement is claimed.
749
+
735
750
  ## Using it as a Claude Code skill / plugin
736
751
 
737
752
  This repo **is** a Claude Code plugin. Install it once —
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "websec-validator"
7
- version = "0.20.0"
7
+ version = "0.21.0"
8
8
  description = "Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -24,7 +24,7 @@
24
24
  "caveat": "indicative \u2014 calibrated on a deliberately-vulnerable app corpus; skews optimistic on clean production code",
25
25
  "evidence_status": "reviewed",
26
26
  "reviewed_on": "2026-09-22",
27
- "limitation": "21 of 56 corpus findings carry a reviewed label; the other 35 are UNKNOWN and are excluded from every count rather than treated as false. All per-class cells except missing-auth|MEDIUM (n=7) are below min_n=5, so every other class falls back to the per-label tier. Measured after the 2026-09-22 false-positive fixes (vendored assets, spec-as-handler, Express route middleware, displayed source), so these rates describe the current detector and not any earlier one."
27
+ "limitation": "Dated 2026-09-22 detector snapshot: 21 of 56 corpus findings carry a reviewed label; the other 35 are UNKNOWN and excluded rather than treated as false. All per-class cells except missing-auth|MEDIUM (n=7) are below min_n=5, so every other class falls back to the per-label tier. These measurements were not rebuilt for subsequent detector changes and do not measure the current build."
28
28
  },
29
29
  "by_class_label": {
30
30
  "command-injection|LOW": {
@@ -126,7 +126,7 @@ REVIEWED_STATUS = "reviewed"
126
126
 
127
127
 
128
128
  def reviewed_classes(corpus: list) -> set:
129
- """Attack classes with at least one REVIEWED truth entry — the only ones eligible for a
129
+ """Attack classes whose EVERY truth entry is reviewed — the only ones eligible for a
130
130
  class-specific published cell.
131
131
 
132
132
  A truth entry qualifies when `review_status` is "reviewed" AND `is_real` is an explicit
@@ -137,13 +137,15 @@ def reviewed_classes(corpus: list) -> set:
137
137
  honest. Relabelling requires cloning the pinned revision and reviewing each finding by hand;
138
138
  there is deliberately no code path that promotes an unreviewed entry.
139
139
  """
140
- out = set()
140
+ out, unresolved = set(), set()
141
141
  for entry in corpus or []:
142
142
  for truth in entry.get("truth") or []:
143
143
  if truth.get("review_status") == REVIEWED_STATUS and isinstance(truth.get("is_real"), bool):
144
144
  if truth.get("class"):
145
145
  out.add(truth["class"])
146
- return out
146
+ elif truth.get("class"):
147
+ unresolved.add(truth["class"])
148
+ return out - unresolved
147
149
 
148
150
 
149
151
  def fit(labeled: list, corpus_names: list, researched_classes: set | None = None) -> dict:
@@ -170,7 +172,7 @@ def fit(labeled: list, corpus_names: list, researched_classes: set | None = None
170
172
  if researched_classes is not None:
171
173
  rc = set(researched_classes)
172
174
  cells = {k: c for k, c in cells.items() if k.split("|", 1)[0] in rc}
173
- return {
175
+ table = {
174
176
  "meta": {"corpus": corpus_names, "n_total": len(labeled) - unknown, "n_unknown": unknown,
175
177
  "method": "binomial proportion + Wilson 95% CI", "min_n": MIN_N,
176
178
  "unmatched_rule": "unmatched finding = unknown (excluded from calibration)",
@@ -180,6 +182,8 @@ def fit(labeled: list, corpus_names: list, researched_classes: set | None = None
180
182
  "by_label": {k: _cell(v[0], v[1]) for k, v in sorted(by_l.items())},
181
183
  "prior": PRIOR,
182
184
  }
185
+ table['meta']['score'] = brier(labeled, table)
186
+ return table
183
187
 
184
188
 
185
189
  def load_shipped() -> dict | None:
@@ -218,6 +222,10 @@ def _merge(shipped: dict | None, local: dict | None) -> dict | None:
218
222
  base.setdefault("meta", {})
219
223
  if local:
220
224
  local = _upgrade_local(local)
225
+ shipped_score = base['meta'].pop('score', None)
226
+ base['meta']['source_scores'] = {
227
+ 'shipped_snapshot': shipped_score, 'local_evidence': local.get('meta', {}).get('score'),
228
+ 'note': 'Separate source-table scores; no score of merged predictions is available.'}
221
229
  for grp in ("by_class_label", "by_label"):
222
230
  merged = dict(base.get(grp, {}))
223
231
  for key, lc in (local.get(grp, {}) or {}).items():
@@ -288,6 +296,8 @@ def record_samples(labeled: list, runs: int = 1) -> dict | None:
288
296
  added += 1
289
297
  local["meta"]["samples"] = local["meta"].get("samples", 0) + added
290
298
  local["meta"]["runs"] = local["meta"].get("runs", 0) + (runs if added else 0)
299
+ # Score the local evidence table separately, not the shipped corpus or authored pairs.
300
+ local['meta']['score'] = brier(list(local.get('observations', {}).values()), _merge(None, local))
291
301
  _write_local(local)
292
302
  return local
293
303
  except Exception:
@@ -411,8 +421,13 @@ def review_candidate(candidate_id: str, *, accept: bool, reason: str = "",
411
421
  "detector_revision": row.get("detector_revision", ""),
412
422
  "analyzed_input_digest": row.get("analyzed_input_digest", ""),
413
423
  "fingerprint": row.get("fingerprint", "")}}
414
- record_samples([sample])
415
- return {"ok": True, "error": "", "candidate": dict(row, state="accepted")}
424
+ stored = record_samples([sample])
425
+ if stored is None:
426
+ pending[candidate_id] = row
427
+ _write_local(local)
428
+ return {'ok': False, 'error': 'reviewed sample could not be persisted; candidate remains pending', 'candidate': row}
429
+ return {"ok": True, "error": "", "candidate": dict(row, state="accepted"),
430
+ 'score': stored.get('meta', {}).get('score')}
416
431
 
417
432
 
418
433
  def _write_local(local: dict) -> None:
@@ -458,13 +473,17 @@ def fit_synthetic(pairs: list) -> dict:
458
473
  cell = group.setdefault(key, [0, 0])
459
474
  cell[1] += 1
460
475
  cell[0] += int(row["is_real"])
461
- return {"meta": {"basis": "synthetic-paired", "n_total": len(pairs or []),
476
+ known = sum(isinstance(row.get('is_real'), bool) for row in pairs or [])
477
+ table = {"meta": {"basis": "synthetic-paired", "n_total": known,
478
+ "n_unknown": len(pairs or []) - known,
462
479
  "method": "binomial proportion + Wilson 95% CI", "min_n": MIN_N,
463
480
  "caveat": SYNTHETIC_CAVEAT,
464
481
  "never_merged": "apply() does not read this table; it is reported beside the "
465
482
  "measured one, never summed into it"},
466
483
  "by_class_label": {k: _cell(v[0], v[1]) for k, v in sorted(by_cl.items())},
467
484
  "by_label": {k: _cell(v[0], v[1]) for k, v in sorted(by_l.items())}}
485
+ table['meta']['score'] = brier(pairs, table)
486
+ return table
468
487
 
469
488
 
470
489
  def write_synthetic(table: dict) -> Path:
@@ -1389,13 +1389,16 @@ def cmd_calibrate(args) -> int:
1389
1389
  return 2
1390
1390
  row = result["candidate"]
1391
1391
  if getattr(args, "format", None) == "json":
1392
- _emit_json_result({"candidate": row})
1392
+ _emit_json_result({"candidate": row, 'score': result.get('score')})
1393
1393
  return 0
1394
1394
  if row["state"] == "accepted":
1395
1395
  print(f"accepted {row['candidate_id']}: recorded one is_real=False sample for "
1396
1396
  f"{row['attack_class']}|{row['confidence']} in {calibration.LOCAL_PATH}.")
1397
1397
  est = calibration.apply(row["attack_class"], row["confidence"], calibration.load())
1398
1398
  print(f" bucket now p={est['p']} ci={est['ci']} n={est['n']} basis={est['basis']}")
1399
+ score = result.get('score')
1400
+ if score:
1401
+ print(f" Local-evidence Brier {score['brier']} on {score['n']} label(s); reported, not optimized.")
1399
1402
  else:
1400
1403
  print(f"rejected {row['candidate_id']}: discarded, no probability changed.")
1401
1404
  return 0
@@ -1424,6 +1427,9 @@ def cmd_calibrate(args) -> int:
1424
1427
  print(f" {key + ' (aggregate)':28} {cell['k']}/{cell['n']} · p={cell['p']} · 95% CI {cell['ci']}")
1425
1428
  for err in res["errors"]:
1426
1429
  print(f" ! {err.get('pair')}: {err.get('error')}")
1430
+ score = table['meta'].get('score')
1431
+ if score:
1432
+ print(f" Authored-pair Brier {score['brier']} on {score['n']} label(s); reported, not optimized.")
1427
1433
  print(f"\n {calibration.SYNTHETIC_CAVEAT}")
1428
1434
  print(" This table is NOT merged into P(real); `websec explain <class>` reports it separately.")
1429
1435
  return 0
@@ -1482,6 +1488,9 @@ def cmd_calibrate(args) -> int:
1482
1488
  f"silence proves nothing); {res['skipped_blind']} blind-spot finding(s) unscored. "
1483
1489
  f"Folded {len(res['labels'])} sample(s) into {calibration.LOCAL_PATH} → "
1484
1490
  f"{rec['meta']['samples']} total; P(real) now personalizes to your app.")
1491
+ score = rec['meta'].get('score')
1492
+ if score:
1493
+ print(f" Local-evidence Brier {score['brier']} on {score['n']} label(s); reported, not optimized.")
1485
1494
  return 0
1486
1495
 
1487
1496
  # --ingest: fold a hand-labeled findings file into your LOCAL overlay (the manual real-repo path)
@@ -1505,6 +1514,9 @@ def cmd_calibrate(args) -> int:
1505
1514
  nr = sum(1 for s in verified if s["is_real"] is True)
1506
1515
  print(f"websec calibrate --ingest: processed {len(verified)} evidence-backed sample(s) "
1507
1516
  f"({nr} real / {len(verified) - nr} FP) into {calibration.LOCAL_PATH} → {rec['meta']['samples']} total.")
1517
+ score = rec['meta'].get('score')
1518
+ if score:
1519
+ print(f" Local-evidence Brier {score['brier']} on {score['n']} label(s); reported, not optimized.")
1508
1520
  return 0
1509
1521
 
1510
1522
  corpus_path = (Path(args.corpus).expanduser().resolve() if args.corpus
@@ -1547,7 +1559,7 @@ def cmd_calibrate(args) -> int:
1547
1559
  print("\n no labeled findings produced — is the corpus cloned? (needs network on first run)")
1548
1560
  return 1
1549
1561
 
1550
- # A class is RESEARCHED only when it has at least one REVIEWED truth entry. Merely appearing in
1562
+ # A class is RESEARCHED only when EVERY truth entry has an explicit reviewed label. Appearing in
1551
1563
  # corpus.json is not research: the historical entries are class-level wildcards
1552
1564
  # (location_contains "*") with is_real null, which cannot separate a real vulnerability from a
1553
1565
  # false positive within the same class. Publishing a class-specific cell on that basis would
@@ -162,7 +162,12 @@ def thin_languages(cov: dict) -> set:
162
162
 
163
163
  def add_routes(facts: dict) -> None:
164
164
  """Preserve route-parser scope uncertainty separately from execution loss."""
165
- analysis = (facts.get("routes") or {}).get("django") or {}
165
+ for engine in ('django', 'connexion', 'trpc'):
166
+ _add_route_analysis(facts, engine)
167
+
168
+
169
+ def _add_route_analysis(facts: dict, engine: str) -> None:
170
+ analysis = (facts.get("routes") or {}).get(engine) or {}
166
171
  if not analysis:
167
172
  return
168
173
  if (not isinstance(analysis, dict)
@@ -171,17 +176,17 @@ def add_routes(facts: dict) -> None:
171
176
  for key in ("routes", "candidates", "gaps", "errors"))):
172
177
  add_gap(facts, "route_error", "Route discovery returned malformed diagnostics")
173
178
  return
174
- facts["coverage"]["route_discovery"] = {"django": {
179
+ facts["coverage"].setdefault("route_discovery", {})[engine] = {
175
180
  "routes": len(analysis.get("routes", [])), "candidates": len(analysis.get("candidates", [])),
176
181
  "gaps": analysis.get("gaps", []), "errors": analysis.get("errors", []),
177
- "limits": analysis.get("limits", {}), "diagnostics_truncated": analysis.get("diagnostics_truncated", 0)}}
182
+ "limits": analysis.get("limits", {}), "diagnostics_truncated": analysis.get("diagnostics_truncated", 0)}
178
183
  for row in analysis.get("gaps", []):
179
184
  add_gap(facts, "route_scope", f"{row.get('file', '?')}: {row.get('kind', '?')}: {row.get('detail', '')}",
180
185
  execution=False)
181
186
  for row in analysis.get("errors", []):
182
187
  add_gap(facts, "route_error", f"{row.get('file', '?')}: {row.get('kind', '?')}: {row.get('detail', '')}")
183
188
  if analysis.get("diagnostics_truncated"):
184
- add_gap(facts, "route_diagnostics_truncated", "Django diagnostics exceeded the reporting budget")
189
+ add_gap(facts, "route_diagnostics_truncated", f"{engine} diagnostics exceeded the reporting budget")
185
190
 
186
191
 
187
192
  def add_scanners(facts: dict, detected: dict, results: list, unified: dict | None, *,
@@ -0,0 +1,251 @@
1
+ """Bounded local request provenance for retained commands/JS queries; no target execution.
2
+
3
+ Python reuses the query AST work limits and branch joins. JavaScript models local,
4
+ simple assignments only. Complex control flow remains may-flow, not a safety proof.
5
+ """
6
+ from __future__ import annotations
7
+ import ast
8
+ from dataclasses import replace
9
+ import re
10
+
11
+ from . import sql_flow
12
+ from .syntax import MAX_EXPRESSION, call_expression, expression_end, js_functions, split_arguments, without_comments
13
+
14
+ MAX_SOURCE_BYTES = 512 * 1024
15
+ MAX_EVENTS = 2048
16
+ MAX_SCOPES = 128
17
+ MAX_BINDINGS = 512
18
+ MAX_TOTAL_SOURCE_BYTES = 8 * 1024 * 1024
19
+ MAX_TOTAL_EVENTS = 20_000
20
+ INERT_ARGV_EXECUTABLES = {'echo', '/bin/echo', '/usr/bin/echo'}
21
+ REQUEST = re.compile(r'\b(?:req|request|ctx)\.(?:query|params|body|args|form|headers|json|get_json|GET|POST)\b')
22
+ LITERAL = re.compile(r'''"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`''')
23
+ ASSIGNMENT = re.compile(r'(?<![\w$.=!<>])(?:(?:const|let|var)\s+)?([\w$]+)\s*(\+?=)(?!=|>)')
24
+ JS_CALL = re.compile(r'\b(?:[\w$]+\.(?:query|execute|raw)|child_process\.exec|execSync|exec)\s*\(')
25
+ COMMAND = re.compile(r'\b(?:[\w]+\.)?(?:system|popen|run|call|check_output|Popen|getoutput|getstatusoutput)\s*\(')
26
+ LIMITATIONS = [
27
+ 'Python import-bound stdlib command calls reuse bounded query-analysis assignments and branch joins.',
28
+ 'JS simple local assignments and first query/shell argument only; receiver names are review hints, not execution proof.',
29
+ 'JS branch writes preserve may-taint; loops, closure capture, destructuring, aliases, object mutation and cross-function flows require review.',
30
+ 'Unknown wrappers retain provenance; no sanitizer is inferred from a helper name. Separate query bind values do not taint query text.',
31
+ 'Bound HTTP method additions require a stable supported package import; other clients and dynamic dispatch remain unverified.',
32
+ ]
33
+
34
+
35
+ class CommandAnalysis(sql_flow.Analysis):
36
+ def __init__(self, source, budget):
37
+ super().__init__(source, budget)
38
+ self.mutated = set()
39
+ self.wildcard = False
40
+
41
+ def observe_node(self, node):
42
+ if isinstance(node, ast.ImportFrom) and any(alias.name == '*' for alias in node.names):
43
+ self.wildcard = True
44
+ if isinstance(node, (ast.Attribute, ast.Subscript)) and isinstance(node.ctx, (ast.Store, ast.Del)):
45
+ root = node.value
46
+ while isinstance(root, (ast.Attribute, ast.Subscript)):
47
+ root = root.value
48
+ if isinstance(root, ast.Name):
49
+ self.mutated.add(root.id)
50
+ if (isinstance(node, ast.Call) and isinstance(node.func, ast.Name)
51
+ and node.func.id in {'setattr', 'delattr'} and node.args and isinstance(node.args[0], ast.Name)):
52
+ self.mutated.add(node.args[0].id)
53
+
54
+ def import_kind(self, node, alias):
55
+ if id(alias) not in self.trusted_imports or getattr(node, 'level', 0):
56
+ return ''
57
+ if isinstance(node, ast.Import) and alias.name in {'os', 'subprocess'}:
58
+ return 'command-module:' + alias.name
59
+ if isinstance(node, ast.ImportFrom) and node.module in {'os', 'subprocess'}:
60
+ if alias.name in {'system', 'popen', 'run', 'call', 'check_output', 'Popen', 'getoutput', 'getstatusoutput'}:
61
+ return 'command:' + node.module + '.' + alias.name
62
+ return super().import_kind(node, alias)
63
+
64
+ def value(self, node, env, depth=0):
65
+ if isinstance(node, ast.Constant) and isinstance(node.value, str):
66
+ self.tick()
67
+ return sql_flow.Value(callable_kind='fixed-executable:' + node.value)
68
+ if isinstance(node, ast.Attribute):
69
+ receiver = super().value(node.value, env, depth + 1)
70
+ if receiver.callable_kind.startswith('command-module:'):
71
+ module = receiver.callable_kind.split(':', 1)[1]
72
+ if node.attr in {'system', 'popen', 'run', 'call', 'check_output', 'Popen', 'getoutput', 'getstatusoutput'}:
73
+ return sql_flow.Value(callable_kind='command:' + module + '.' + node.attr)
74
+ if isinstance(node, (ast.List, ast.Tuple)):
75
+ executable = node.elts[0].value if node.elts and isinstance(node.elts[0], ast.Constant) and isinstance(node.elts[0].value, str) else ''
76
+ return replace(super().value(node, env, depth), vector=True, vector_executable=executable)
77
+ if isinstance(node, ast.Call):
78
+ function = self.value(node.func, env, depth + 1)
79
+ if function.callable_kind.startswith('command:'):
80
+ self.tick()
81
+ argument = node.args[0] if node.args else next((kw.value for kw in node.keywords if kw.arg in {'args', 'command', 'cmd'}), None)
82
+ value = self.value(argument, env, depth + 1)
83
+ shell = next((kw.value for kw in node.keywords if kw.arg == 'shell'), ast.Constant(value=False))
84
+ safe_vector = (function.callable_kind in {'command:subprocess.' + name for name in ('run', 'call', 'check_output', 'Popen')}
85
+ and len(node.args) == 1 and all(keyword.arg is not None for keyword in node.keywords)
86
+ and not self.wildcard and not (isinstance(node.func, ast.Attribute)
87
+ and isinstance(node.func.value, ast.Name) and node.func.value.id in self.mutated)
88
+ and value.vector and value.vector_executable in INERT_ARGV_EXECUTABLES
89
+ and isinstance(shell, ast.Constant) and shell.value is False)
90
+ if value.sources and not safe_vector:
91
+ if len(self.findings) >= sql_flow.MAX_FINDINGS:
92
+ raise sql_flow.LimitReached('command occurrence budget exceeded')
93
+ start = self.offset(node)
94
+ self.findings[start] = {'offset': start, 'end': self.offset(node, True), 'line': node.lineno,
95
+ 'legacy_offset': start, 'value': value, 'sink_class': 'command-injection'}
96
+ return sql_flow.Value()
97
+ return super().value(node, env, depth)
98
+
99
+ def bind_assignment(self, target, value, env, line):
100
+ super().bind_assignment(target, value, env, line)
101
+ if isinstance(target, ast.Name) and isinstance(value, tuple):
102
+ first = value[0].callable_kind if value and isinstance(value[0], sql_flow.Value) else ''
103
+ executable = first.removeprefix('fixed-executable:') if first.startswith('fixed-executable:') else ''
104
+ env[target.id] = replace(env[target.id], vector_executable=executable)
105
+
106
+
107
+ def python_commands(source, budget):
108
+ result = sql_flow.analyze(source, budget, analysis_type=CommandAnalysis, candidate_pattern=COMMAND)
109
+ result['occurrences'] = [row for row in result['occurrences'] if row.get('sink_class') == 'command-injection']
110
+ return result
111
+
112
+
113
+ def _masked(source):
114
+ def mask(match):
115
+ return ''.join('\n' if char == '\n' else ' ' for char in match[0])
116
+ return LITERAL.sub(mask, source)
117
+
118
+
119
+ def _value(expression, environment, line, source_pattern=REQUEST):
120
+ # Ordinary literal examples are opaque; supported template interpolation is code.
121
+ interpolations = []
122
+ for literal in LITERAL.finditer(expression):
123
+ if literal[0].startswith('`'):
124
+ for interpolation in re.finditer(r'\$\{([^{}]*)\}', literal[0]):
125
+ back = interpolation.start() - 1
126
+ while back >= 0 and literal[0][back] == '\\':
127
+ back -= 1
128
+ if (interpolation.start() - back - 1) % 2 == 0:
129
+ interpolations.append(interpolation[1])
130
+ executable = _masked(expression) + ' '.join(interpolations)
131
+ sources, assignments = set(), set()
132
+ if source_pattern.search(executable):
133
+ sources.add(line)
134
+ for name in re.findall(r'\b[\w$]+\b', executable):
135
+ previous = environment.get(name)
136
+ if previous:
137
+ sources.update(previous[0])
138
+ assignments.update(previous[1])
139
+ return set(sorted(sources)[:8]), set(sorted(assignments)[:8])
140
+
141
+
142
+ def javascript(source, budget, *, source_pattern=REQUEST, sink_pattern=JS_CALL,
143
+ sink_kind=None, argument_selector=None):
144
+ """Shared bounded assignment walk; internal consumers select actual sink arguments."""
145
+ result = {'occurrences': [], 'errors': [], 'candidate': bool(sink_pattern.search(source))}
146
+ if not result['candidate']:
147
+ return result
148
+ size = len(source.encode())
149
+ if size > MAX_SOURCE_BYTES or budget['bytes'] + size > MAX_TOTAL_SOURCE_BYTES:
150
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS assignment source budget exceeded'})
151
+ return result
152
+ budget['bytes'] += size
153
+ code = without_comments(source)
154
+ masked = _masked(code)
155
+ scopes = js_functions(code)
156
+ if len(scopes) > MAX_SCOPES:
157
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS assignment scope budget exceeded'})
158
+ return result
159
+ depth, depths = 0, []
160
+ for char in masked:
161
+ depths.append(depth)
162
+ depth += int(char == '{') - int(char == '}')
163
+ def owner(position):
164
+ matches = [scope for scope in scopes if scope['body_start'] <= position < scope['end']]
165
+ return min(matches, key=lambda row: row['end'] - row['start'])['body_start'] if matches else 0
166
+ events = [(match.start(), 'assign', match) for match in ASSIGNMENT.finditer(masked)]
167
+ events += [(match.start(), 'sink', match) for match in sink_pattern.finditer(masked)]
168
+ if len(events) > MAX_EVENTS or budget['events'] + len(events) > MAX_TOTAL_EVENTS:
169
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS assignment event budget exceeded'})
170
+ return result
171
+ budget['events'] += len(events)
172
+ environments = {}
173
+ for position, kind, match in sorted(events, key=lambda row: row[0]):
174
+ env = environments.setdefault(owner(position), {})
175
+ line = source.count('\n', 0, position) + 1
176
+ if kind == 'assign':
177
+ end = expression_end(code, match.end())
178
+ if end - match.end() >= MAX_EXPRESSION:
179
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS assignment expression budget exceeded'})
180
+ break
181
+ value = _value(code[match.end():end], env, line, source_pattern)
182
+ prior = env.get(match[1])
183
+ prefix = masked[max(0, position - 128):position].rstrip()
184
+ conditional = not prefix or prefix[-1] not in ';{}'
185
+ if prior and (depths[position] != prior[2] or conditional or match[2] == '+='):
186
+ value = (value[0] | prior[0], value[1] | prior[1])
187
+ if value[0]:
188
+ value[1].add(line)
189
+ if match[1] not in env and len(env) >= MAX_BINDINGS:
190
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS assignment binding budget exceeded'})
191
+ break
192
+ env[match[1]] = (*value, depths[position])
193
+ continue
194
+ expression = call_expression(code, position)
195
+ if not expression.endswith(')'):
196
+ result['errors'].append({'kind': 'LimitReached', 'detail': 'JS call expression incomplete or budget exceeded'})
197
+ continue
198
+ arguments = split_arguments(expression[expression.find('(') + 1:-1])
199
+ if not arguments:
200
+ continue
201
+ argument = argument_selector(expression, arguments) if argument_selector else arguments[0]
202
+ value = _value(argument, env, line, source_pattern)
203
+ if value[0]:
204
+ sink_class = sink_kind or ('sql-injection' if re.search(r'\.(?:query|execute|raw)\s*\(', match[0]) else 'command-injection')
205
+ result['occurrences'].append({'offset': position, 'end': position + len(expression), 'line': line,
206
+ 'legacy_offset': position + expression.find('.') if sink_class == 'sql-injection' else position,
207
+ 'sink_class': sink_class, 'source_lines': sorted(value[0])[:8], 'assignment_lines': sorted(value[1])[:8]})
208
+ return result
209
+
210
+
211
+ def http_methods(source, budget):
212
+ """Stable default/require needle imports only; names or reassigned receivers aren't clients."""
213
+ if 'needle' not in source:
214
+ return []
215
+ size = len(source.encode())
216
+ if size > MAX_SOURCE_BYTES or budget['bytes'] + size > MAX_TOTAL_SOURCE_BYTES:
217
+ raise sql_flow.LimitReached('bound HTTP-method source budget exceeded')
218
+ budget['bytes'] += size
219
+ code, rows = without_comments(source), []
220
+ masked = _masked(code)
221
+ scopes = js_functions(code)
222
+ if len(scopes) > MAX_SCOPES:
223
+ raise sql_flow.LimitReached('bound HTTP-method scope budget exceeded')
224
+ imports = re.compile(r'''\bimport\s+([\w$]+)\s+from\s+(['"])needle\2\s*;?|\bconst\s+([\w$]+)\s*=\s*require\(\s*(['"])needle\4\s*\)\s*;?''')
225
+ bindings = list(imports.finditer(code))
226
+ if len(bindings) > MAX_SCOPES:
227
+ raise sql_flow.LimitReached('bound HTTP-method import budget exceeded')
228
+ for binding in bindings:
229
+ if masked[binding.start():binding.start()+6].strip() not in {'import', 'const'}:
230
+ continue
231
+ name = binding[1] or binding[3]
232
+ remainder = code[:binding.start()] + ' ' * len(binding[0]) + code[binding.end():]
233
+ writes = re.compile(r'\b' + re.escape(name) + r'(?:\.[\w$]+|\[[^\]\n]{0,128}\])*\s*(?:=(?!=)|\+=|-=|\+\+|--)|\b(?:function|class)\s+' + re.escape(name) + r'\b')
234
+ if (writes.search(_masked(remainder))
235
+ or re.search(r'\bimport\s+' + re.escape(name) + r'\b', _masked(remainder))
236
+ or any(name in scope['params'] for scope in scopes)):
237
+ continue
238
+ for call in re.finditer(r'\b' + re.escape(name) + r'\.(get|post|put|patch|delete|head|request)\s*\(', masked):
239
+ budget['events'] += 1
240
+ if budget['events'] > MAX_TOTAL_EVENTS or len(rows) >= MAX_EVENTS:
241
+ raise sql_flow.LimitReached('bound HTTP-method call budget exceeded')
242
+ expression = call_expression(code, call.start())
243
+ arguments = split_arguments(expression[expression.find('(') + 1:-1])
244
+ index = 1 if call[1] == 'request' else 0
245
+ if len(arguments) > index:
246
+ url = arguments[index]
247
+ if _value(url, {}, 1)[0]:
248
+ rows.append((call.start(), expression, 'ssrf'))
249
+ elif re.fullmatch(r'[\w$.]+', url):
250
+ rows.append((call.start(), expression, 'ssrf-outbound-http'))
251
+ return rows