websec-validator 0.15.1__tar.gz → 0.15.3__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 (186) hide show
  1. {websec_validator-0.15.1/src/websec_validator.egg-info → websec_validator-0.15.3}/PKG-INFO +7 -4
  2. {websec_validator-0.15.1 → websec_validator-0.15.3}/README.md +6 -3
  3. {websec_validator-0.15.1 → websec_validator-0.15.3}/pyproject.toml +2 -2
  4. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/cli.py +91 -4
  5. websec_validator-0.15.3/src/websec_validator/demo.py +74 -0
  6. websec_validator-0.15.3/src/websec_validator/explain.py +110 -0
  7. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/feedback.py +47 -5
  8. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/gate.py +8 -0
  9. websec_validator-0.15.3/src/websec_validator/provenance.py +134 -0
  10. websec_validator-0.15.3/src/websec_validator/templates/demo/app.py.txt +33 -0
  11. websec_validator-0.15.3/src/websec_validator/templates/demo/requirements.txt.txt +2 -0
  12. {websec_validator-0.15.1 → websec_validator-0.15.3/src/websec_validator.egg-info}/PKG-INFO +7 -4
  13. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator.egg-info/SOURCES.txt +8 -0
  14. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_agent_hook.py +3 -1
  15. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_attest.py +3 -1
  16. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_attribution.py +3 -1
  17. websec_validator-0.15.3/tests/test_demo.py +75 -0
  18. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_diffscope.py +3 -1
  19. websec_validator-0.15.3/tests/test_explain.py +93 -0
  20. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_feedback.py +36 -0
  21. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_gate_and_bypass_record.py +3 -1
  22. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_gate_command.py +40 -1
  23. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_hooks.py +3 -0
  24. websec_validator-0.15.3/tests/test_provenance.py +134 -0
  25. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_recon.py +31 -0
  26. {websec_validator-0.15.1 → websec_validator-0.15.3}/LICENSE +0 -0
  27. {websec_validator-0.15.1 → websec_validator-0.15.3}/setup.cfg +0 -0
  28. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/__init__.py +0 -0
  29. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/agenthook.py +0 -0
  30. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/attest.py +0 -0
  31. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/attribution.py +0 -0
  32. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/baseline.py +0 -0
  33. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/briefing.py +0 -0
  34. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/calibration.json +0 -0
  35. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/calibration.py +0 -0
  36. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/constitution.py +0 -0
  37. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/corpus.json +0 -0
  38. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/coverage.py +0 -0
  39. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/dast_ingest.py +0 -0
  40. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/dast_predict.py +0 -0
  41. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/diffscope.py +0 -0
  42. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/dynamic.py +0 -0
  43. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/enrichment.py +0 -0
  44. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/__init__.py +0 -0
  45. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/agent_config.py +0 -0
  46. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/auth.py +0 -0
  47. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/authz.py +0 -0
  48. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/authz_dataflow.py +0 -0
  49. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/base.py +0 -0
  50. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/client_exposure.py +0 -0
  51. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/client_integrity.py +0 -0
  52. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/crypto_usage.py +0 -0
  53. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/dependencies.py +0 -0
  54. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/django_urls.py +0 -0
  55. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/graphql.py +0 -0
  56. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/iac_ci.py +0 -0
  57. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/integrations.py +0 -0
  58. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/llm_security.py +0 -0
  59. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/pii_exposure.py +0 -0
  60. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/policy_consistency.py +0 -0
  61. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/profiles.py +0 -0
  62. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/routes.py +0 -0
  63. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/schemas.py +0 -0
  64. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/sql_flow.py +0 -0
  65. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/stack.py +0 -0
  66. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/surface.py +0 -0
  67. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/syntax.py +0 -0
  68. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/tenant.py +0 -0
  69. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/transport_security.py +0 -0
  70. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/upload_security.py +0 -0
  71. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/extractors/webext.py +0 -0
  72. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/findings.py +0 -0
  73. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/fixprompt.py +0 -0
  74. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/formats.py +0 -0
  75. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/fpfilter.py +0 -0
  76. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/graph_enrich.py +0 -0
  77. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/hooks.py +0 -0
  78. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/install.py +0 -0
  79. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/intel.py +0 -0
  80. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/inventory.py +0 -0
  81. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/mcp_server.py +0 -0
  82. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/openapi.py +0 -0
  83. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/probes.py +0 -0
  84. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/proof.py +0 -0
  85. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/recon.py +0 -0
  86. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/registry.py +0 -0
  87. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/repairs.py +0 -0
  88. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/report.py +0 -0
  89. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/research/control-scope-cases.json +0 -0
  90. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/research/example.json +0 -0
  91. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/research/profile-cases.json +0 -0
  92. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/research.py +0 -0
  93. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
  94. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
  95. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/sarif_ingest.py +0 -0
  96. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/scanners.py +0 -0
  97. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/schemas/coverage.schema.json +0 -0
  98. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/schemas/facts.schema.json +0 -0
  99. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/schemas/ledger.schema.json +0 -0
  100. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/_lib.py +0 -0
  101. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
  102. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
  103. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
  104. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
  105. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
  106. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
  107. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
  108. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
  109. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
  110. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
  111. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/forged-token.sh +0 -0
  112. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
  113. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
  114. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
  115. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
  116. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
  117. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/race-conditions.py +0 -0
  118. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
  119. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
  120. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
  121. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
  122. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
  123. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
  124. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
  125. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
  126. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
  127. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
  128. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
  129. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator/testplan.py +0 -0
  130. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator.egg-info/dependency_links.txt +0 -0
  131. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator.egg-info/entry_points.txt +0 -0
  132. {websec_validator-0.15.1 → websec_validator-0.15.3}/src/websec_validator.egg-info/top_level.txt +0 -0
  133. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_action_contracts.py +0 -0
  134. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_adoption_contracts.py +0 -0
  135. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_agent_hosts.py +0 -0
  136. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_agent_launch_specs.py +0 -0
  137. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_analysis_scope.py +0 -0
  138. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_assurance_regressions.py +0 -0
  139. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_auth_control_scope.py +0 -0
  140. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_constitution.py +0 -0
  141. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_control_scope_research.py +0 -0
  142. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_coverage.py +0 -0
  143. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_crypto_comparisons.py +0 -0
  144. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_dast_ingest.py +0 -0
  145. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_dast_predict.py +0 -0
  146. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_detector_precision.py +0 -0
  147. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_django_routes.py +0 -0
  148. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_enrichment.py +0 -0
  149. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_entitlement_webext.py +0 -0
  150. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_evidence_verdicts.py +0 -0
  151. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_extension_controls.py +0 -0
  152. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_fixprompt_fpfilter.py +0 -0
  153. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_formats.py +0 -0
  154. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_gitleaks_worktree.py +0 -0
  155. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_graph_enrich.py +0 -0
  156. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_hardening.py +0 -0
  157. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_hooks_contracts.py +0 -0
  158. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_install.py +0 -0
  159. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_install_contracts.py +0 -0
  160. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_intel.py +0 -0
  161. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_inventory.py +0 -0
  162. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_lifecycle.py +0 -0
  163. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_mcp.py +0 -0
  164. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_mcp_security.py +0 -0
  165. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_openapi.py +0 -0
  166. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_output_boundaries.py +0 -0
  167. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_pentest_regressions.py +0 -0
  168. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_profiles.py +0 -0
  169. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_proof_revisions.py +0 -0
  170. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_public_precision.py +0 -0
  171. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_read_boundary.py +0 -0
  172. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_read_performance.py +0 -0
  173. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_registry_existence.py +0 -0
  174. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_remaining_control_scope.py +0 -0
  175. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_research.py +0 -0
  176. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_research_cli.py +0 -0
  177. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_sarif_ingest.py +0 -0
  178. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_sarif_workbench.py +0 -0
  179. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_scanner_contracts.py +0 -0
  180. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_source_budget.py +0 -0
  181. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_sql_flow.py +0 -0
  182. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_stack_metadata.py +0 -0
  183. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_testplan.py +0 -0
  184. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_transport_pii_scope.py +0 -0
  185. {websec_validator-0.15.1 → websec_validator-0.15.3}/tests/test_transport_stack_scope.py +0 -0
  186. {websec_validator-0.15.1 → websec_validator-0.15.3}/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.1
