websec-validator 0.15.2__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.
- {websec_validator-0.15.2/src/websec_validator.egg-info → websec_validator-0.15.3}/PKG-INFO +7 -4
- {websec_validator-0.15.2 → websec_validator-0.15.3}/README.md +6 -3
- {websec_validator-0.15.2 → websec_validator-0.15.3}/pyproject.toml +2 -2
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/cli.py +74 -3
- websec_validator-0.15.3/src/websec_validator/demo.py +74 -0
- websec_validator-0.15.3/src/websec_validator/explain.py +110 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/feedback.py +47 -5
- websec_validator-0.15.3/src/websec_validator/provenance.py +134 -0
- websec_validator-0.15.3/src/websec_validator/templates/demo/app.py.txt +33 -0
- websec_validator-0.15.3/src/websec_validator/templates/demo/requirements.txt.txt +2 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3/src/websec_validator.egg-info}/PKG-INFO +7 -4
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator.egg-info/SOURCES.txt +8 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_agent_hook.py +3 -1
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_attest.py +3 -1
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_attribution.py +3 -1
- websec_validator-0.15.3/tests/test_demo.py +75 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_diffscope.py +3 -1
- websec_validator-0.15.3/tests/test_explain.py +93 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_feedback.py +36 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_gate_and_bypass_record.py +3 -1
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_gate_command.py +3 -1
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_hooks.py +3 -0
- websec_validator-0.15.3/tests/test_provenance.py +134 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/LICENSE +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/setup.cfg +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/agenthook.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/attribution.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/briefing.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/calibration.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/calibration.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/coverage.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/diffscope.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/dynamic.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/auth.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/base.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/client_exposure.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/crypto_usage.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/dependencies.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/pii_exposure.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/upload_security.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/extractors/webext.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/findings.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/gate.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/graph_enrich.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/hooks.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/install.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/mcp_server.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/probes.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/recon.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/report.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/research.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/scanners.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/schemas/coverage.schema.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/schemas/ledger.schema.json +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/_lib.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/forged-token.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/race-conditions.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_action_contracts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_adoption_contracts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_constitution.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_coverage.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_crypto_comparisons.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_django_routes.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_enrichment.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_formats.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_hardening.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_hooks_contracts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_install.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_install_contracts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_intel.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_inventory.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_mcp.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_openapi.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_output_boundaries.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_profiles.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_public_precision.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_read_performance.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_recon.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_research.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_research_cli.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_sarif_workbench.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_scanner_contracts.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_source_budget.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_sql_flow.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_stack_metadata.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_testplan.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.15.2 → websec_validator-0.15.3}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.15.2 → 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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"]
|
|
@@ -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():
|
|
@@ -1209,7 +1266,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1209
1266
|
# metavar lists only the user-facing commands; recon/proof/calibrate still work but are
|
|
1210
1267
|
# omitted (they get no `help=`, so argparse leaves them out of the listing entirely).
|
|
1211
1268
|
sub = p.add_subparsers(dest="cmd", required=True,
|
|
1212
|
-
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}")
|
|
1213
1270
|
|
|
1214
1271
|
r = sub.add_parser("run", help="full pipeline → briefing + tailored probes")
|
|
1215
1272
|
r.add_argument("target")
|
|
@@ -1374,7 +1431,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1374
1431
|
|
|
1375
1432
|
fb_parser = sub.add_parser(
|
|
1376
1433
|
"feedback", help="record an offline verdict that a finding is wrong (metadata-only by default)")
|
|
1377
|
-
fb_parser.add_argument("--fingerprint",
|
|
1434
|
+
fb_parser.add_argument("--fingerprint", help="fingerprint of the finding, from the ledger "
|
|
1435
|
+
"(not used by --verdict false-negative)")
|
|
1378
1436
|
fb_parser.add_argument("--verdict", required=True, choices=list(_FEEDBACK_VERDICTS),
|
|
1379
1437
|
help="false-positive: not a real issue · severity-wrong: real but misrated")
|
|
1380
1438
|
fb_parser.add_argument("--reason", required=True, help="why the detector is wrong (max 1000 chars)")
|
|
@@ -1384,10 +1442,23 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1384
1442
|
fb_parser.add_argument("--include-snippet", action="store_true",
|
|
1385
1443
|
help="also include title, route, file and evidence; prompts before writing")
|
|
1386
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")
|
|
1387
1449
|
fb_parser.add_argument("--out", help="output directory (default: websec-out)")
|
|
1388
1450
|
fb_parser.add_argument("--format", choices=["text", "json"], default="text")
|
|
1389
1451
|
fb_parser.set_defaults(func=cmd_feedback)
|
|
1390
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
|
+
|
|
1391
1462
|
intelligence = sub.add_parser("intel", help="explicit public threat-feed refresh and offline known-CVE reassessment")
|
|
1392
1463
|
intel_actions = intelligence.add_subparsers(dest="action", required=True)
|
|
1393
1464
|
for action in ("refresh", "status", "reassess"):
|
|
@@ -1438,7 +1509,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1438
1509
|
return p
|
|
1439
1510
|
|
|
1440
1511
|
|
|
1441
|
-
_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"}
|
|
1442
1513
|
|
|
1443
1514
|
|
|
1444
1515
|
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)
|
|
@@ -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
|
|
110
|
-
raise FeedbackError(f"--verdict must be one of {', '.join(
|
|
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
|
-
|
|
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"
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""Where the running engine came from — local metadata only, no network.
|
|
2
|
+
|
|
3
|
+
A version string does not identify the engine. A stale wheel installed from /tmp, an
|
|
4
|
+
editable checkout with uncommitted edits, and a clean index install all report the same
|
|
5
|
+
`__version__`, so a review can cite a version that never matched the code that produced
|
|
6
|
+
it. This module answers the other half: *how* this copy was installed.
|
|
7
|
+
|
|
8
|
+
It reads PEP 610 `direct_url.json`, which packaging tools write when — and only when — a
|
|
9
|
+
distribution was installed from somewhere other than an index. Its absence is therefore
|
|
10
|
+
the positive signal for an index install, and nothing here reaches the network, so it
|
|
11
|
+
works in the offline core pass.
|
|
12
|
+
|
|
13
|
+
Concrete case this exists for: a pipx install pinned to
|
|
14
|
+
`file:///tmp/websec_validator-0.14.0-py3-none-any.whl` stayed two releases behind while
|
|
15
|
+
`pipx upgrade` reported "already at latest", because upgrade re-resolved the same file.
|
|
16
|
+
Nothing in the tool's own output disclosed that the engine was not from PyPI.
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import json
|
|
21
|
+
import sys
|
|
22
|
+
from importlib import metadata
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
DIST = "websec-validator"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _direct_url(dist) -> dict | None:
|
|
29
|
+
try:
|
|
30
|
+
raw = dist.read_text("direct_url.json")
|
|
31
|
+
except Exception:
|
|
32
|
+
return None
|
|
33
|
+
if not raw:
|
|
34
|
+
return None
|
|
35
|
+
try:
|
|
36
|
+
parsed = json.loads(raw)
|
|
37
|
+
except ValueError:
|
|
38
|
+
return None
|
|
39
|
+
return parsed if isinstance(parsed, dict) else None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def describe(dist_name: str = DIST) -> dict:
|
|
43
|
+
"""Classify this installation. Never raises: diagnostics must not break `doctor`."""
|
|
44
|
+
result: dict = {"version": None, "source": "unknown", "detail": "",
|
|
45
|
+
"location": "", "trusted_index": None, "imported_from": ""}
|
|
46
|
+
try:
|
|
47
|
+
dist = metadata.distribution(dist_name)
|
|
48
|
+
except Exception:
|
|
49
|
+
result["detail"] = f"no installed metadata for {dist_name}; running from a source tree?"
|
|
50
|
+
try:
|
|
51
|
+
import websec_validator
|
|
52
|
+
result["location"] = str(Path(websec_validator.__file__).resolve().parent)
|
|
53
|
+
except Exception:
|
|
54
|
+
pass
|
|
55
|
+
result["source"] = "no-metadata"
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
result["version"] = dist.version
|
|
59
|
+
try:
|
|
60
|
+
result["location"] = str(Path(str(dist.locate_file(""))).resolve())
|
|
61
|
+
except Exception:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
# Which code is actually imported, versus which distribution the metadata describes.
|
|
65
|
+
# These diverge whenever a source tree is ahead of the installed copy on sys.path, and
|
|
66
|
+
# that is precisely when a cited version is wrong.
|
|
67
|
+
try:
|
|
68
|
+
import websec_validator
|
|
69
|
+
result["imported_from"] = str(Path(websec_validator.__file__).resolve().parent)
|
|
70
|
+
except Exception:
|
|
71
|
+
result["imported_from"] = ""
|
|
72
|
+
|
|
73
|
+
# An .egg-info beside a source tree is not an index install; setuptools writes it for a
|
|
74
|
+
# local build. It has no direct_url.json, so the PEP 610 test alone would call it "index"
|
|
75
|
+
# and stamp it trusted — a false clean signal, which is worse than none.
|
|
76
|
+
meta_dir = ""
|
|
77
|
+
try:
|
|
78
|
+
meta_dir = Path(str(getattr(dist, "_path", "") or "")).name
|
|
79
|
+
except Exception:
|
|
80
|
+
meta_dir = ""
|
|
81
|
+
if meta_dir.endswith(".egg-info") or meta_dir.endswith(".egg-link"):
|
|
82
|
+
result["source"] = "source-tree"
|
|
83
|
+
result["detail"] = (f"{meta_dir} beside a source tree — this is a local build, not an "
|
|
84
|
+
"index install, and its version tracks whatever the tree contains")
|
|
85
|
+
result["trusted_index"] = False
|
|
86
|
+
return result
|
|
87
|
+
|
|
88
|
+
info = _direct_url(dist)
|
|
89
|
+
if info is None:
|
|
90
|
+
# PEP 610: absent means the installer resolved it from an index.
|
|
91
|
+
result["source"] = "index"
|
|
92
|
+
result["detail"] = "resolved from a package index (upgrades normally)"
|
|
93
|
+
result["trusted_index"] = True
|
|
94
|
+
return result
|
|
95
|
+
|
|
96
|
+
url = str(info.get("url", ""))
|
|
97
|
+
dir_info = info.get("dir_info") or {}
|
|
98
|
+
result["trusted_index"] = False
|
|
99
|
+
if isinstance(dir_info, dict) and dir_info.get("editable"):
|
|
100
|
+
result["source"] = "editable"
|
|
101
|
+
result["detail"] = (f"editable install of {url} — the version string does not "
|
|
102
|
+
"identify the working-tree contents")
|
|
103
|
+
elif info.get("vcs_info"):
|
|
104
|
+
vcs = info["vcs_info"]
|
|
105
|
+
result["source"] = "vcs"
|
|
106
|
+
result["detail"] = f"{vcs.get('vcs', 'vcs')} checkout of {url}@{vcs.get('commit_id', '?')[:12]}"
|
|
107
|
+
elif url.startswith("file://"):
|
|
108
|
+
result["source"] = "local-file"
|
|
109
|
+
result["detail"] = (f"installed from {url} — `pipx upgrade` / `pip install -U` re-resolve "
|
|
110
|
+
"that path, not the index, so this copy can silently stay behind")
|
|
111
|
+
else:
|
|
112
|
+
result["source"] = "direct-url"
|
|
113
|
+
result["detail"] = f"installed directly from {url}, bypassing the index"
|
|
114
|
+
return result
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def lines(dist_name: str = DIST) -> list[str]:
|
|
118
|
+
"""Human-readable provenance block for `doctor`."""
|
|
119
|
+
info = describe(dist_name)
|
|
120
|
+
label = {"index": "package index", "local-file": "LOCAL FILE", "editable": "EDITABLE",
|
|
121
|
+
"vcs": "VCS checkout", "direct-url": "DIRECT URL",
|
|
122
|
+
"no-metadata": "NO INSTALL METADATA"}.get(info["source"], info["source"])
|
|
123
|
+
out = [f" engine: {info['location'] or 'unknown location'}",
|
|
124
|
+
f" source: {label} — {info['detail']}",
|
|
125
|
+
f" python: {sys.executable}"]
|
|
126
|
+
imported = info.get("imported_from") or ""
|
|
127
|
+
location = info.get("location") or ""
|
|
128
|
+
if imported and location and not imported.startswith(location):
|
|
129
|
+
out.append(f" ⚠ importing {imported}, which is NOT inside the installed distribution "
|
|
130
|
+
f"at {location} — the reported version describes the install, not this code.")
|
|
131
|
+
if info["trusted_index"] is False or info["source"] == "no-metadata":
|
|
132
|
+
out.append(" ⚠ this engine did not come from an index; confirm it is the build you "
|
|
133
|
+
"intend before citing its version as evidence.")
|
|
134
|
+
return out
|