websec-validator 0.15.2__tar.gz → 0.16.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 (187) hide show
  1. {websec_validator-0.15.2/src/websec_validator.egg-info → websec_validator-0.16.0}/PKG-INFO +27 -5
  2. {websec_validator-0.15.2 → websec_validator-0.16.0}/README.md +26 -4
  3. {websec_validator-0.15.2 → websec_validator-0.16.0}/pyproject.toml +2 -2
  4. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/calibration.py +92 -0
  5. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/cli.py +108 -4
  6. websec_validator-0.16.0/src/websec_validator/demo.py +74 -0
  7. websec_validator-0.16.0/src/websec_validator/explain.py +110 -0
  8. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/feedback.py +47 -5
  9. websec_validator-0.16.0/src/websec_validator/provenance.py +134 -0
  10. websec_validator-0.16.0/src/websec_validator/templates/demo/app.py.txt +33 -0
  11. websec_validator-0.16.0/src/websec_validator/templates/demo/requirements.txt.txt +2 -0
  12. {websec_validator-0.15.2 → websec_validator-0.16.0/src/websec_validator.egg-info}/PKG-INFO +27 -5
  13. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator.egg-info/SOURCES.txt +9 -0
  14. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_agent_hook.py +3 -1
  15. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_attest.py +3 -1
  16. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_attribution.py +3 -1
  17. websec_validator-0.16.0/tests/test_calibration_claimspec.py +202 -0
  18. websec_validator-0.16.0/tests/test_demo.py +75 -0
  19. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_diffscope.py +3 -1
  20. websec_validator-0.16.0/tests/test_explain.py +93 -0
  21. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_feedback.py +36 -0
  22. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_gate_and_bypass_record.py +3 -1
  23. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_gate_command.py +3 -1
  24. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_hooks.py +3 -0
  25. websec_validator-0.16.0/tests/test_provenance.py +134 -0
  26. {websec_validator-0.15.2 → websec_validator-0.16.0}/LICENSE +0 -0
  27. {websec_validator-0.15.2 → websec_validator-0.16.0}/setup.cfg +0 -0
  28. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/__init__.py +0 -0
  29. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/agenthook.py +0 -0
  30. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/attest.py +0 -0
  31. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/attribution.py +0 -0
  32. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/baseline.py +0 -0
  33. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/briefing.py +0 -0
  34. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/calibration.json +0 -0
  35. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/constitution.py +0 -0
  36. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/corpus.json +0 -0
  37. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/coverage.py +0 -0
  38. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/dast_ingest.py +0 -0
  39. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/dast_predict.py +0 -0
  40. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/diffscope.py +0 -0
  41. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/dynamic.py +0 -0
  42. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/enrichment.py +0 -0
  43. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/__init__.py +0 -0
  44. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/agent_config.py +0 -0
  45. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/auth.py +0 -0
  46. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/authz.py +0 -0
  47. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/authz_dataflow.py +0 -0
  48. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/base.py +0 -0
  49. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/client_exposure.py +0 -0
  50. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/client_integrity.py +0 -0
  51. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/crypto_usage.py +0 -0
  52. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/dependencies.py +0 -0
  53. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/django_urls.py +0 -0
  54. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/graphql.py +0 -0
  55. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/iac_ci.py +0 -0
  56. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/integrations.py +0 -0
  57. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/llm_security.py +0 -0
  58. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/pii_exposure.py +0 -0
  59. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/policy_consistency.py +0 -0
  60. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/profiles.py +0 -0
  61. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/routes.py +0 -0
  62. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/schemas.py +0 -0
  63. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/sql_flow.py +0 -0
  64. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/stack.py +0 -0
  65. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/surface.py +0 -0
  66. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/syntax.py +0 -0
  67. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/tenant.py +0 -0
  68. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/transport_security.py +0 -0
  69. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/upload_security.py +0 -0
  70. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/extractors/webext.py +0 -0
  71. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/findings.py +0 -0
  72. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/fixprompt.py +0 -0
  73. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/formats.py +0 -0
  74. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/fpfilter.py +0 -0
  75. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/gate.py +0 -0
  76. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/graph_enrich.py +0 -0
  77. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/hooks.py +0 -0
  78. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/install.py +0 -0
  79. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/intel.py +0 -0
  80. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/inventory.py +0 -0
  81. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/mcp_server.py +0 -0
  82. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/openapi.py +0 -0
  83. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/probes.py +0 -0
  84. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/proof.py +0 -0
  85. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/recon.py +0 -0
  86. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/registry.py +0 -0
  87. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/repairs.py +0 -0
  88. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/report.py +0 -0
  89. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/research/control-scope-cases.json +0 -0
  90. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/research/example.json +0 -0
  91. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/research/profile-cases.json +0 -0
  92. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/research.py +0 -0
  93. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
  94. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
  95. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/sarif_ingest.py +0 -0
  96. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/scanners.py +0 -0
  97. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/schemas/coverage.schema.json +0 -0
  98. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/schemas/facts.schema.json +0 -0
  99. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/schemas/ledger.schema.json +0 -0
  100. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/_lib.py +0 -0
  101. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
  102. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
  103. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
  104. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
  105. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
  106. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
  107. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
  108. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
  109. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
  110. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
  111. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/forged-token.sh +0 -0
  112. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
  113. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
  114. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
  115. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
  116. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
  117. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/race-conditions.py +0 -0
  118. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
  119. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
  120. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
  121. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
  122. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
  123. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
  124. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
  125. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
  126. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
  127. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
  128. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
  129. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator/testplan.py +0 -0
  130. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator.egg-info/dependency_links.txt +0 -0
  131. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator.egg-info/entry_points.txt +0 -0
  132. {websec_validator-0.15.2 → websec_validator-0.16.0}/src/websec_validator.egg-info/top_level.txt +0 -0
  133. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_action_contracts.py +0 -0
  134. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_adoption_contracts.py +0 -0
  135. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_agent_hosts.py +0 -0
  136. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_agent_launch_specs.py +0 -0
  137. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_analysis_scope.py +0 -0
  138. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_assurance_regressions.py +0 -0
  139. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_auth_control_scope.py +0 -0
  140. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_constitution.py +0 -0
  141. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_control_scope_research.py +0 -0
  142. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_coverage.py +0 -0
  143. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_crypto_comparisons.py +0 -0
  144. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_dast_ingest.py +0 -0
  145. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_dast_predict.py +0 -0
  146. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_detector_precision.py +0 -0
  147. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_django_routes.py +0 -0
  148. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_enrichment.py +0 -0
  149. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_entitlement_webext.py +0 -0
  150. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_evidence_verdicts.py +0 -0
  151. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_extension_controls.py +0 -0
  152. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_fixprompt_fpfilter.py +0 -0
  153. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_formats.py +0 -0
  154. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_gitleaks_worktree.py +0 -0
  155. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_graph_enrich.py +0 -0
  156. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_hardening.py +0 -0
  157. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_hooks_contracts.py +0 -0
  158. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_install.py +0 -0
  159. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_install_contracts.py +0 -0
  160. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_intel.py +0 -0
  161. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_inventory.py +0 -0
  162. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_lifecycle.py +0 -0
  163. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_mcp.py +0 -0
  164. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_mcp_security.py +0 -0
  165. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_openapi.py +0 -0
  166. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_output_boundaries.py +0 -0
  167. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_pentest_regressions.py +0 -0
  168. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_profiles.py +0 -0
  169. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_proof_revisions.py +0 -0
  170. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_public_precision.py +0 -0
  171. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_read_boundary.py +0 -0
  172. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_read_performance.py +0 -0
  173. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_recon.py +0 -0
  174. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_registry_existence.py +0 -0
  175. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_remaining_control_scope.py +0 -0
  176. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_research.py +0 -0
  177. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_research_cli.py +0 -0
  178. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_sarif_ingest.py +0 -0
  179. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_sarif_workbench.py +0 -0
  180. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_scanner_contracts.py +0 -0
  181. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_source_budget.py +0 -0
  182. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_sql_flow.py +0 -0
  183. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_stack_metadata.py +0 -0
  184. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_testplan.py +0 -0
  185. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_transport_pii_scope.py +0 -0
  186. {websec_validator-0.15.2 → websec_validator-0.16.0}/tests/test_transport_stack_scope.py +0 -0
  187. {websec_validator-0.15.2 → websec_validator-0.16.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.15.2
3
+ Version: 0.16.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
@@ -299,6 +299,11 @@ Extractor failures, source read loss/caps, invalid scanner reports, timeouts, an
299
299
  missing scanners remain visible in `coverage.json`; partial artifacts are preserved. Optional missing
300
300
  unselected scanners are reported as unavailable. `--scanners` requires `--scan`.
301
301
 
302
+ **Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
303
+ have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
304
+ --require-complete` exits 2 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
305
+ install failed fails instead of reporting zero findings from a scan that never ran.
306
+
302
307
  Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
303
308
  advances only after a completed execution has written its artifacts; a partial attempt retains its
304
309
  own directory and leaves the previous completed scan selected. Completed execution describes the
@@ -516,6 +521,9 @@ read policy; an unrelated working directory no longer contributes implicit suppr
516
521
 
517
522
  ```bash
518
523
  websec capabilities # offline profile/check/limitation matrix
524
+ websec demo # real scan of a bundled sample; writes nothing here
525
+ websec explain bola # what a class means + how to confirm it
526
+ websec explain --list # every attack class this build cites
519
527
  websec feedback --fingerprint <fp> --verdict false-positive \
520
528
  --reason "behind an nginx auth_request" # report a wrong detector; metadata-only, sends nothing
521
529
  websec intel status # offline freshness and provenance
@@ -588,6 +596,19 @@ unproven samples are quarantined. Unknown-only input reports no successful measu
588
596
  existing fitted calibration unchanged. A DAST hit may confirm a scoped lead; absence from a report
589
597
  cannot refute it. Manual labels should include reviewer/evidence provenance, not only a boolean.
590
598
 
599
+ **Shared format.** `websec calibrate --claimspec PATH` (or `-` for stdout) exports the table the
600
+ runtime actually uses — shipped corpus table plus your local overlay, merged — as a
601
+ [claimspec](https://github.com/raccioly/testguard/tree/main/spec) v1 `calibration` document, the
602
+ Guard-family interchange format. Nothing is lost in translation: the caveat, limitation, evidence
603
+ status, `minN` floor, the per-confidence backoff tier and the labelled uncalibrated prior all travel
604
+ with the numbers (`measures: finding-real`, `bucketBy: attackClass|confidence`). Each cell carries
605
+ raw `n` and `positives`, so a consumer can recompute `p` and the Wilson interval and merge two
606
+ tables by summing counts — the only merge the spec allows. `source.kind` says where the labels came
607
+ from: `human-label` for the shipped table, `tool-oracle` for an overlay-only table, `mixed` once
608
+ your samples are folded in. The writer refuses to export a cell whose stored numbers do not
609
+ reproduce from its counts rather than emit a document the spec validator would reject. The
610
+ internal `calibration.json` shape and the local overlay are unchanged.
611
+
591
612
  ## Dynamic phase (v2 — read-only so far)
592
613
 
593
614
  When you have a *running TEST instance*, `websec dynamic` mints role tokens and runs the probes the
@@ -623,7 +644,7 @@ add the matching dated changelog and migration guidance, and validate the combin
623
644
  In the 0.x series, feature additions or incompatible contracts increment the minor version.
624
645
 
625
646
  After reviewing current main and overlapping PRs, merge the approved release PR only after its
626
- required CI checks pass. The resulting main commit subject must be `release: v0.15.2` for this
647
+ required CI checks pass. The resulting main commit subject must be `release: v0.16.0` for this
627
648
  release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
628
649
  package version, creates the matching tag/GitHub Release, and explicitly dispatches
629
650
  [publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
@@ -639,18 +660,19 @@ omit an independent version field. Check both sources when diagnosing stale inst
639
660
 
640
661
  ## Status / roadmap
641
662
 
642
- Version 0.15.2 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
663
+ Version 0.16.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
643
664
  SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
644
665
  intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
645
666
  (`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
646
667
  existence check (`--network`), run attribution with graded assurance, recorded gate verdicts and
647
- hook bypasses, and an audit-evidence projection (`websec attest`). These are scoped review tools;
668
+ hook bypasses, an audit-evidence projection (`websec attest`), and a claimspec export of the
669
+ calibration table (`websec calibrate --claimspec`). These are scoped review tools;
648
670
  manual profiles, unknown routes, dynamic behavior and unsupported syntax remain limitations. The
649
671
  in-loop gate is developer ergonomics, not a control, and `attest` reports evidence without
650
672
  rendering a compliance verdict.
651
673
 
652
674
  The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
653
- changes. 0.15.2 is a patch over 0.15.1 and needs no migration.
675
+ changes. 0.16.0 adds the claimspec calibration export over 0.15.3 and needs no migration.
654
676
  The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
655
677
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
656
678
  Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
@@ -270,6 +270,11 @@ Extractor failures, source read loss/caps, invalid scanner reports, timeouts, an
270
270
  missing scanners remain visible in `coverage.json`; partial artifacts are preserved. Optional missing
271
271
  unselected scanners are reported as unavailable. `--scanners` requires `--scan`.
272
272
 
273
+ **Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
274
+ have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
275
+ --require-complete` exits 2 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
276
+ install failed fails instead of reporting zero findings from a scan that never ran.
277
+
273
278
  Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
274
279
  advances only after a completed execution has written its artifacts; a partial attempt retains its
275
280
  own directory and leaves the previous completed scan selected. Completed execution describes the
@@ -487,6 +492,9 @@ read policy; an unrelated working directory no longer contributes implicit suppr
487
492
 
488
493
  ```bash
489
494
  websec capabilities # offline profile/check/limitation matrix
495
+ websec demo # real scan of a bundled sample; writes nothing here
496
+ websec explain bola # what a class means + how to confirm it
497
+ websec explain --list # every attack class this build cites
490
498
  websec feedback --fingerprint <fp> --verdict false-positive \
491
499
  --reason "behind an nginx auth_request" # report a wrong detector; metadata-only, sends nothing
492
500
  websec intel status # offline freshness and provenance
@@ -559,6 +567,19 @@ unproven samples are quarantined. Unknown-only input reports no successful measu
559
567
  existing fitted calibration unchanged. A DAST hit may confirm a scoped lead; absence from a report
560
568
  cannot refute it. Manual labels should include reviewer/evidence provenance, not only a boolean.
561
569
 
570
+ **Shared format.** `websec calibrate --claimspec PATH` (or `-` for stdout) exports the table the
571
+ runtime actually uses — shipped corpus table plus your local overlay, merged — as a
572
+ [claimspec](https://github.com/raccioly/testguard/tree/main/spec) v1 `calibration` document, the
573
+ Guard-family interchange format. Nothing is lost in translation: the caveat, limitation, evidence
574
+ status, `minN` floor, the per-confidence backoff tier and the labelled uncalibrated prior all travel
575
+ with the numbers (`measures: finding-real`, `bucketBy: attackClass|confidence`). Each cell carries
576
+ raw `n` and `positives`, so a consumer can recompute `p` and the Wilson interval and merge two
577
+ tables by summing counts — the only merge the spec allows. `source.kind` says where the labels came
578
+ from: `human-label` for the shipped table, `tool-oracle` for an overlay-only table, `mixed` once
579
+ your samples are folded in. The writer refuses to export a cell whose stored numbers do not
580
+ reproduce from its counts rather than emit a document the spec validator would reject. The
581
+ internal `calibration.json` shape and the local overlay are unchanged.
582
+
562
583
  ## Dynamic phase (v2 — read-only so far)
563
584
 
564
585
  When you have a *running TEST instance*, `websec dynamic` mints role tokens and runs the probes the
@@ -594,7 +615,7 @@ add the matching dated changelog and migration guidance, and validate the combin
594
615
  In the 0.x series, feature additions or incompatible contracts increment the minor version.
595
616
 
596
617
  After reviewing current main and overlapping PRs, merge the approved release PR only after its
597
- required CI checks pass. The resulting main commit subject must be `release: v0.15.2` for this
618
+ required CI checks pass. The resulting main commit subject must be `release: v0.16.0` for this
598
619
  release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
599
620
  package version, creates the matching tag/GitHub Release, and explicitly dispatches
600
621
  [publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
@@ -610,18 +631,19 @@ omit an independent version field. Check both sources when diagnosing stale inst
610
631
 
611
632
  ## Status / roadmap
612
633
 
613
- Version 0.15.2 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
634
+ Version 0.16.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
614
635
  SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
615
636
  intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
616
637
  (`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
617
638
  existence check (`--network`), run attribution with graded assurance, recorded gate verdicts and
618
- hook bypasses, and an audit-evidence projection (`websec attest`). These are scoped review tools;
639
+ hook bypasses, an audit-evidence projection (`websec attest`), and a claimspec export of the
640
+ calibration table (`websec calibrate --claimspec`). These are scoped review tools;
619
641
  manual profiles, unknown routes, dynamic behavior and unsupported syntax remain limitations. The
620
642
  in-loop gate is developer ergonomics, not a control, and `attest` reports evidence without
621
643
  rendering a compliance verdict.
622
644
 
623
645
  The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
624
- changes. 0.15.2 is a patch over 0.15.1 and needs no migration.
646
+ changes. 0.16.0 adds the claimspec calibration export over 0.15.3 and needs no migration.
625
647
  The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
626
648
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
627
649
  Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "websec-validator"
7
- version = "0.15.2"
7
+ version = "0.16.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"
@@ -50,4 +50,4 @@ package-dir = { "" = "src" }
50
50
  where = ["src"]
51
51
 
52
52
  [tool.setuptools.package-data]
53
- websec_validator = ["templates/probes/*", "templates/reports/*", "rules/*.yml", "corpus.json", "calibration.json", "schemas/*.json", "research/*.json"]
53
+ websec_validator = ["templates/probes/*", "templates/reports/*", "templates/demo/*", "rules/*.yml", "corpus.json", "calibration.json", "schemas/*.json", "research/*.json"]
@@ -258,6 +258,98 @@ def samples_from_dynamic(dynamic: dict) -> list:
258
258
  return out
259
259
 
260
260
 
261
+ # ---- claimspec `calibration` writer (additive: the internal table shape above is unchanged) ----
262
+ # claimspec is the Guard-family shared spec (testguard `spec/`). Its `calibration` kind carries the
263
+ # same honesty fields this table does — corpus, caveat, limitation, evidence status, min-n floor,
264
+ # backoff tier and a labelled fallback — under different names. This writer is the translation.
265
+ CLAIMSPEC_SCHEMA_VERSION = 1
266
+ CLAIMSPEC_MEASURES = "finding-real" # P(a reported finding of this class is a real vulnerability)
267
+ CLAIMSPEC_BUCKET_BY = "attackClass|confidence" # `by_class_label` keys are `class|LABEL`
268
+ CLAIMSPEC_BACKOFF_BY = "confidence" # `by_label` keys are `LABEL`
269
+ CLAIMSPEC_CONFIDENCE = 0.95 # Z95 above is the exact quantile for this level
270
+ _EVIDENCE_STATUS = {"historical-unverified": "unverified", "historical-quarantined": "quarantined"}
271
+ # meta keys that are websec provenance with no claimspec field; they travel in `source.detail`.
272
+ _DETAIL_KEYS = ("n_total", "n_unknown", "unmatched_rule", "researched_classes", "personalized",
273
+ "local_samples", "legacy_uncertain_samples", "historical_uncertain_samples",
274
+ "shipped_table", "method")
275
+
276
+
277
+ def _claimspec_cell(key: str, cell: dict) -> dict:
278
+ """Translate one `{n, k, p, ci}` cell to `{n, positives, p, ci}`, refusing one that does not
279
+ reproduce from its own counts.
280
+
281
+ The stored `p`/`ci` are passed through, not recomputed: they are the numbers `apply()` actually
282
+ attaches to findings, and an exported document must not quote a different one. The validator
283
+ recomputes both from `positives`/`n` at the document's own precision, so a stale hand-edited
284
+ cell would make the whole document non-conforming — better to refuse here and name the cell.
285
+ Precision note: `_cell` uses Python `round()` (round-half-even on the binary value) where the
286
+ JS validator uses `toFixed` (round-half-away); an exact tie at 3 dp is effectively impossible
287
+ for a Wilson bound, so the two agree in practice.
288
+ """
289
+ n, k = int(cell.get("n", 0)), int(cell.get("k", 0))
290
+ if k > n or n < 0:
291
+ raise ValueError(f"calibration cell {key!r} has {k} positives in {n} trials")
292
+ expected = _cell(k, n)
293
+ got = {"p": cell.get("p"), "ci": list(cell.get("ci", []))}
294
+ if got["p"] != expected["p"] or got["ci"] != expected["ci"]:
295
+ raise ValueError(f"calibration cell {key!r} does not reproduce from its counts "
296
+ f"({k}/{n}): stored p={got['p']} ci={got['ci']}, "
297
+ f"expected p={expected['p']} ci={expected['ci']}")
298
+ return {"n": n, "positives": k, "p": got["p"], "ci": got["ci"]}
299
+
300
+
301
+ def to_claimspec(table: dict, computed_at: str | None = None) -> dict:
302
+ """Render an internal calibration table (shipped, local-only or merged, i.e. anything `load()`
303
+ returns) as a claimspec v1 `calibration` document.
304
+
305
+ Field mapping is fixed by the spec's own reference translation of the shipped table
306
+ (`spec/conformance/examples/calibration-websec.json` in testguard). `source.kind` says where
307
+ the labels came from: `human-label` for the shipped corpus table, `tool-oracle` when only the
308
+ operator's confirmed local samples exist, `mixed` once local samples are folded over shipped.
309
+ `source.caveat` is always written — a number quoted without it is a misquote.
310
+ """
311
+ from datetime import datetime, timezone
312
+ from . import __version__
313
+
314
+ meta = table.get("meta", {}) or {}
315
+ if meta.get("shipped_table") is False:
316
+ kind, ref = "tool-oracle", "calibration-local.json (operator overlay; no shipped table)"
317
+ elif meta.get("personalized"):
318
+ kind, ref = "mixed", "shipped calibration.json + operator overlay calibration-local.json"
319
+ else:
320
+ kind, ref = "human-label", "src/websec_validator/calibration.json, shipped in the package"
321
+ source: dict = {"kind": kind, "ref": ref}
322
+ if meta.get("corpus"):
323
+ source["corpus"] = list(meta["corpus"])
324
+ source["caveat"] = meta.get("caveat") or CAVEAT
325
+ if meta.get("limitation"):
326
+ source["limitation"] = meta["limitation"]
327
+ source["evidenceStatus"] = _EVIDENCE_STATUS.get(meta.get("evidence_status"), "verified")
328
+ detail = {key: meta[key] for key in _DETAIL_KEYS if meta.get(key) is not None}
329
+ if detail:
330
+ source["detail"] = detail
331
+
332
+ if computed_at is None:
333
+ computed_at = datetime.now(timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z")
334
+ return {
335
+ "schemaVersion": CLAIMSPEC_SCHEMA_VERSION,
336
+ "tool": {"name": "websec-validator", "version": __version__},
337
+ "computedAt": computed_at,
338
+ "method": "wilson",
339
+ "confidence": CLAIMSPEC_CONFIDENCE,
340
+ "measures": CLAIMSPEC_MEASURES,
341
+ "bucketBy": CLAIMSPEC_BUCKET_BY,
342
+ "minN": int(meta.get("min_n", MIN_N)),
343
+ "source": source,
344
+ "buckets": {key: _claimspec_cell(key, cell)
345
+ for key, cell in sorted((table.get("by_class_label") or {}).items())},
346
+ "backoff": [{"bucketBy": CLAIMSPEC_BACKOFF_BY,
347
+ "buckets": {key: _claimspec_cell(key, cell)
348
+ for key, cell in sorted((table.get("by_label") or {}).items())}}],
349
+ "fallback": {"basis": "uncalibrated-prior", "values": dict(table.get("prior") or PRIOR)},
350
+ }
351
+
352
+
261
353
  def apply(attack_class: str, confidence: str, table: dict | None) -> dict:
262
354
  """Attach a calibrated estimate for a finding's (attack_class, confidence) bucket.
263
355
 
@@ -162,6 +162,12 @@ def cmd_doctor(args) -> int:
162
162
  det = scanners.detect(langs)
163
163
  print(f"websec-validator v{__version__} — scanner check"
164
164
  + (f" (stack: {', '.join(langs) or 'unknown'})" if langs else ""))
165
+ # A version string alone does not identify the engine: a stale wheel from /tmp, an
166
+ # editable checkout and a clean index install all print the same number. Say which.
167
+ from . import provenance as _prov
168
+ print()
169
+ for line in _prov.lines():
170
+ print(line)
165
171
  print("\n available:")
166
172
  for s in det["available"]:
167
173
  print(f" ✓ {s['name']:20} {s['category']}")
@@ -840,11 +846,62 @@ def cmd_capabilities(args) -> int:
840
846
  return 0
841
847
 
842
848
 
849
+ def cmd_demo(args) -> int:
850
+ """Run a real pass against a bundled sample so the output can be seen before adopting."""
851
+ from . import demo as _demo
852
+ return _demo.run()
853
+
854
+
855
+ def cmd_explain(args) -> int:
856
+ """What an attack class means, how to confirm it, and what its number is worth."""
857
+ from . import explain as _explain
858
+ if getattr(args, "list", False):
859
+ if getattr(args, "format", "text") == "json":
860
+ _emit_json_result({"attack_classes": _explain.classes()})
861
+ else:
862
+ for name in _explain.classes():
863
+ print(name)
864
+ return 0
865
+ if not getattr(args, "term", None):
866
+ print("error: give an attack class or CWE id, or --list", file=sys.stderr)
867
+ return 2
868
+ info = _explain.describe(args.term)
869
+ if getattr(args, "format", "text") == "json":
870
+ _emit_json_result(info)
871
+ return 0 if info.get("ok") else 2
872
+ print(_explain.render(info))
873
+ return 0 if info.get("ok") else 2
874
+
875
+
843
876
  def cmd_feedback(args) -> int:
844
877
  """Record an operator verdict on detector correctness. Local, offline, redacted."""
845
878
  import sys
846
879
  fb = feedback
847
880
 
881
+ if args.verdict == "false-negative":
882
+ # No fingerprint and no ledger: the report is that nothing was produced. Gating
883
+ # this on a findings ledger would require the artifact whose absence is the point.
884
+ if args.fingerprint:
885
+ print("--fingerprint does not apply to --verdict false-negative", file=sys.stderr)
886
+ return 2
887
+ try:
888
+ record = fb.build_missed_record(
889
+ attack_class=getattr(args, "attack_class", "") or "", reason=args.reason,
890
+ file_extension=getattr(args, "file_extension", "") or "")
891
+ destination = Path(args.out or "websec-out").resolve() / fb.FEEDBACK_FILENAME
892
+ fb.append(destination, record)
893
+ except (fb.FeedbackError, OSError) as exc:
894
+ print(str(exc), file=sys.stderr)
895
+ return 2
896
+ url = fb.issue_url(record)
897
+ if getattr(args, "format", None) == "json":
898
+ _emit_json_result({"recorded": str(destination), "record": record, "issue_url": url})
899
+ else:
900
+ print(f"recorded false-negative for {record['missed']['attack_class']} → {destination}")
901
+ print("\nnothing was sent. To report it upstream, open:")
902
+ print(f" {url}")
903
+ return 0
904
+
848
905
  ledger_path = (Path(args.ledger).expanduser() if args.ledger
849
906
  else Path(args.out or "websec-out") / "latest" / "findings-ledger.json").resolve()
850
907
  if not ledger_path.is_file():
@@ -1064,6 +1121,33 @@ def cmd_calibrate(args) -> int:
1064
1121
  write calibration.json (shipped + applied at runtime by findings.build_ledger)."""
1065
1122
  from importlib import resources
1066
1123
 
1124
+ # --claimspec: export the calibration the runtime actually uses (shipped table + your local
1125
+ # overlay, merged) as a claimspec v1 `calibration` document — the Guard-family shared format,
1126
+ # so another tool can read websec's P(real) table with its caveat, floor, backoff and
1127
+ # labelled fallback intact. Additive: the internal calibration.json shape is unchanged.
1128
+ if getattr(args, "claimspec", None):
1129
+ table = calibration.load()
1130
+ if not table:
1131
+ print("websec calibrate --claimspec: no calibration table is available (neither the shipped "
1132
+ "table nor a local overlay loaded). Nothing to export.")
1133
+ return 2
1134
+ try:
1135
+ doc = calibration.to_claimspec(table)
1136
+ except ValueError as e:
1137
+ sys.exit(f"error: --claimspec refused to export a non-reproducible table: {e}")
1138
+ text = json.dumps(doc, indent=2) + "\n"
1139
+ if args.claimspec == "-":
1140
+ sys.stdout.write(text)
1141
+ return 0
1142
+ dest = Path(args.claimspec).expanduser().resolve()
1143
+ dest.parent.mkdir(parents=True, exist_ok=True)
1144
+ dest.write_text(text)
1145
+ cells = len(doc["buckets"])
1146
+ print(f"websec calibrate --claimspec: wrote {dest} — source.kind={doc['source']['kind']}, "
1147
+ f"evidenceStatus={doc['source']['evidenceStatus']}, {cells} primary cell(s), "
1148
+ f"minN={doc['minN']}.")
1149
+ return 0
1150
+
1067
1151
  # --ingest-dast: close the loop with a REAL scan — a ZAP/Nuclei report confirms/refutes websec's
1068
1152
  # DAST-predictable findings (§4b) and folds the verdicts into your local overlay. Needs the ledger.
1069
1153
  if getattr(args, "ingest_dast", None):
@@ -1209,7 +1293,7 @@ def build_parser() -> argparse.ArgumentParser:
1209
1293
  # metavar lists only the user-facing commands; recon/proof/calibrate still work but are
1210
1294
  # omitted (they get no `help=`, so argparse leaves them out of the listing entirely).
1211
1295
  sub = p.add_subparsers(dest="cmd", required=True,
1212
- metavar="{run,doctor,dynamic,mcp,capabilities,feedback,intel,research,repair-verify,install,hooks}")
1296
+ metavar="{run,doctor,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
1213
1297
 
1214
1298
  r = sub.add_parser("run", help="full pipeline → briefing + tailored probes")
1215
1299
  r.add_argument("target")
@@ -1229,7 +1313,10 @@ def build_parser() -> argparse.ArgumentParser:
1229
1313
  help="also emit a Software Bill of Materials (default cyclonedx → sbom.cdx.json) via "
1230
1314
  "Trivy — offline, for CI/compliance (SLSA, EO 14028)")
1231
1315
  r.add_argument("--scanners", metavar="A,B",
1232
- help="comma-separated subset of scanners to run with --scan (e.g. gitleaks,semgrep)")
1316
+ help="comma-separated scanners to REQUIRE and run with --scan (e.g. gitleaks,semgrep). "
1317
+ "Selection is also a requirement: a selected scanner that is not installed is "
1318
+ "recorded as unavailable, makes the run incomplete, and exits 2 under --fail-on "
1319
+ "or --require-complete — a gate never reports green from a scanner that never ran.")
1233
1320
  r.add_argument("--format", choices=["briefing", "sarif", "json"], default="briefing",
1234
1321
  help="stdout format: briefing (human, default) | sarif (SARIF 2.1.0) | json (envelope). "
1235
1322
  "results.sarif is ALWAYS written to the run dir regardless.")
@@ -1310,6 +1397,9 @@ def build_parser() -> argparse.ArgumentParser:
1310
1397
  "(needs --ledger)")
1311
1398
  cal.add_argument("--ledger", metavar="findings-ledger.json",
1312
1399
  help="the websec ledger the --ingest-dast report is matched against")
1400
+ cal.add_argument("--claimspec", metavar="PATH",
1401
+ help="export the calibration the runtime uses (shipped + local overlay) as a "
1402
+ "claimspec v1 `calibration` document; `-` writes to stdout")
1313
1403
  cal.set_defaults(func=cmd_calibrate)
1314
1404
 
1315
1405
  dyn = sub.add_parser("dynamic", help="dynamic probes vs a LIVE target (read-only): cross-tenant BOLA (--config) or unauth reachability (--unauth)")
@@ -1374,7 +1464,8 @@ def build_parser() -> argparse.ArgumentParser:
1374
1464
 
1375
1465
  fb_parser = sub.add_parser(
1376
1466
  "feedback", help="record an offline verdict that a finding is wrong (metadata-only by default)")
1377
- fb_parser.add_argument("--fingerprint", required=True, help="fingerprint of the finding, from the ledger")
1467
+ fb_parser.add_argument("--fingerprint", help="fingerprint of the finding, from the ledger "
1468
+ "(not used by --verdict false-negative)")
1378
1469
  fb_parser.add_argument("--verdict", required=True, choices=list(_FEEDBACK_VERDICTS),
1379
1470
  help="false-positive: not a real issue · severity-wrong: real but misrated")
1380
1471
  fb_parser.add_argument("--reason", required=True, help="why the detector is wrong (max 1000 chars)")
@@ -1384,10 +1475,23 @@ def build_parser() -> argparse.ArgumentParser:
1384
1475
  fb_parser.add_argument("--include-snippet", action="store_true",
1385
1476
  help="also include title, route, file and evidence; prompts before writing")
1386
1477
  fb_parser.add_argument("--yes", action="store_true", help="skip the --include-snippet prompt (for scripts)")
1478
+ fb_parser.add_argument("--attack-class", dest="attack_class",
1479
+ help="what was missed (required with --verdict false-negative)")
1480
+ fb_parser.add_argument("--file-extension", dest="file_extension",
1481
+ help="optional language hint for a false negative; only the suffix is kept")
1387
1482
  fb_parser.add_argument("--out", help="output directory (default: websec-out)")
1388
1483
  fb_parser.add_argument("--format", choices=["text", "json"], default="text")
1389
1484
  fb_parser.set_defaults(func=cmd_feedback)
1390
1485
 
1486
+ dm = sub.add_parser("demo", help="scan a bundled sample app to see real output (writes nothing here)")
1487
+ dm.set_defaults(func=cmd_demo)
1488
+
1489
+ ex = sub.add_parser("explain", help="what an attack class means and how to confirm it (offline)")
1490
+ ex.add_argument("term", nargs="?", help="attack class (e.g. bola) or CWE id (e.g. CWE-918)")
1491
+ ex.add_argument("--list", action="store_true", help="list every attack class this build cites")
1492
+ ex.add_argument("--format", choices=["text", "json"], default="text")
1493
+ ex.set_defaults(func=cmd_explain)
1494
+
1391
1495
  intelligence = sub.add_parser("intel", help="explicit public threat-feed refresh and offline known-CVE reassessment")
1392
1496
  intel_actions = intelligence.add_subparsers(dest="action", required=True)
1393
1497
  for action in ("refresh", "status", "reassess"):
@@ -1438,7 +1542,7 @@ def build_parser() -> argparse.ArgumentParser:
1438
1542
  return p
1439
1543
 
1440
1544
 
1441
- _COMMANDS = {"run", "recon", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest"}
1545
+ _COMMANDS = {"run", "recon", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo"}
1442
1546
 
1443
1547
 
1444
1548
  def main(argv=None) -> int:
@@ -0,0 +1,74 @@
1
+ """`websec demo` — a real run against a bundled sample, in a throwaway directory.
2
+
3
+ Adoption problem this solves: the output is the product, and you cannot see it without
4
+ first pointing the tool at something you care about. A sample removes that step.
5
+
6
+ It is a genuine run — the same recon, ledger and briefing code as `websec run`, not a
7
+ canned transcript — so what you see is what the tool actually produces today. It writes
8
+ only inside a temporary directory and never touches the current project.
9
+
10
+ The sample ships as `.txt` so nothing imports, lints or executes it, and it deliberately
11
+ contains no credential-shaped strings: a fake secret inside an installed package would be
12
+ found by other people's secret scanners pointed at site-packages.
13
+ """
14
+ from __future__ import annotations
15
+
16
+ import shutil
17
+ import tempfile
18
+ from importlib import resources
19
+ from pathlib import Path
20
+
21
+ # Shipped name -> name it takes in the materialised sample.
22
+ FILES = {"app.py.txt": "app.py", "requirements.txt.txt": "requirements.txt"}
23
+
24
+
25
+ def materialize(destination: Path) -> Path:
26
+ """Write the sample app into `destination`. Returns the sample root."""
27
+ root = destination / "demo-app"
28
+ (root / "src").mkdir(parents=True, exist_ok=True)
29
+ base = resources.files("websec_validator").joinpath("templates/demo")
30
+ for shipped, real in FILES.items():
31
+ target = root / ("src/" + real if real.endswith(".py") else real)
32
+ target.write_text(base.joinpath(shipped).read_text(encoding="utf-8"), encoding="utf-8")
33
+ return root
34
+
35
+
36
+ def run(log=print) -> int:
37
+ """Scan the bundled sample and summarise what it found."""
38
+ from . import __version__, findings, recon
39
+
40
+ temp = Path(tempfile.mkdtemp(prefix="websec-demo-"))
41
+ try:
42
+ root = materialize(temp)
43
+ log(f"websec-validator v{__version__} — demo")
44
+ log(f"\n Scanning a bundled sample app ({root.name}); your project is untouched.")
45
+ log(" This is a real run, not a recording.\n")
46
+
47
+ facts = recon.build_facts(root, __version__, None)
48
+ ledger = findings.build_ledger(facts, None)
49
+ rows = ledger.get("findings") or []
50
+ if not rows:
51
+ # Never claim a clean demo: if the sample stops tripping the detectors that is
52
+ # a regression in the tool, not a result worth showing.
53
+ log(" No findings on the sample — that is a bug in the detectors, not a clean bill.")
54
+ return 1
55
+
56
+ log(f" {len(rows)} finding(s):\n")
57
+ for row in rows[:12]:
58
+ log(f" {row.get('severity', '?'):8} {row.get('attack_class', '?'):22} "
59
+ f"{row.get('title', '')[:58]}")
60
+ if len(rows) > 12:
61
+ log(f" … and {len(rows) - 12} more")
62
+
63
+ log("\n What to do with these:")
64
+ log(" websec explain <attack-class> what a class means and how to confirm it")
65
+ log(" websec run ./your-project the same pass against your own code")
66
+ log(" websec run ./your-project --scan add any scanners you have installed")
67
+ log("\n Severity, analyzer confidence and calibrated probability are separate signals.")
68
+ log(" A finding is a lead to verify, not a confirmed vulnerability.")
69
+ log("\n `websec run` also writes AGENT-BRIEFING.md — the marching orders an agent"
70
+ "\n reads — plus the ledger, coverage record and SARIF. This summary is the"
71
+ "\n short version of the findings half.")
72
+ return 0
73
+ finally:
74
+ shutil.rmtree(temp, ignore_errors=True)
@@ -0,0 +1,110 @@
1
+ """`websec explain <attack-class>` — what a finding class means, offline.
2
+
3
+ A ledger entry names an attack class, cites a CWE and states a calibrated probability.
4
+ Acting on it still needs three things the entry does not carry: what the class actually
5
+ is, what would confirm or refute it in this codebase, and how much the number is worth.
6
+ Without that an agent either trusts every lead or none.
7
+
8
+ Everything here comes from data the package already ships — STANDARDS, REMEDIATION and
9
+ the calibration table — so there is no second source of truth to drift, and no network.
10
+ """
11
+ from __future__ import annotations
12
+
13
+ import difflib
14
+ import re
15
+
16
+ from .findings import REMEDIATION, STANDARDS, _DEFAULT_REM
17
+
18
+ # What would settle it. Keyed by class where the generic line is not enough; the fallback
19
+ # is deliberately about *evidence*, since that is the step agents skip.
20
+ VERIFY = {
21
+ "missing-auth": "Call the route with no credentials and with a valid non-owner identity. A 401 "
22
+ "for both is enforcement; a 200 for either is the finding. A changed status "
23
+ "alone proves nothing without a positive control that should succeed.",
24
+ "bola": "Authenticate as user A, request user B's resource id. Success is the finding. Confirm "
25
+ "the ids are genuinely distinct tenants, not two rows the same account owns.",
26
+ "sqli": "Trace the parameter to the driver call. Concatenation or f-string into SQL is the "
27
+ "finding; a parameterized placeholder is not, even when the value is attacker-controlled.",
28
+ "command-injection": "Trace the argument to the exec call. shell=True with any request-derived "
29
+ "segment is the finding; an argument array is not.",
30
+ "ssrf": "Confirm the URL is request-derived rather than a constant or template literal, and that "
31
+ "the caller is server-side. A browser fetch is not SSRF.",
32
+ "secret": "Confirm the value is live, not a placeholder or test fixture, then rotate it. A "
33
+ "secret in git history stays exposed after deletion from the working tree.",
34
+ "cve": "Confirm the vulnerable package is actually reachable from your entry points. An "
35
+ "advisory on an unreachable transitive dependency is real but not urgent.",
36
+ }
37
+ _GENERIC_VERIFY = ("Read the cited file and confirm the dangerous operation is reachable from "
38
+ "attacker-controlled input. A framework name, a helper's name, a comment or a "
39
+ "safe sibling call does not prove the operation safe.")
40
+
41
+
42
+ def classes() -> list[str]:
43
+ return sorted(STANDARDS)
44
+
45
+
46
+ def _calibration_for(attack_class: str) -> str:
47
+ try:
48
+ from . import calibration
49
+ table = calibration.load()
50
+ if not table:
51
+ return "no calibration table available"
52
+ cells = table.get("by_class_label", {})
53
+ rows = {k.split("|", 1)[1]: v for k, v in cells.items()
54
+ if k.split("|", 1)[0] == attack_class and isinstance(v, dict)}
55
+ if not rows:
56
+ return "no measured cell for this class — findings fall back to the label prior"
57
+ parts = [f"{label} → p={v.get('p')} (n={v.get('n')})" for label, v in sorted(rows.items())]
58
+ return "; ".join(parts)
59
+ except Exception:
60
+ return "calibration unavailable"
61
+
62
+
63
+ def describe(term: str) -> dict:
64
+ """Resolve a class name or a CWE id. Never guesses between two matches."""
65
+ key = (term or "").strip().lower()
66
+ if not key:
67
+ return {"ok": False, "error": "give an attack class or a CWE id, e.g. `websec explain bola`"}
68
+
69
+ if key in STANDARDS:
70
+ resolved = key
71
+ elif re.fullmatch(r"cwe-\d+", key):
72
+ hits = [c for c, (cwes, _a, _o) in STANDARDS.items()
73
+ if any(w.lower().startswith(key) for w in cwes)]
74
+ if not hits:
75
+ return {"ok": False, "error": f"no shipped attack class cites {term.upper()}"}
76
+ if len(hits) > 1:
77
+ return {"ok": False, "error": f"{term.upper()} is cited by {len(hits)} classes: "
78
+ f"{', '.join(sorted(hits))} — name one"}
79
+ resolved = hits[0]
80
+ else:
81
+ near = difflib.get_close_matches(key, classes(), n=3, cutoff=0.6)
82
+ hint = f" Did you mean: {', '.join(near)}?" if near else ""
83
+ return {"ok": False, "error": f"unknown attack class {term!r}.{hint} "
84
+ f"`websec capabilities` lists what this build detects."}
85
+
86
+ cwe, asvs, api = STANDARDS[resolved]
87
+ return {"ok": True, "attack_class": resolved,
88
+ "cwe": list(cwe), "asvs": f"ASVS 4.0.3 {asvs[5:]}" if asvs.startswith("ASVS") else asvs,
89
+ "owasp": list(api),
90
+ "remediation": REMEDIATION.get(resolved, _DEFAULT_REM),
91
+ "verify": VERIFY.get(resolved, _GENERIC_VERIFY),
92
+ "calibration": _calibration_for(resolved)}
93
+
94
+
95
+ def render(info: dict) -> str:
96
+ if not info.get("ok"):
97
+ return f"error: {info.get('error', 'unknown')}"
98
+ out = [f"{info['attack_class']}", ""]
99
+ if info["cwe"]:
100
+ out.append(f" CWE: {'; '.join(info['cwe'])}")
101
+ if info["asvs"]:
102
+ out.append(f" ASVS: {info['asvs']}")
103
+ if info["owasp"]:
104
+ out.append(f" OWASP API: {'; '.join(info['owasp'])}")
105
+ out += ["", " How to confirm or refute it:", f" {info['verify']}",
106
+ "", " Remediation pattern:", f" {info['remediation']}",
107
+ "", f" Calibration: {info['calibration']}",
108
+ " Severity, analyzer confidence and calibrated probability are separate signals;",
109
+ " an unknown truth label is not a false positive."]
110
+ return "\n".join(out)