3
+ Version: 0.15.3
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
@@ -516,6 +516,9 @@ read policy; an unrelated working directory no longer contributes implicit suppr
516
516
 
517
517
  ```bash
518
518
  websec capabilities # offline profile/check/limitation matrix
519
+ websec demo # real scan of a bundled sample; writes nothing here
520
+ websec explain bola # what a class means + how to confirm it
521
+ websec explain --list # every attack class this build cites
519
522
  websec feedback --fingerprint <fp> --verdict false-positive \
520
523
  --reason "behind an nginx auth_request" # report a wrong detector; metadata-only, sends nothing
521
524
  websec intel status # offline freshness and provenance
@@ -623,7 +626,7 @@ add the matching dated changelog and migration guidance, and validate the combin
623
626
  In the 0.x series, feature additions or incompatible contracts increment the minor version.
624
627
 
625
628
  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.1` for this
629
+ required CI checks pass. The resulting main commit subject must be `release: v0.15.3` for this
627
630
  release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
628
631
  package version, creates the matching tag/GitHub Release, and explicitly dispatches
629
632
  [publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
@@ -639,7 +642,7 @@ omit an independent version field. Check both sources when diagnosing stale inst
639
642
 
640
643
  ## Status / roadmap
641
644
 
642
- Version 0.15.1 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
645
+ Version 0.15.3 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
643
646
  SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
644
647
  intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
645
648
  (`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
@@ -650,7 +653,7 @@ in-loop gate is developer ergonomics, not a control, and `attest` reports eviden
650
653
  rendering a compliance verdict.
651
654
 
652
655
  The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
653
- changes. 0.15.1 is a patch over 0.15.0 and needs no migration.
656
+ changes. 0.15.3 is a patch over 0.15.2 and needs no migration.
654
657
  The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
655
658
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
656
659
  Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
@@ -487,6 +487,9 @@ read policy; an unrelated working directory no longer contributes implicit suppr
487
487
 
488
488
  ```bash
489
489
  websec capabilities # offline profile/check/limitation matrix
490
+ websec demo # real scan of a bundled sample; writes nothing here
491
+ websec explain bola # what a class means + how to confirm it
492
+ websec explain --list # every attack class this build cites
490
493
  websec feedback --fingerprint <fp> --verdict false-positive \
491
494
  --reason "behind an nginx auth_request" # report a wrong detector; metadata-only, sends nothing
492
495
  websec intel status # offline freshness and provenance
@@ -594,7 +597,7 @@ add the matching dated changelog and migration guidance, and validate the combin
594
597
  In the 0.x series, feature additions or incompatible contracts increment the minor version.
595
598
 
596
599
  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.1` for this
600
+ required CI checks pass. The resulting main commit subject must be `release: v0.15.3` for this
598
601
  release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
599
602
  package version, creates the matching tag/GitHub Release, and explicitly dispatches
600
603
  [publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
@@ -610,7 +613,7 @@ omit an independent version field. Check both sources when diagnosing stale inst
610
613
 
611
614
  ## Status / roadmap
612
615
 
613
- Version 0.15.1 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
616
+ Version 0.15.3 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
614
617
  SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
615
618
  intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
616
619
  (`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
@@ -621,7 +624,7 @@ in-loop gate is developer ergonomics, not a control, and `attest` reports eviden
621
624
  rendering a compliance verdict.
622
625
 
623
626
  The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
624
- changes. 0.15.1 is a patch over 0.15.0 and needs no migration.
627
+ changes. 0.15.3 is a patch over 0.15.2 and needs no migration.
625
628
  The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
626
629
  unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
627
630
  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.1"
7
+ version = "0.15.3"
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"]
@@ -12,6 +12,7 @@ agent at the generated AGENT-BRIEFING.md.
12
12
  from __future__ import annotations
13
13
 
14
14
  import argparse
15
+ import difflib
15
16
  import hashlib
16
17
  import json
17
18
  import os
@@ -161,6 +162,12 @@ def cmd_doctor(args) -> int:
161
162
  det = scanners.detect(langs)
162
163
  print(f"websec-validator v{__version__} — scanner check"
163
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)
164
171
  print("\n available:")
165
172
  for s in det["available"]:
166
173
  print(f" ✓ {s['name']:20} {s['category']}")
@@ -770,6 +777,12 @@ def cmd_gate(args) -> int:
770
777
  if not paths:
771
778
  discovered = _gate.working_tree_paths(target)
772
779
  paths, scope_source = discovered["paths"], discovered["source"]
780
+ if scope_source == "working-tree-unavailable":
781
+ # Not a pass: the gate could not determine what to analyse, so it never
782
+ # answered the question. Exit 2 (incomplete requested execution), never 0.
783
+ print(f"error: {discovered.get('note', 'changed-file scope unavailable')}",
784
+ file=sys.stderr)
785
+ return 2
773
786
  if not paths:
774
787
  # Nothing changed is a PASS, but say which question was answered.
775
788
  print(_gate.to_json({"tool": "websec-validator", "command": "gate", "passed": True,
@@ -833,11 +846,62 @@ def cmd_capabilities(args) -> int:
833
846
  return 0
834
847
 
835
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
+
836
876
  def cmd_feedback(args) -> int:
837
877
  """Record an operator verdict on detector correctness. Local, offline, redacted."""
838
878
  import sys
839
879
  fb = feedback
840
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
+
841
905
  ledger_path = (Path(args.ledger).expanduser() if args.ledger
842
906
  else Path(args.out or "websec-out") / "latest" / "findings-ledger.json").resolve()
843
907
  if not ledger_path.is_file():
@@ -1202,7 +1266,7 @@ def build_parser() -> argparse.ArgumentParser:
1202
1266
  # metavar lists only the user-facing commands; recon/proof/calibrate still work but are
1203
1267
  # omitted (they get no `help=`, so argparse leaves them out of the listing entirely).
1204
1268
  sub = p.add_subparsers(dest="cmd", required=True,
1205
- metavar="{run,doctor,dynamic,mcp,capabilities,feedback,intel,research,repair-verify,install,hooks}")
1269
+ metavar="{run,doctor,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
1206
1270
 
1207
1271
  r = sub.add_parser("run", help="full pipeline → briefing + tailored probes")
1208
1272
  r.add_argument("target")
@@ -1367,7 +1431,8 @@ def build_parser() -> argparse.ArgumentParser:
1367
1431
 
1368
1432
  fb_parser = sub.add_parser(
1369
1433
  "feedback", help="record an offline verdict that a finding is wrong (metadata-only by default)")
1370
- fb_parser.add_argument("--fingerprint", required=True, help="fingerprint of the finding, from the ledger")
1434
+ fb_parser.add_argument("--fingerprint", help="fingerprint of the finding, from the ledger "
1435
+ "(not used by --verdict false-negative)")
1371
1436
  fb_parser.add_argument("--verdict", required=True, choices=list(_FEEDBACK_VERDICTS),
1372
1437
  help="false-positive: not a real issue · severity-wrong: real but misrated")
1373
1438
  fb_parser.add_argument("--reason", required=True, help="why the detector is wrong (max 1000 chars)")
@@ -1377,10 +1442,23 @@ def build_parser() -> argparse.ArgumentParser:
1377
1442
  fb_parser.add_argument("--include-snippet", action="store_true",
1378
1443
  help="also include title, route, file and evidence; prompts before writing")
1379
1444
  fb_parser.add_argument("--yes", action="store_true", help="skip the --include-snippet prompt (for scripts)")
1445
+ fb_parser.add_argument("--attack-class", dest="attack_class",
1446
+ help="what was missed (required with --verdict false-negative)")
1447
+ fb_parser.add_argument("--file-extension", dest="file_extension",
1448
+ help="optional language hint for a false negative; only the suffix is kept")
1380
1449
  fb_parser.add_argument("--out", help="output directory (default: websec-out)")
1381
1450
  fb_parser.add_argument("--format", choices=["text", "json"], default="text")
1382
1451
  fb_parser.set_defaults(func=cmd_feedback)
1383
1452
 
1453
+ dm = sub.add_parser("demo", help="scan a bundled sample app to see real output (writes nothing here)")
1454
+ dm.set_defaults(func=cmd_demo)
1455
+
1456
+ ex = sub.add_parser("explain", help="what an attack class means and how to confirm it (offline)")
1457
+ ex.add_argument("term", nargs="?", help="attack class (e.g. bola) or CWE id (e.g. CWE-918)")
1458
+ ex.add_argument("--list", action="store_true", help="list every attack class this build cites")
1459
+ ex.add_argument("--format", choices=["text", "json"], default="text")
1460
+ ex.set_defaults(func=cmd_explain)
1461
+
1384
1462
  intelligence = sub.add_parser("intel", help="explicit public threat-feed refresh and offline known-CVE reassessment")
1385
1463
  intel_actions = intelligence.add_subparsers(dest="action", required=True)
1386
1464
  for action in ("refresh", "status", "reassess"):
@@ -1431,7 +1509,7 @@ def build_parser() -> argparse.ArgumentParser:
1431
1509
  return p
1432
1510
 
1433
1511
 
1434
- _COMMANDS = {"run", "recon", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest"}
1512
+ _COMMANDS = {"run", "recon", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo"}
1435
1513
 
1436
1514
 
1437
1515
  def main(argv=None) -> int:
@@ -1440,8 +1518,17 @@ def main(argv=None) -> int:
1440
1518
  if not argv: # bare `websec` → show help, don't error
1441
1519
  parser.print_help()
1442
1520
  return 0
1443
- # bare `websec <path>` (no subcommand) ⇒ treat as `websec run <path>` — point-and-go
1521
+ # bare `websec <path>` (no subcommand) ⇒ treat as `websec run <path>` — point-and-go.
1522
+ # Gate this on the path EXISTING. Without that check a mistyped or not-yet-released
1523
+ # subcommand is silently rewritten into a scan target: `websec atest .` scanned the
1524
+ # current directory, and `websec gate --help` on a build with no gate printed run's
1525
+ # help and exited 0, so a missing command was indistinguishable from a present one.
1444
1526
  if argv[0] not in _COMMANDS and not argv[0].startswith("-"):
1527
+ if not Path(argv[0]).expanduser().exists():
1528
+ near = difflib.get_close_matches(argv[0], sorted(_COMMANDS), n=1, cutoff=0.6)
1529
+ hint = f" Did you mean {near[0]!r}?" if near else ""
1530
+ parser.error(f"unknown command {argv[0]!r} (and no such path).{hint} "
1531
+ f"Run `websec --help` for the command list.")
1445
1532
  argv = ["run"] + argv
1446
1533
  args = parser.parse_args(argv)
1447
1534
  return args.func(args)
@@ -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)
@@ -17,6 +17,7 @@ the operator's explicit act in their own browser.
17
17
  from __future__ import annotations
18
18
 
19
19
  import json
20
+ import re
20
21
  import urllib.parse
21
22
  from datetime import datetime, timezone
22
23
  from pathlib import Path
@@ -25,7 +26,10 @@ SCHEMA_VERSION = "1.0"
25
26
  FEEDBACK_FILENAME = "feedback.jsonl"
26
27
  ISSUE_REPO = "raccioly/websec-validator"
27
28
 
28
- VERDICTS = ("false-positive", "severity-wrong")
29
+ VERDICTS = ("false-positive", "severity-wrong", "false-negative")
30
+ # A false negative has no fingerprint to anchor to — the point is that nothing was
31
+ # reported — so it is described by attack class instead, and carries no finding block.
32
+ FINDING_VERDICTS = ("false-positive", "severity-wrong")
29
33
  SEVERITIES = ("INFO", "LOW", "MEDIUM", "HIGH", "CRITICAL")
30
34
 
31
35
  MAX_REASON = 1000
@@ -103,11 +107,46 @@ def find_finding(ledger: dict, fingerprint: str) -> dict:
103
107
  raise FeedbackError(f"no finding with fingerprint {fingerprint} in this ledger")
104
108
 
105
109
 
110
+ def build_missed_record(*, attack_class: str, reason: str, envelope: dict | None = None,
111
+ run_id: str = "", file_extension: str = "", now=None) -> dict:
112
+ """A report that websec MISSED something. No fingerprint exists, by definition.
113
+
114
+ Kept separate from build_record rather than bolted on: a false negative shares no
115
+ structure with a finding report, and forcing one shape would mean emitting a
116
+ `finding` block describing something the tool never produced.
117
+ """
118
+ attack_class = (attack_class or "").strip().lower()
119
+ if not attack_class:
120
+ raise FeedbackError("--attack-class is required with --verdict false-negative")
121
+ if not re.fullmatch(r"[a-z0-9][a-z0-9-]{1,63}", attack_class):
122
+ raise FeedbackError("--attack-class must be a short lowercase identifier, e.g. 'sqli'")
123
+ reason = (reason or "").strip()
124
+ if not reason:
125
+ raise FeedbackError("--reason is required: describe what was missed and where it lives")
126
+ if len(reason) > MAX_REASON:
127
+ raise FeedbackError(f"--reason exceeds {MAX_REASON} characters")
128
+ stamp = (now or datetime.now(timezone.utc)).strftime("%Y-%m-%dT%H:%M:%SZ")
129
+ return {
130
+ "schema_version": SCHEMA_VERSION,
131
+ "recorded": stamp,
132
+ "verdict": "false-negative",
133
+ "reason": reason,
134
+ # Metadata-only by construction: an operator describing a miss in free text controls
135
+ # exactly what it contains, and nothing is lifted out of their source.
136
+ "redaction": "metadata-only",
137
+ "run_id": run_id or "",
138
+ "tool_version": (envelope or {}).get("tool_version", ""),
139
+ "missed": {"attack_class": attack_class,
140
+ "file_extension": _extension(file_extension) if file_extension else ""},
141
+ }
142
+
143
+
106
144
  def build_record(finding: dict, *, verdict: str, reason: str, envelope: dict | None = None,
107
145
  run_id: str = "", expected_severity: str = "",
108
146
  include_snippet: bool = False, now=None) -> dict:
109
- if verdict not in VERDICTS:
110
- raise FeedbackError(f"--verdict must be one of {', '.join(VERDICTS)}")
147
+ if verdict not in FINDING_VERDICTS:
148
+ raise FeedbackError(f"--verdict must be one of {', '.join(FINDING_VERDICTS)} "
149
+ "for a report about an existing finding")
111
150
  reason = (reason or "").strip()
112
151
  if not reason:
113
152
  raise FeedbackError("--reason is required: state why the detector is wrong")
@@ -152,9 +191,12 @@ def append(path: Path, record: dict) -> Path:
152
191
 
153
192
  def issue_url(record: dict, repo: str = ISSUE_REPO) -> str:
154
193
  """Build a prefilled issue link. Returned as text; nothing is opened or sent."""
155
- finding = record.get("finding", {})
194
+ finding = record.get("finding") or record.get("missed") or {}
156
195
  verdict = record["verdict"]
157
- title = f"[{verdict}] {finding.get('attack_class') or 'finding'} ({finding.get('rule_id') or 'no rule id'})"
196
+ if verdict == "false-negative":
197
+ title = f"[false-negative] {finding.get('attack_class') or 'unknown'} not reported"
198
+ else:
199
+ title = f"[{verdict}] {finding.get('attack_class') or 'finding'} ({finding.get('rule_id') or 'no rule id'})"
158
200
  body = (
159
201
  f"**Verdict:** {verdict}\n"
160
202
  f"**Reason:** {record['reason']}\n"
@@ -68,6 +68,14 @@ def working_tree_paths(repo: Path) -> dict:
68
68
  out: list[str] = []
69
69
  # -z keeps paths with spaces/newlines intact; porcelain v1 is stable across git versions.
70
70
  raw = _git(repo, "status", "--porcelain", "-z", "--untracked-files=all")
71
+ if raw is None:
72
+ # `git status` failed (timeout, index.lock contention, non-zero exit). An empty
73
+ # path list here is NOT an empty working tree, and reporting source="working-tree"
74
+ # would make the two indistinguishable — the gate would then pass having analysed
75
+ # nothing. The rev-parse check above already draws this distinction; so does this.
76
+ return {"paths": [], "source": "working-tree-unavailable",
77
+ "note": "`git status` did not complete, so the changed-file set is unknown; "
78
+ "pass paths explicitly with --only"}
71
79
  if raw:
72
80
  for entry in raw.split("\0"):
73
81
  if len(entry) < 4: