websec-validator 0.16.0__tar.gz → 0.17.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {websec_validator-0.16.0/src/websec_validator.egg-info → websec_validator-0.17.0}/PKG-INFO +50 -7
- {websec_validator-0.16.0 → websec_validator-0.17.0}/README.md +49 -6
- {websec_validator-0.16.0 → websec_validator-0.17.0}/pyproject.toml +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/cli.py +161 -38
- websec_validator-0.17.0/src/websec_validator/clusters.py +136 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/coverage.py +20 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/auth.py +68 -9
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/base.py +91 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/client_exposure.py +61 -2
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/findings.py +45 -3
- websec_validator-0.17.0/src/websec_validator/init_scope.py +172 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/install.py +16 -4
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/report.py +51 -4
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/scanners.py +494 -41
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/schemas/coverage.schema.json +15 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/schemas/ledger.schema.json +175 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0/src/websec_validator.egg-info}/PKG-INFO +50 -7
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator.egg-info/SOURCES.txt +3 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_action_contracts.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_adoption_contracts.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_coverage.py +6 -6
- websec_validator-0.17.0/tests/test_field_report_2026_09.py +519 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_gate_command.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_hardening.py +6 -3
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_hooks_contracts.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_install_contracts.py +2 -2
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_output_boundaries.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_sarif_workbench.py +4 -4
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_scanner_contracts.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_source_budget.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_sql_flow.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_stack_metadata.py +1 -1
- {websec_validator-0.16.0 → websec_validator-0.17.0}/LICENSE +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/setup.cfg +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/agenthook.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/attribution.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/briefing.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/calibration.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/calibration.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/demo.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/diffscope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/dynamic.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/explain.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/crypto_usage.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/dependencies.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/pii_exposure.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/upload_security.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/extractors/webext.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/feedback.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/gate.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/graph_enrich.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/hooks.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/mcp_server.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/probes.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/provenance.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/recon.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/research.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/demo/app.py.txt +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/_lib.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/forged-token.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/race-conditions.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_agent_hook.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_attest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_attribution.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_calibration_claimspec.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_constitution.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_crypto_comparisons.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_demo.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_diffscope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_django_routes.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_enrichment.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_explain.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_feedback.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_formats.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_gate_and_bypass_record.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_hooks.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_install.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_intel.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_inventory.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_mcp.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_openapi.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_profiles.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_provenance.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_public_precision.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_read_performance.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_recon.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_research.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_research_cli.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_testplan.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.16.0 → websec_validator-0.17.0}/tests/test_workbench_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: websec-validator
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.0
|
|
4
4
|
Summary: Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app.
|
|
5
5
|
Author: Ricardo Accioly
|
|
6
6
|
License: MIT
|
|
@@ -293,17 +293,60 @@ non-Claude agents. All stdlib, no new dependency.
|
|
|
293
293
|
finding lands **inline on the PR diff** and in the **Security tab**, ranked by a security-severity band,
|
|
294
294
|
with its CWE/ASVS/OWASP citation and remediation.
|
|
295
295
|
|
|
296
|
-
**Gate the build.** `--fail-on {critical,high,medium,low}`
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
**Gate the build.** `--fail-on {critical,high,medium,low}` fails CI on matching findings;
|
|
297
|
+
`--require-complete` gates execution without a severity threshold. Extractor failures, source read
|
|
298
|
+
loss/caps, invalid scanner reports, timeouts, and explicitly selected missing scanners remain visible
|
|
299
|
+
in `coverage.json`; partial artifacts are preserved. Optional missing unselected scanners are reported
|
|
300
|
+
as unavailable. `--scanners` requires `--scan`.
|
|
301
|
+
|
|
302
|
+
**Exit codes tell you WHICH kind of failure.** "You have a vulnerability" and "my toolchain is
|
|
303
|
+
broken" need opposite responses — one blocks the merge, the other pages whoever owns the runner
|
|
304
|
+
image — so they never share a code:
|
|
305
|
+
|
|
306
|
+
| Code | Meaning | What to do |
|
|
307
|
+
|------|---------|------------|
|
|
308
|
+
| `0` | the gate ran and nothing met the threshold | ship (it does not prove protection) |
|
|
309
|
+
| `1` | findings at or above `--fail-on` | a fact about the code — fix the findings |
|
|
310
|
+
| `2` | usage/configuration error, or `websec doctor` found an incompatible scanner | nothing was scanned; fix the invocation or the toolchain |
|
|
311
|
+
| `3` | requested checks did not complete | the gate result is **not** a pass; read `coverage.gaps` for which check did not run |
|
|
312
|
+
|
|
313
|
+
A run that is **both** gate-failing and incomplete exits `1` — the definite fact wins — and says so
|
|
314
|
+
on stderr, because the finding count in that case is a floor, not a total. `gate.failure_kind` in the
|
|
315
|
+
ledger records the exact combination (`findings` · `incomplete` · `findings+incomplete`), so nothing
|
|
316
|
+
is lost by the collapse.
|
|
317
|
+
|
|
318
|
+
> **Upgrading:** exit `2` previously meant *incomplete execution*. It now means *usage/configuration
|
|
319
|
+
> error*, and incomplete is `3`. A CI job that tested for `2` to detect an incomplete run should test
|
|
320
|
+
> for `3` (or read `coverage.execution_complete`, which is unchanged).
|
|
301
321
|
|
|
302
322
|
**Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
|
|
303
323
|
have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
|
|
304
|
-
--require-complete` exits
|
|
324
|
+
--require-complete` exits 3 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
|
|
305
325
|
install failed fails instead of reporting zero findings from a scan that never ran.
|
|
306
326
|
|
|
327
|
+
**Presence is not compatibility — `websec doctor` version-checks.** A scanner can be installed,
|
|
328
|
+
detected, selected, run, and still produce nothing because its CLI does not match the invocation
|
|
329
|
+
websec builds; that silence is indistinguishable from a clean result. `doctor` now reports each
|
|
330
|
+
scanner's version, marks one that is too old for our invocation, and exits `2` when any selected
|
|
331
|
+
scanner is incompatible — so a CI preflight can gate on the toolchain before it trusts a scan.
|
|
332
|
+
|
|
333
|
+
**Scope the noise at setup, not after the first report.** `websec init` walks the repo, finds the
|
|
334
|
+
directories that are not your product (`backend/capacity-test/`, `seed/`, `fixtures/`, `vendor/` …),
|
|
335
|
+
and writes a `.websec-ignore` where every entry carries the file count that justifies it. It prints
|
|
336
|
+
every proposal before writing, supports `--dry-run`, and refuses to overwrite an existing policy file
|
|
337
|
+
without `--force` — that file may hold reviewed `fingerprint:` acknowledgements.
|
|
338
|
+
|
|
339
|
+
**One issue, N sites.** Thirteen findings from one `jwtSecret` pattern and twenty-two blobs from one
|
|
340
|
+
deleted-file incident are six issues, not thirty-five. The ledger carries a `clusters[]` view (and
|
|
341
|
+
REPORT.md a §1a section) that groups findings by rule, and history-only secrets by the commit that
|
|
342
|
+
removed them. It is a **view, not a filter**: `total`, `--fail-on` counts, per-site fingerprints,
|
|
343
|
+
SARIF results and baselines are all untouched, so every site still gates on its own.
|
|
344
|
+
|
|
345
|
+
**Secrets say where they live.** Every gitleaks finding carries `in_tree`; a finding whose file is
|
|
346
|
+
gone from the working tree is labelled `in-tree: false` with the commit it was last seen in. Deleting
|
|
347
|
+
a file does not un-leak it — the blob stays fetchable — so the remediation is *rotate*, and the report
|
|
348
|
+
says that instead of leaving you to run `git log`.
|
|
349
|
+
|
|
307
350
|
Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
|
|
308
351
|
advances only after a completed execution has written its artifacts; a partial attempt retains its
|
|
309
352
|
own directory and leaves the previous completed scan selected. Completed execution describes the
|
|
@@ -264,17 +264,60 @@ non-Claude agents. All stdlib, no new dependency.
|
|
|
264
264
|
finding lands **inline on the PR diff** and in the **Security tab**, ranked by a security-severity band,
|
|
265
265
|
with its CWE/ASVS/OWASP citation and remediation.
|
|
266
266
|
|
|
267
|
-
**Gate the build.** `--fail-on {critical,high,medium,low}`
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
**Gate the build.** `--fail-on {critical,high,medium,low}` fails CI on matching findings;
|
|
268
|
+
`--require-complete` gates execution without a severity threshold. Extractor failures, source read
|
|
269
|
+
loss/caps, invalid scanner reports, timeouts, and explicitly selected missing scanners remain visible
|
|
270
|
+
in `coverage.json`; partial artifacts are preserved. Optional missing unselected scanners are reported
|
|
271
|
+
as unavailable. `--scanners` requires `--scan`.
|
|
272
|
+
|
|
273
|
+
**Exit codes tell you WHICH kind of failure.** "You have a vulnerability" and "my toolchain is
|
|
274
|
+
broken" need opposite responses — one blocks the merge, the other pages whoever owns the runner
|
|
275
|
+
image — so they never share a code:
|
|
276
|
+
|
|
277
|
+
| Code | Meaning | What to do |
|
|
278
|
+
|------|---------|------------|
|
|
279
|
+
| `0` | the gate ran and nothing met the threshold | ship (it does not prove protection) |
|
|
280
|
+
| `1` | findings at or above `--fail-on` | a fact about the code — fix the findings |
|
|
281
|
+
| `2` | usage/configuration error, or `websec doctor` found an incompatible scanner | nothing was scanned; fix the invocation or the toolchain |
|
|
282
|
+
| `3` | requested checks did not complete | the gate result is **not** a pass; read `coverage.gaps` for which check did not run |
|
|
283
|
+
|
|
284
|
+
A run that is **both** gate-failing and incomplete exits `1` — the definite fact wins — and says so
|
|
285
|
+
on stderr, because the finding count in that case is a floor, not a total. `gate.failure_kind` in the
|
|
286
|
+
ledger records the exact combination (`findings` · `incomplete` · `findings+incomplete`), so nothing
|
|
287
|
+
is lost by the collapse.
|
|
288
|
+
|
|
289
|
+
> **Upgrading:** exit `2` previously meant *incomplete execution*. It now means *usage/configuration
|
|
290
|
+
> error*, and incomplete is `3`. A CI job that tested for `2` to detect an incomplete run should test
|
|
291
|
+
> for `3` (or read `coverage.execution_complete`, which is unchanged).
|
|
272
292
|
|
|
273
293
|
**Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
|
|
274
294
|
have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
|
|
275
|
-
--require-complete` exits
|
|
295
|
+
--require-complete` exits 3 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
|
|
276
296
|
install failed fails instead of reporting zero findings from a scan that never ran.
|
|
277
297
|
|
|
298
|
+
**Presence is not compatibility — `websec doctor` version-checks.** A scanner can be installed,
|
|
299
|
+
detected, selected, run, and still produce nothing because its CLI does not match the invocation
|
|
300
|
+
websec builds; that silence is indistinguishable from a clean result. `doctor` now reports each
|
|
301
|
+
scanner's version, marks one that is too old for our invocation, and exits `2` when any selected
|
|
302
|
+
scanner is incompatible — so a CI preflight can gate on the toolchain before it trusts a scan.
|
|
303
|
+
|
|
304
|
+
**Scope the noise at setup, not after the first report.** `websec init` walks the repo, finds the
|
|
305
|
+
directories that are not your product (`backend/capacity-test/`, `seed/`, `fixtures/`, `vendor/` …),
|
|
306
|
+
and writes a `.websec-ignore` where every entry carries the file count that justifies it. It prints
|
|
307
|
+
every proposal before writing, supports `--dry-run`, and refuses to overwrite an existing policy file
|
|
308
|
+
without `--force` — that file may hold reviewed `fingerprint:` acknowledgements.
|
|
309
|
+
|
|
310
|
+
**One issue, N sites.** Thirteen findings from one `jwtSecret` pattern and twenty-two blobs from one
|
|
311
|
+
deleted-file incident are six issues, not thirty-five. The ledger carries a `clusters[]` view (and
|
|
312
|
+
REPORT.md a §1a section) that groups findings by rule, and history-only secrets by the commit that
|
|
313
|
+
removed them. It is a **view, not a filter**: `total`, `--fail-on` counts, per-site fingerprints,
|
|
314
|
+
SARIF results and baselines are all untouched, so every site still gates on its own.
|
|
315
|
+
|
|
316
|
+
**Secrets say where they live.** Every gitleaks finding carries `in_tree`; a finding whose file is
|
|
317
|
+
gone from the working tree is labelled `in-tree: false` with the commit it was last seen in. Deleting
|
|
318
|
+
a file does not un-leak it — the blob stays fetchable — so the remediation is *rotate*, and the report
|
|
319
|
+
says that instead of leaving you to run `git log`.
|
|
320
|
+
|
|
278
321
|
Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
|
|
279
322
|
advances only after a completed execution has written its artifacts; a partial attempt retains its
|
|
280
323
|
own directory and leaves the previous completed scan selected. Completed execution describes the
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "websec-validator"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.17.0"
|
|
8
8
|
description = "Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Commands:
|
|
4
4
|
websec run <repo> [--scan] [--out DIR] full pipeline → FACTS.json + AGENT-BRIEFING.md + probes/
|
|
5
5
|
websec recon <repo> [--out DIR] recon only → FACTS.json
|
|
6
|
+
websec init [<repo>] scaffold a .websec-ignore scoped to this repo
|
|
6
7
|
websec doctor [<repo>] show which scanners are present / missing
|
|
7
8
|
|
|
8
9
|
Code-in, artifacts-out. No LLM, no server, no running app. Point your AI coding
|
|
@@ -22,8 +23,31 @@ import uuid
|
|
|
22
23
|
import sys
|
|
23
24
|
from pathlib import Path
|
|
24
25
|
|
|
25
|
-
from . import (__version__, baseline, briefing, calibration, constitution, diffscope, dynamic,
|
|
26
|
-
findings, coverage, formats, fpfilter, inventory, probes, proof, recon, report,
|
|
26
|
+
from . import (__version__, baseline, briefing, calibration, clusters, constitution, diffscope, dynamic,
|
|
27
|
+
feedback, findings, coverage, formats, fpfilter, inventory, probes, proof, recon, report,
|
|
28
|
+
scanners)
|
|
29
|
+
|
|
30
|
+
# --- process exit contract (field report #1) --------------------------------------------------
|
|
31
|
+
# A CI caller has to be able to tell "this repo has a vulnerability" from "my toolchain is broken",
|
|
32
|
+
# because the two demand opposite responses: one blocks the merge, the other pages whoever owns the
|
|
33
|
+
# runner image. Exit 2 used to mean BOTH — plus argument errors and an MCP bind failure — and, worse,
|
|
34
|
+
# the incomplete check SHORT-CIRCUITED the gate, so a run with a real CRITICAL *and* a dead scanner
|
|
35
|
+
# exited 2 and the finding never reached the exit code at all.
|
|
36
|
+
#
|
|
37
|
+
# 0 clean — the gate ran and nothing met the threshold (or no gate was requested)
|
|
38
|
+
# 1 FINDINGS at or above --fail-on. A security fact about the code.
|
|
39
|
+
# 2 usage / configuration error, or `doctor` found an incompatible scanner. Nothing was scanned.
|
|
40
|
+
# 3 requested checks did NOT complete (--require-complete / --fail-on with an execution gap).
|
|
41
|
+
# An operational fact about the toolchain; the gate result is not a pass.
|
|
42
|
+
#
|
|
43
|
+
# When a run is BOTH incomplete and gate-failing it exits 1, and prints both lines: the finding is
|
|
44
|
+
# definite and actionable, while "incomplete" only tells you the picture may be worse still. The
|
|
45
|
+
# ledger's `gate.failure_kind` records the combination precisely for machine consumers, so nothing
|
|
46
|
+
# is lost by the collapse.
|
|
47
|
+
EXIT_OK = 0
|
|
48
|
+
EXIT_FINDINGS = 1
|
|
49
|
+
EXIT_USAGE = 2
|
|
50
|
+
EXIT_INCOMPLETE = 3
|
|
27
51
|
|
|
28
52
|
_FEEDBACK_VERDICTS = feedback.VERDICTS
|
|
29
53
|
_FEEDBACK_SEVERITIES = feedback.SEVERITIES
|
|
@@ -170,15 +194,68 @@ def cmd_doctor(args) -> int:
|
|
|
170
194
|
print(line)
|
|
171
195
|
print("\n available:")
|
|
172
196
|
for s in det["available"]:
|
|
173
|
-
|
|
197
|
+
# Presence is not compatibility. `doctor` printed a green ✓ for an osv-scanner whose CLI
|
|
198
|
+
# did not match our invocation, so the most productive scanner in the set was dead for
|
|
199
|
+
# every run and nothing said so (field report #2). Version is now part of the answer.
|
|
200
|
+
mark = "✗" if s.get("status") == "too_old" else ("?" if s.get("status") == "unknown" else "✓")
|
|
201
|
+
ver = f"v{s['version']}" if s.get("version") else "version unknown"
|
|
202
|
+
print(f" {mark} {s['name']:20} {s['category']:8} {ver}")
|
|
203
|
+
if s.get("note"):
|
|
204
|
+
print(f" ↳ {s['note']}")
|
|
174
205
|
if not det["available"]:
|
|
175
206
|
print(" (none on PATH)")
|
|
176
207
|
print("\n missing (optional — install for fuller coverage):")
|
|
177
208
|
for s in det["missing"]:
|
|
178
209
|
print(f" · {s['name']:20} {s['category']:8} {s.get('install','')}")
|
|
210
|
+
if det.get("incompatible"):
|
|
211
|
+
print("\n ⚠ INCOMPATIBLE — installed, but websec's invocation does not match this build.")
|
|
212
|
+
print(" These are SELECTED and RUN, and their failure looks exactly like a clean scan.")
|
|
213
|
+
for s in det["incompatible"]:
|
|
214
|
+
print(f" ✗ {s['name']} {s.get('version')} — {s.get('install','')}")
|
|
179
215
|
print("\n Docker:", "present" if _which("docker") else "not found "
|
|
180
216
|
"(used for reproducible scanner runs in a future release)")
|
|
181
|
-
|
|
217
|
+
# A stale/incompatible analyzer is an operational defect, not just an FYI: exit non-zero so a
|
|
218
|
+
# CI preflight `websec doctor .` can gate on it. 2 = the usage/config class (see EXIT_* in this
|
|
219
|
+
# module) — the toolchain is misconfigured, no scan was attempted and no finding was missed.
|
|
220
|
+
return EXIT_USAGE if det.get("incompatible") else 0
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def cmd_init(args) -> int:
|
|
224
|
+
"""Scaffold a `.websec-ignore` scoped to THIS repository (field report #8).
|
|
225
|
+
|
|
226
|
+
Setup-time scoping is the cheapest noise reduction there is: path-scoping a repo's fixture and
|
|
227
|
+
seed directories removes most of the noise before it ever reaches a report, and doing it after
|
|
228
|
+
the first run means reading a hundred findings to learn something the directory names already
|
|
229
|
+
said. Proposals are evidence-based and always printed before anything is written."""
|
|
230
|
+
from . import init_scope
|
|
231
|
+
target = _resolve_target(args.target)
|
|
232
|
+
proposal = init_scope.propose(target)
|
|
233
|
+
print(f"websec-validator v{__version__} — scope setup for {target}\n")
|
|
234
|
+
if proposal["entries"]:
|
|
235
|
+
print(" proposed scope exclusions (detected in this repo):")
|
|
236
|
+
for e in proposal["entries"]:
|
|
237
|
+
print(f" {e['path']:<44} {e['files']:>5} file(s) — {e['reason']}")
|
|
238
|
+
print(f"\n covers {proposal['covered_files']} of {proposal['analyzed_files']} analyzed file(s).")
|
|
239
|
+
else:
|
|
240
|
+
print(" no test/fixture/seed/vendor directories detected — nothing to scope out.")
|
|
241
|
+
# Never suppress silently: the operator sees the list before the file exists.
|
|
242
|
+
print("\n Suppression is SCOPE, not a verdict: a secret in a fixture is still committed.\n"
|
|
243
|
+
" For a known, accepted finding prefer a `fingerprint:` acknowledgement — it stays\n"
|
|
244
|
+
" visible in the report, carries a reason and expires.")
|
|
245
|
+
if getattr(args, "dry_run", False):
|
|
246
|
+
print("\n--- .websec-ignore (dry run, not written) ---")
|
|
247
|
+
print(init_scope.render(proposal))
|
|
248
|
+
return EXIT_OK
|
|
249
|
+
result = init_scope.write(target, proposal, force=getattr(args, "force", False))
|
|
250
|
+
if not result["written"]:
|
|
251
|
+
print(f"\n ✗ not written: {result['reason']}\n {result['path']}")
|
|
252
|
+
print(" An existing .websec-ignore is a policy document — it may hold reviewed "
|
|
253
|
+
"`fingerprint:`\n acknowledgements that regenerating would discard. Review it, "
|
|
254
|
+
"or re-run with --force.")
|
|
255
|
+
return EXIT_USAGE
|
|
256
|
+
print(f"\n ✓ wrote {result['path']} ({result['entries']} scope entr(ies))")
|
|
257
|
+
print(" Review it, delete what you disagree with, and commit it.")
|
|
258
|
+
return EXIT_OK
|
|
182
259
|
|
|
183
260
|
|
|
184
261
|
def cmd_recon(args) -> int:
|
|
@@ -248,22 +325,22 @@ def cmd_emit_context(args) -> int:
|
|
|
248
325
|
def cmd_run(args) -> int:
|
|
249
326
|
if len(getattr(args, "sarif", []) or []) > 8:
|
|
250
327
|
print("error: at most 8 explicit --sarif reports are supported per run", file=sys.stderr)
|
|
251
|
-
return
|
|
328
|
+
return EXIT_USAGE
|
|
252
329
|
if getattr(args, "scanners", None) and not args.scan:
|
|
253
330
|
print("error: --scanners requires --scan", file=sys.stderr)
|
|
254
|
-
return
|
|
331
|
+
return EXIT_USAGE
|
|
255
332
|
if getattr(args, "scanners", None) and not any(key.strip() for key in args.scanners.split(",")):
|
|
256
333
|
print("error: --scanners requires at least one scanner key", file=sys.stderr)
|
|
257
|
-
return
|
|
334
|
+
return EXIT_USAGE
|
|
258
335
|
if getattr(args, "verify_secrets", False) and not args.scan:
|
|
259
336
|
print("error: --verify-secrets requires --scan", file=sys.stderr)
|
|
260
|
-
return
|
|
337
|
+
return EXIT_USAGE
|
|
261
338
|
target = _resolve_target(args.target)
|
|
262
339
|
try:
|
|
263
340
|
out, ts = _new_run_dir(args.out)
|
|
264
341
|
except (OSError, ValueError) as error:
|
|
265
342
|
print(f"error: cannot reserve output run: {error}", file=sys.stderr)
|
|
266
|
-
return
|
|
343
|
+
return EXIT_USAGE
|
|
267
344
|
|
|
268
345
|
# In a machine-output mode (sarif/json) keep STDOUT pure for piping — route human progress to
|
|
269
346
|
# stderr. `websec run app --format sarif > results.sarif` then Just Works in a pipeline.
|
|
@@ -463,6 +540,12 @@ def cmd_run(args) -> int:
|
|
|
463
540
|
# every repair plan emitted before this change.
|
|
464
541
|
from . import attribution as _attribution
|
|
465
542
|
ledger["attribution"] = _attribution.build(target, actor=getattr(args, "actor", None))
|
|
543
|
+
# PRESENTATION-ONLY grouping: 39 findings that are really ~6 issues make a well-managed repo
|
|
544
|
+
# look alarming (field report #4). `clusters[]` is a SIBLING of findings[] — it never changes
|
|
545
|
+
# `total`, the gate count, per-site fingerprints, SARIF results or the baseline, all of which
|
|
546
|
+
# other things already depend on. See clusters.py for why collapsing findings[] was rejected.
|
|
547
|
+
ledger["clusters"] = clusters.build(ledger)
|
|
548
|
+
ledger["cluster_summary"] = clusters.summary(ledger["clusters"], ledger.get("total", 0))
|
|
466
549
|
# 4b. baseline / diff — only NEW findings gate CI when a baseline is supplied
|
|
467
550
|
diff = None
|
|
468
551
|
if getattr(args, "baseline", None):
|
|
@@ -509,15 +592,31 @@ def cmd_run(args) -> int:
|
|
|
509
592
|
"network_gate_note": ("registry-existence findings are reported but do not gate unless "
|
|
510
593
|
"--fail-on-network is given: the UNKNOWN rate is outside operator "
|
|
511
594
|
"control and a 404 is an observation, not a proof")}
|
|
512
|
-
|
|
513
|
-
|
|
595
|
+
# Count the findings FIRST, unconditionally. Previously `_incomplete` short-circuited this, so a
|
|
596
|
+
# run that was both incomplete and gate-failing reported exit 2 and dropped the security signal
|
|
597
|
+
# entirely — the caller could not tell it had a CRITICAL (field report #1).
|
|
598
|
+
_n = (baseline.gate_count(_gate_ledger, args.fail_on, new_only=bool(diff))
|
|
599
|
+
if getattr(args, "fail_on", None) else None)
|
|
600
|
+
_gate["incomplete"] = bool(_incomplete)
|
|
601
|
+
if _n:
|
|
602
|
+
_gate.update(count_at_or_above=_n, verdict="fail", exit_code=EXIT_FINDINGS,
|
|
603
|
+
failure_kind="findings+incomplete" if _incomplete else "findings",
|
|
604
|
+
note=("findings at or above the threshold AND requested checks did not "
|
|
605
|
+
"complete — the finding count is a floor, not a total"
|
|
606
|
+
if _incomplete else None))
|
|
607
|
+
elif _incomplete:
|
|
608
|
+
_gate.update(verdict="incomplete", exit_code=EXIT_INCOMPLETE, count_at_or_above=_n,
|
|
609
|
+
failure_kind="incomplete",
|
|
514
610
|
note="requested checks did not complete; the gate result is NOT a pass")
|
|
515
611
|
elif getattr(args, "fail_on", None):
|
|
516
|
-
_n =
|
|
517
|
-
_gate.update(count_at_or_above=_n, verdict="fail" if _n else "pass", exit_code=1 if _n else 0)
|
|
612
|
+
_gate.update(count_at_or_above=_n, verdict="pass", exit_code=EXIT_OK, failure_kind=None)
|
|
518
613
|
else:
|
|
519
|
-
_gate.update(verdict="not-evaluated", exit_code=
|
|
614
|
+
_gate.update(verdict="not-evaluated", exit_code=EXIT_OK, count_at_or_above=None,
|
|
615
|
+
failure_kind=None,
|
|
520
616
|
note="no --fail-on was requested; this run gated nothing")
|
|
617
|
+
_gate["exit_code_contract"] = {"0": "clean", "1": "findings at or above --fail-on",
|
|
618
|
+
"2": "usage/configuration error (nothing scanned)",
|
|
619
|
+
"3": "requested checks did not complete"}
|
|
521
620
|
# Enforcement is a server-side concern. Say so IN THE ARTIFACT, not only in the docs: a local
|
|
522
621
|
# gate can be skipped with --no-verify, an uninstalled hook, or a deleted one.
|
|
523
622
|
_gate["enforcement"] = ("advisory unless run as a required status check. A client-side gate is a "
|
|
@@ -534,6 +633,11 @@ def cmd_run(args) -> int:
|
|
|
534
633
|
if ledger["total"]:
|
|
535
634
|
log(f"\n ledger: {ledger['total']} finding(s) · {ledger['by_severity']} · confidence {ledger['by_confidence']}"
|
|
536
635
|
+ (f" · {ledger['suppressed']} suppressed" if ledger["suppressed"] else ""))
|
|
636
|
+
_cs = ledger.get("cluster_summary") or {}
|
|
637
|
+
if _cs.get("clusters"):
|
|
638
|
+
log(f" → {_cs['distinct_issues']} DISTINCT issue(s): {_cs['clusters']} cluster(s) cover "
|
|
639
|
+
f"{_cs['clustered_findings']} of those findings (largest: {_cs['largest']} sites). "
|
|
640
|
+
f"Each site still gates on its own.")
|
|
537
641
|
|
|
538
642
|
# 5. briefing + comprehensive REPORT.md (immutable run record) + machine artifacts
|
|
539
643
|
(out / "AGENT-BRIEFING.md").write_text(briefing.render(facts, det, scan_results, manifest, unified, ledger))
|
|
@@ -586,18 +690,26 @@ def cmd_run(args) -> int:
|
|
|
586
690
|
# block only reports it and returns the exit code, so the artifact and the exit code cannot
|
|
587
691
|
# disagree.
|
|
588
692
|
if _gate["verdict"] == "incomplete":
|
|
589
|
-
log("\n✗ requested security checks did not complete; partial artifacts saved
|
|
590
|
-
|
|
693
|
+
log(f"\n✗ requested security checks did not complete; partial artifacts saved "
|
|
694
|
+
f"(exit {EXIT_INCOMPLETE} — toolchain/coverage, NOT a finding).")
|
|
695
|
+
log(" Your build is not failing because of a vulnerability. See coverage.gaps in "
|
|
696
|
+
"coverage.json for which check did not run.")
|
|
697
|
+
return EXIT_INCOMPLETE
|
|
591
698
|
if _gate["verdict"] == "fail":
|
|
592
699
|
log(f"\n✗ --fail-on {args.fail_on}: {_gate['count_at_or_above']} finding(s) at or above threshold"
|
|
593
700
|
+ (" (new since baseline)" if diff else "")
|
|
594
701
|
+ (f" (in files changed vs {_gate['diff_base']})" if _gate["diff_scoped"] else "")
|
|
595
|
-
+ " — failing the build.")
|
|
596
|
-
|
|
702
|
+
+ f" — failing the build (exit {EXIT_FINDINGS}).")
|
|
703
|
+
if _gate.get("incomplete"):
|
|
704
|
+
# BOTH conditions hold. Exit 1 (the definite fact) but never let the incompleteness go
|
|
705
|
+
# unsaid: the count above is a floor, and something else may still be hiding.
|
|
706
|
+
log(" ⚠ ALSO incomplete: some requested checks did not run, so this count is a FLOOR, "
|
|
707
|
+
"not a total. See coverage.gaps.")
|
|
708
|
+
return EXIT_FINDINGS
|
|
597
709
|
if _gate["verdict"] == "pass":
|
|
598
710
|
log(f"\n✓ --fail-on {args.fail_on}: no findings at or above threshold"
|
|
599
711
|
+ (" (new since baseline)" if diff else "") + ".")
|
|
600
|
-
return
|
|
712
|
+
return EXIT_OK
|
|
601
713
|
|
|
602
714
|
|
|
603
715
|
def cmd_dynamic(args) -> int:
|
|
@@ -610,7 +722,7 @@ def cmd_dynamic(args) -> int:
|
|
|
610
722
|
out, ts = _new_run_dir(args.out)
|
|
611
723
|
except (OSError, ValueError) as error:
|
|
612
724
|
print(f"error: cannot reserve output run: {error}", file=sys.stderr)
|
|
613
|
-
return
|
|
725
|
+
return EXIT_USAGE
|
|
614
726
|
dyn: dict = {}
|
|
615
727
|
|
|
616
728
|
if args.unauth:
|
|
@@ -694,9 +806,10 @@ def cmd_dynamic(args) -> int:
|
|
|
694
806
|
_publish_run(out)
|
|
695
807
|
print(f" ✓ run {ts} saved (immutable): {out}")
|
|
696
808
|
if not (facts_dict.get("coverage") or {}).get("execution_complete"):
|
|
697
|
-
print(" Requested checks incomplete; latest completed scan unchanged
|
|
698
|
-
|
|
699
|
-
|
|
809
|
+
print(f" Requested checks incomplete; latest completed scan unchanged "
|
|
810
|
+
f"(exit {EXIT_INCOMPLETE} — toolchain/coverage, NOT a finding).")
|
|
811
|
+
return EXIT_INCOMPLETE
|
|
812
|
+
return EXIT_FINDINGS if ledger["by_severity"].get("CRITICAL") else EXIT_OK
|
|
700
813
|
|
|
701
814
|
|
|
702
815
|
def cmd_mcp(args) -> int:
|
|
@@ -706,7 +819,7 @@ def cmd_mcp(args) -> int:
|
|
|
706
819
|
return mcp_server.serve_http(args.host, args.port, allowed_roots=getattr(args, "allow_root", None))
|
|
707
820
|
except (ValueError, OSError) as error:
|
|
708
821
|
print(f"error: {error}", file=sys.stderr)
|
|
709
|
-
return
|
|
822
|
+
return EXIT_USAGE
|
|
710
823
|
return mcp_server.serve()
|
|
711
824
|
|
|
712
825
|
|
|
@@ -749,7 +862,7 @@ def cmd_repair_verify(args) -> int:
|
|
|
749
862
|
except FileExistsError:
|
|
750
863
|
print(json.dumps(result, indent=2))
|
|
751
864
|
print(f"\nrefusing to overwrite existing evidence at {args.out}", file=sys.stderr)
|
|
752
|
-
return
|
|
865
|
+
return EXIT_USAGE
|
|
753
866
|
return 0 if result.get("accepted") else 2
|
|
754
867
|
|
|
755
868
|
|
|
@@ -770,7 +883,7 @@ def cmd_gate(args) -> int:
|
|
|
770
883
|
target = Path(args.target).expanduser().resolve()
|
|
771
884
|
if not target.is_dir():
|
|
772
885
|
print(f"error: target is not a directory: {target}", file=sys.stderr)
|
|
773
|
-
return
|
|
886
|
+
return EXIT_USAGE
|
|
774
887
|
|
|
775
888
|
scope_source = "explicit"
|
|
776
889
|
paths = list(getattr(args, "only", None) or [])
|
|
@@ -778,11 +891,13 @@ def cmd_gate(args) -> int:
|
|
|
778
891
|
discovered = _gate.working_tree_paths(target)
|
|
779
892
|
paths, scope_source = discovered["paths"], discovered["source"]
|
|
780
893
|
if scope_source == "working-tree-unavailable":
|
|
781
|
-
# Not a pass: the gate could not determine what to analyse, so it never
|
|
782
|
-
#
|
|
894
|
+
# Not a pass: the gate could not determine what to analyse, so it never answered the
|
|
895
|
+
# question. This is the INCOMPLETE class (the check did not run), not the usage class
|
|
896
|
+
# (the invocation was fine) — so it is 3 under the split contract, where it used to
|
|
897
|
+
# share 2 with genuine argument errors.
|
|
783
898
|
print(f"error: {discovered.get('note', 'changed-file scope unavailable')}",
|
|
784
899
|
file=sys.stderr)
|
|
785
|
-
return
|
|
900
|
+
return EXIT_INCOMPLETE
|
|
786
901
|
if not paths:
|
|
787
902
|
# Nothing changed is a PASS, but say which question was answered.
|
|
788
903
|
print(_gate.to_json({"tool": "websec-validator", "command": "gate", "passed": True,
|
|
@@ -801,9 +916,9 @@ def cmd_gate(args) -> int:
|
|
|
801
916
|
print(_gate.to_json(result))
|
|
802
917
|
else:
|
|
803
918
|
print(_gate.render_text(result))
|
|
804
|
-
# 1 = blocking findings
|
|
805
|
-
# check from a BROKEN one and must never treat a crash as a pass.
|
|
806
|
-
return
|
|
919
|
+
# 1 = blocking findings; 2 = usage/target error; 3 = the gate could not determine its scope.
|
|
920
|
+
# A harness can tell a FAILED check from a BROKEN one and must never treat a crash as a pass.
|
|
921
|
+
return EXIT_OK if result["passed"] else EXIT_FINDINGS
|
|
807
922
|
|
|
808
923
|
|
|
809
924
|
def cmd_attest(args) -> int:
|
|
@@ -821,11 +936,11 @@ def cmd_attest(args) -> int:
|
|
|
821
936
|
if run_dir is None or not run_dir.is_dir():
|
|
822
937
|
print("error: no run directory found; pass --run <dir> or run `websec run` first",
|
|
823
938
|
file=sys.stderr)
|
|
824
|
-
return
|
|
939
|
+
return EXIT_USAGE
|
|
825
940
|
if not (run_dir / "findings-ledger.json").is_file():
|
|
826
941
|
print(f"error: {run_dir} does not look like a websec run (no findings-ledger.json)",
|
|
827
942
|
file=sys.stderr)
|
|
828
|
-
return
|
|
943
|
+
return EXIT_USAGE
|
|
829
944
|
|
|
830
945
|
bypasses = _hooks.read_bypasses(Path(getattr(args, "repo", None) or ".").expanduser())
|
|
831
946
|
result = _attest.build(run_dir, bypasses=bypasses)
|
|
@@ -864,7 +979,7 @@ def cmd_explain(args) -> int:
|
|
|
864
979
|
return 0
|
|
865
980
|
if not getattr(args, "term", None):
|
|
866
981
|
print("error: give an attack class or CWE id, or --list", file=sys.stderr)
|
|
867
|
-
return
|
|
982
|
+
return EXIT_USAGE
|
|
868
983
|
info = _explain.describe(args.term)
|
|
869
984
|
if getattr(args, "format", "text") == "json":
|
|
870
985
|
_emit_json_result(info)
|
|
@@ -883,7 +998,7 @@ def cmd_feedback(args) -> int:
|
|
|
883
998
|
# this on a findings ledger would require the artifact whose absence is the point.
|
|
884
999
|
if args.fingerprint:
|
|
885
1000
|
print("--fingerprint does not apply to --verdict false-negative", file=sys.stderr)
|
|
886
|
-
return
|
|
1001
|
+
return EXIT_USAGE
|
|
887
1002
|
try:
|
|
888
1003
|
record = fb.build_missed_record(
|
|
889
1004
|
attack_class=getattr(args, "attack_class", "") or "", reason=args.reason,
|
|
@@ -1293,7 +1408,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1293
1408
|
# metavar lists only the user-facing commands; recon/proof/calibrate still work but are
|
|
1294
1409
|
# omitted (they get no `help=`, so argparse leaves them out of the listing entirely).
|
|
1295
1410
|
sub = p.add_subparsers(dest="cmd", required=True,
|
|
1296
|
-
metavar="{run,doctor,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
|
|
1411
|
+
metavar="{run,init,doctor,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
|
|
1297
1412
|
|
|
1298
1413
|
r = sub.add_parser("run", help="full pipeline → briefing + tailored probes")
|
|
1299
1414
|
r.add_argument("target")
|
|
@@ -1369,6 +1484,14 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1369
1484
|
rc.add_argument("--out", help="output dir (default: ./websec-out)")
|
|
1370
1485
|
rc.set_defaults(func=cmd_recon)
|
|
1371
1486
|
|
|
1487
|
+
i = sub.add_parser("init", help="scaffold a .websec-ignore scoped to this repo")
|
|
1488
|
+
i.add_argument("target", nargs="?", default=".")
|
|
1489
|
+
i.add_argument("--dry-run", action="store_true", dest="dry_run",
|
|
1490
|
+
help="print the proposed .websec-ignore without writing it")
|
|
1491
|
+
i.add_argument("--force", action="store_true",
|
|
1492
|
+
help="replace an existing .websec-ignore (it may hold reviewed acknowledgements)")
|
|
1493
|
+
i.set_defaults(func=cmd_init)
|
|
1494
|
+
|
|
1372
1495
|
d = sub.add_parser("doctor", help="show which scanners are installed")
|
|
1373
1496
|
d.add_argument("target", nargs="?", help="optional repo to scope scanner relevance")
|
|
1374
1497
|
d.set_defaults(func=cmd_doctor)
|
|
@@ -1542,7 +1665,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1542
1665
|
return p
|
|
1543
1666
|
|
|
1544
1667
|
|
|
1545
|
-
_COMMANDS = {"run", "recon", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo"}
|
|
1668
|
+
_COMMANDS = {"run", "recon", "init", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo"}
|
|
1546
1669
|
|
|
1547
1670
|
|
|
1548
1671
|
def main(argv=None) -> int:
|