websec-validator 0.19.1__tar.gz → 0.20.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.19.1/src/websec_validator.egg-info → websec_validator-0.20.0}/PKG-INFO +11 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/README.md +10 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/pyproject.toml +1 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/agenthook.py +2 -3
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/attribution.py +10 -16
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/briefing.py +9 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/cli.py +43 -8
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/coverage.py +1 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/diffscope.py +3 -3
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/dynamic.py +16 -7
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/crypto_usage.py +20 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/dependencies.py +36 -5
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/feedback.py +4 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/gate.py +26 -6
- websec_validator-0.20.0/src/websec_validator/git_read.py +30 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/hooks.py +22 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/init_scope.py +3 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/install.py +8 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/mcp_server.py +23 -4
- websec_validator-0.20.0/src/websec_validator/output.py +50 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/probes.py +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/recon.py +2 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/synthetic.py +38 -4
- websec_validator-0.20.0/src/websec_validator/templates/probes/_lib.bash +5 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/_lib.py +79 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/appsync-introspection.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/bola-cross-tenant.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/client-integrity-checklist.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/entitlement-abuse.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/error-disclosure-probe.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/forged-token.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/jwt-attacks.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/password-reuse.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/pii-output-diff.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/race-conditions.py +4 -3
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/rate-limit-burst.sh +2 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/s3-assess.sh +11 -6
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/ssrf-probes.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/unauth-baseline.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/upload-matrix.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/webhook-forgery.py +2 -2
- websec_validator-0.20.0/src/websec_validator/updates.py +185 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0/src/websec_validator.egg-info}/PKG-INFO +11 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator.egg-info/SOURCES.txt +7 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_crypto_comparisons.py +33 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_explained_brief.py +4 -2
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_formats.py +2 -1
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_gate_policy_and_scope.py +2 -2
- websec_validator-0.20.0/tests/test_probe_transport_boundaries.py +172 -0
- websec_validator-0.20.0/tests/test_security_fix_boundaries.py +294 -0
- websec_validator-0.20.0/tests/test_updates.py +330 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/LICENSE +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/setup.cfg +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/calibration.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/calibration.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/clusters.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/demo.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/explain.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/auth.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/base.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/client_exposure.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/pii_exposure.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/upload_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/webext.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/findings.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/graph_enrich.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/pairs.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/provenance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/report.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/scanners.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/schemas/coverage.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/schemas/ledger.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/demo/app.py.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_action_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_adoption_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_agent_hook.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_attest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_attribution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_calibration_claimspec.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_calibration_review.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_calibration_scoring.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_constitution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_coverage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_demo.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_detector_fp_followups.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_diffscope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_django_routes.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_dynamic_login_shape.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_enrichment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_explain.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_feedback.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_feedback_calibration_loop.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_field_report_2026_09.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_fp_sources.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_gate_and_bypass_record.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_gate_command.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_hardening.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_hooks.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_hooks_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_ignore_claimspec.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_install.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_install_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_intel.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_inventory.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_issue_147_sarif_locations.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_mcp.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_openapi.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_output_boundaries.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_pii_projection_fp.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_profiles.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_provenance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_public_precision.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_read_performance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_recon.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_research_cli.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_sarif_workbench.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_scanner_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_source_budget.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_sql_flow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_stack_metadata.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_synthetic_pairs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_testplan.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_triage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_unanalyzed_cli.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.0}/tests/test_unanalyzed_coverage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.20.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.20.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
|
|
@@ -541,7 +541,8 @@ not immutable snapshots of every pushed Git object. A missing runtime or concurr
|
|
|
541
541
|
blocks pre-push; post-commit remains advisory.
|
|
542
542
|
|
|
543
543
|
**MCP server (any agent, not just Claude Code).** `websec mcp` speaks the Model Context Protocol over
|
|
544
|
-
stdio, exposing typed tools — `websec_recon`, `websec_findings`, `websec_sarif`, `websec_briefing
|
|
544
|
+
stdio, exposing typed tools — `websec_recon`, `websec_findings`, `websec_sarif`, `websec_briefing`,
|
|
545
|
+
and advisory `websec_check_updates` — so
|
|
545
546
|
Cursor / Cline / Windsurf / Zed can call recon directly instead of shelling out and parsing stdout.
|
|
546
547
|
Register it in your MCP client:
|
|
547
548
|
|
|
@@ -562,6 +563,14 @@ workers, and an absolute receive deadline constrain the HTTP boundary. `GET /hea
|
|
|
562
563
|
minimal liveness endpoint. Non-loopback binding is refused. Stdio uses the launching process's trust
|
|
563
564
|
and filesystem permissions.
|
|
564
565
|
|
|
566
|
+
**Update checks are optional, upgrades are separate.** At the start of a security review, the AI
|
|
567
|
+
asks whether you want to check for a newer WebSec release. `websec update-check` reads only dated
|
|
568
|
+
cached metadata; after approval, `websec update-check --online` checks PyPI without downloading or
|
|
569
|
+
installing packages. MCP uses `websec_check_updates` with `online: true` only after that approval.
|
|
570
|
+
A newer-release notice offers an upgrade for separate approval. Declining or an unavailable check
|
|
571
|
+
does not block the review or change its findings/gate result. The tiny per-user cache contains only
|
|
572
|
+
version/check-time metadata; `WEBSEC_UPDATE_HOME` optionally selects its absolute directory.
|
|
573
|
+
|
|
565
574
|
**Blast-radius from a knowledge graph (opt-in, zero-dep).** If your repo has a
|
|
566
575
|
[`graphify`](https://github.com/Graphify-Labs/graphify) graph at `graphify-out/graph.json` (or you
|
|
567
576
|
pass `--graph <file>`), websec tags each finding with how much of the app **transitively depends on**
|
|
@@ -512,7 +512,8 @@ not immutable snapshots of every pushed Git object. A missing runtime or concurr
|
|
|
512
512
|
blocks pre-push; post-commit remains advisory.
|
|
513
513
|
|
|
514
514
|
**MCP server (any agent, not just Claude Code).** `websec mcp` speaks the Model Context Protocol over
|
|
515
|
-
stdio, exposing typed tools — `websec_recon`, `websec_findings`, `websec_sarif`, `websec_briefing
|
|
515
|
+
stdio, exposing typed tools — `websec_recon`, `websec_findings`, `websec_sarif`, `websec_briefing`,
|
|
516
|
+
and advisory `websec_check_updates` — so
|
|
516
517
|
Cursor / Cline / Windsurf / Zed can call recon directly instead of shelling out and parsing stdout.
|
|
517
518
|
Register it in your MCP client:
|
|
518
519
|
|
|
@@ -533,6 +534,14 @@ workers, and an absolute receive deadline constrain the HTTP boundary. `GET /hea
|
|
|
533
534
|
minimal liveness endpoint. Non-loopback binding is refused. Stdio uses the launching process's trust
|
|
534
535
|
and filesystem permissions.
|
|
535
536
|
|
|
537
|
+
**Update checks are optional, upgrades are separate.** At the start of a security review, the AI
|
|
538
|
+
asks whether you want to check for a newer WebSec release. `websec update-check` reads only dated
|
|
539
|
+
cached metadata; after approval, `websec update-check --online` checks PyPI without downloading or
|
|
540
|
+
installing packages. MCP uses `websec_check_updates` with `online: true` only after that approval.
|
|
541
|
+
A newer-release notice offers an upgrade for separate approval. Declining or an unavailable check
|
|
542
|
+
does not block the review or change its findings/gate result. The tiny per-user cache contains only
|
|
543
|
+
version/check-time metadata; `WEBSEC_UPDATE_HOME` optionally selects its absolute directory.
|
|
544
|
+
|
|
536
545
|
**Blast-radius from a knowledge graph (opt-in, zero-dep).** If your repo has a
|
|
537
546
|
[`graphify`](https://github.com/Graphify-Labs/graphify) graph at `graphify-out/graph.json` (or you
|
|
538
547
|
pass `--graph <file>`), websec tags each finding with how much of the app **transitively depends on**
|
|
@@ -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.20.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"
|
|
@@ -77,9 +77,8 @@ def edited_paths(event: dict) -> list[str]:
|
|
|
77
77
|
|
|
78
78
|
def _repo_root(start: Path) -> Path | None:
|
|
79
79
|
try:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
timeout=GIT_TIMEOUT_SECONDS)
|
|
80
|
+
from .git_read import run
|
|
81
|
+
proc = run(start, "rev-parse", "--show-toplevel", timeout=GIT_TIMEOUT_SECONDS)
|
|
83
82
|
except Exception:
|
|
84
83
|
return None
|
|
85
84
|
if proc.returncode != 0:
|
|
@@ -10,8 +10,8 @@ This module adds that, and grades it honestly. The grading is the point:
|
|
|
10
10
|
|
|
11
11
|
tier 1 ci-minted CI runner env / OIDC claims. Not settable from inside the job and
|
|
12
12
|
corroborable against the forge's own audit log. REAL evidence.
|
|
13
|
-
tier 2 vcs-observed `git rev-parse HEAD`, signature
|
|
14
|
-
|
|
13
|
+
tier 2 vcs-observed `git rev-parse HEAD`, signature presence. The SHA binds content;
|
|
14
|
+
signature verification is a separate trusted step. MEDIUM.
|
|
15
15
|
tier 3 self-asserted --actor, $WEBSEC_ACTOR, git config user.email, $USER, git trailers.
|
|
16
16
|
`git config user.email "cfo@corp.com"` takes one second. ZERO.
|
|
17
17
|
|
|
@@ -81,8 +81,8 @@ def _clean(value, limit: int = 256) -> str:
|
|
|
81
81
|
def _git(target, *args: str):
|
|
82
82
|
"""Bounded, argument-array git. Returns stdout or None; never raises."""
|
|
83
83
|
try:
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
from .git_read import run
|
|
85
|
+
proc = run(target, *args, timeout=_TIMEOUT)
|
|
86
86
|
except Exception:
|
|
87
87
|
return None
|
|
88
88
|
if proc.returncode != 0:
|
|
@@ -115,18 +115,12 @@ def _vcs(target) -> dict:
|
|
|
115
115
|
if value:
|
|
116
116
|
out[key] = value
|
|
117
117
|
|
|
118
|
-
#
|
|
119
|
-
# the
|
|
120
|
-
raw = _git(target, "
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
blob = raw + (_git(target, "log", "-1", "--format=%G?") or "")
|
|
125
|
-
out["signature"] = "good" if "GOODSIG" in blob else ("bad" if "BADSIG" in blob else "unchecked")
|
|
126
|
-
fpr = re.search(r"VALIDSIG\s+([0-9A-Fa-f]{16,64})", raw)
|
|
127
|
-
if fpr:
|
|
128
|
-
# The key fingerprint, deliberately NOT a claimed human name.
|
|
129
|
-
out["signer"] = fpr.group(1)
|
|
118
|
+
# Observe presence, not validity or signer identity. Signature programs/key stores selected
|
|
119
|
+
# by the checkout are untrusted, so recon only inspects commit headers.
|
|
120
|
+
raw = _git(target, "cat-file", "commit", "HEAD")
|
|
121
|
+
headers = (raw or "").split("\n\n", 1)[0]
|
|
122
|
+
out["signature"] = "none" if raw is not None and not re.search(r"(?m)^gpgsig(?:-sha256)? ", headers) else "unchecked"
|
|
123
|
+
out["signature_note"] = "signature verification requires a separately trusted verifier; not executed by recon"
|
|
130
124
|
return out
|
|
131
125
|
|
|
132
126
|
|
|
@@ -8,6 +8,12 @@ probe into a precise one.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
def _update_advisory(facts):
|
|
12
|
+
from . import updates
|
|
13
|
+
text = updates.advisory(updates.check(installed_version=facts.get("version", "")))
|
|
14
|
+
return "\n".join("> " + line for line in text.splitlines())
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
def _data(value):
|
|
12
18
|
"""Single-line quoted evidence; Markdown syntax stays inside a code span."""
|
|
13
19
|
from .fixprompt import _quoted
|
|
@@ -275,6 +281,9 @@ def render(facts: dict, scanners: dict, scan_results: list, probe_manifest: list
|
|
|
275
281
|
> **You are an AI coding agent.** The tool did the reliable half (mapping the surface + staging
|
|
276
282
|
> the probes). You + the human do the reasoning, the running, and the fixing.
|
|
277
283
|
|
|
284
|
+
> **Tool maintenance (advisory, separate from scan findings).**
|
|
285
|
+
{_update_advisory(facts)}
|
|
286
|
+
|
|
278
287
|
| Lane | Owns |
|
|
279
288
|
|---|---|
|
|
280
289
|
| 🔧 tool (done) | recon → {routes.get('count',0)} endpoints, scanner findings, staged probes |
|
|
@@ -110,6 +110,8 @@ def _maybe_nudge_websecignore(target: Path, ledger: dict, unified: dict | None,
|
|
|
110
110
|
|
|
111
111
|
def _default_out(target: Path, out: str | None) -> Path:
|
|
112
112
|
d = Path(out).expanduser().resolve() if out else Path.cwd() / "websec-out"
|
|
113
|
+
if not out and d.is_symlink():
|
|
114
|
+
raise OSError("implicit output directory must not be a symlink; select --out deliberately")
|
|
113
115
|
d.mkdir(parents=True, exist_ok=True)
|
|
114
116
|
return d
|
|
115
117
|
|
|
@@ -180,6 +182,13 @@ def _publish_run(run: Path) -> None:
|
|
|
180
182
|
temporary.unlink(missing_ok=True)
|
|
181
183
|
|
|
182
184
|
|
|
185
|
+
def cmd_update_check(args) -> int:
|
|
186
|
+
from . import updates
|
|
187
|
+
result = updates.check(online=args.online)
|
|
188
|
+
print(json.dumps(result, indent=2) if args.format == "json" else updates.advisory(result))
|
|
189
|
+
return 0 # Release advice never acts as a security or execution gate.
|
|
190
|
+
|
|
191
|
+
|
|
183
192
|
def cmd_doctor(args) -> int:
|
|
184
193
|
target = _resolve_target(args.target) if args.target else None
|
|
185
194
|
langs = recon.detect_stack(target)["languages"] if target else None
|
|
@@ -192,6 +201,8 @@ def cmd_doctor(args) -> int:
|
|
|
192
201
|
print()
|
|
193
202
|
for line in _prov.lines():
|
|
194
203
|
print(line)
|
|
204
|
+
from . import updates
|
|
205
|
+
print("\n" + updates.advisory())
|
|
195
206
|
print("\n available:")
|
|
196
207
|
for s in det["available"]:
|
|
197
208
|
# Presence is not compatibility. `doctor` printed a green ✓ for an osv-scanner whose CLI
|
|
@@ -273,7 +284,11 @@ def cmd_init(args) -> int:
|
|
|
273
284
|
print("\n--- .websec-ignore (dry run, not written) ---")
|
|
274
285
|
print(init_scope.render(proposal))
|
|
275
286
|
return EXIT_OK
|
|
276
|
-
|
|
287
|
+
try:
|
|
288
|
+
result = init_scope.write(target, proposal, force=getattr(args, "force", False))
|
|
289
|
+
except OSError as exc:
|
|
290
|
+
print(f"cannot write scope policy: {exc}", file=sys.stderr)
|
|
291
|
+
return EXIT_USAGE
|
|
277
292
|
if not result["written"]:
|
|
278
293
|
print(f"\n ✗ not written: {result['reason']}\n {result['path']}")
|
|
279
294
|
print(" An existing .websec-ignore is a policy document — it may hold reviewed "
|
|
@@ -287,9 +302,19 @@ def cmd_init(args) -> int:
|
|
|
287
302
|
|
|
288
303
|
def cmd_recon(args) -> int:
|
|
289
304
|
target = _resolve_target(args.target)
|
|
290
|
-
|
|
305
|
+
try:
|
|
306
|
+
out = _default_out(target, args.out)
|
|
307
|
+
from .output import checked_path
|
|
308
|
+
checked_path(out, "FACTS.json")
|
|
309
|
+
except OSError as exc:
|
|
310
|
+
print(f"cannot select recon output: {exc}", file=sys.stderr)
|
|
311
|
+
return EXIT_USAGE
|
|
291
312
|
facts = recon.build_facts(target, __version__)
|
|
292
|
-
|
|
313
|
+
try:
|
|
314
|
+
recon.write_facts(facts, out / "FACTS.json")
|
|
315
|
+
except OSError as exc:
|
|
316
|
+
print(f"cannot write recon output: {exc}", file=sys.stderr)
|
|
317
|
+
return EXIT_USAGE
|
|
293
318
|
print(f"✓ FACTS.json → {out / 'FACTS.json'}")
|
|
294
319
|
_print_facts_summary(facts)
|
|
295
320
|
return 0
|
|
@@ -939,10 +964,12 @@ def cmd_gate(args) -> int:
|
|
|
939
964
|
return EXIT_USAGE
|
|
940
965
|
|
|
941
966
|
scope_source = "explicit"
|
|
967
|
+
scope_truncated = False
|
|
942
968
|
paths = list(getattr(args, "only", None) or [])
|
|
943
969
|
if not paths:
|
|
944
970
|
discovered = _gate.working_tree_paths(target)
|
|
945
971
|
paths, scope_source = discovered["paths"], discovered["source"]
|
|
972
|
+
scope_truncated = discovered.get("truncated", False)
|
|
946
973
|
if scope_source == "working-tree-unavailable":
|
|
947
974
|
# Not a pass: the gate could not determine what to analyse, so it never answered the
|
|
948
975
|
# question. This is the INCOMPLETE class (the check did not run), not the usage class
|
|
@@ -963,7 +990,7 @@ def cmd_gate(args) -> int:
|
|
|
963
990
|
result = _gate.evaluate(target, paths, args.fail_on, version=__version__,
|
|
964
991
|
scope_source=scope_source,
|
|
965
992
|
min_confidence=getattr(args, "min_confidence", "low"),
|
|
966
|
-
excludes=getattr(args, "exclude", None))
|
|
993
|
+
excludes=getattr(args, "exclude", None), scope_truncated=scope_truncated)
|
|
967
994
|
|
|
968
995
|
# --fail-on-missed is applied HERE, not inside verdict(): `verdict` answers "are there blocking
|
|
969
996
|
# findings in what was analysed", and a path that was never analysed produced no finding to
|
|
@@ -973,6 +1000,8 @@ def cmd_gate(args) -> int:
|
|
|
973
1000
|
print(_gate.to_json(result))
|
|
974
1001
|
else:
|
|
975
1002
|
print(_gate.render_text(result))
|
|
1003
|
+
if result.get("execution_complete") is False and not result.get("blocking_count"):
|
|
1004
|
+
return EXIT_INCOMPLETE
|
|
976
1005
|
if result["passed"] and result.get("missed") and getattr(args, "fail_on_missed", False):
|
|
977
1006
|
print(f"websec gate: --fail-on-missed — {len(result['missed'])} requested path(s) were never "
|
|
978
1007
|
"analyzed; refusing to report this as a pass.", file=sys.stderr)
|
|
@@ -1068,7 +1097,7 @@ def cmd_feedback(args) -> int:
|
|
|
1068
1097
|
record = fb.build_missed_record(
|
|
1069
1098
|
attack_class=getattr(args, "attack_class", "") or "", reason=args.reason,
|
|
1070
1099
|
file_extension=getattr(args, "file_extension", "") or "")
|
|
1071
|
-
destination = Path(args.out
|
|
1100
|
+
destination = _default_out(Path.cwd(), args.out) / fb.FEEDBACK_FILENAME
|
|
1072
1101
|
fb.append(destination, record)
|
|
1073
1102
|
except (fb.FeedbackError, OSError) as exc:
|
|
1074
1103
|
print(str(exc), file=sys.stderr)
|
|
@@ -1142,8 +1171,8 @@ def cmd_feedback(args) -> int:
|
|
|
1142
1171
|
record, detector_revision=_cov.get("detector_revision", ""),
|
|
1143
1172
|
analyzed_input_digest=_cov.get("analyzed_input_digest", ""))
|
|
1144
1173
|
|
|
1145
|
-
destination = Path(args.out or "websec-out").resolve() / fb.FEEDBACK_FILENAME
|
|
1146
1174
|
try:
|
|
1175
|
+
destination = _default_out(Path.cwd(), args.out) / fb.FEEDBACK_FILENAME
|
|
1147
1176
|
fb.append(destination, record)
|
|
1148
1177
|
except (fb.FeedbackError, OSError) as exc:
|
|
1149
1178
|
print(f"cannot record feedback: {exc}", file=sys.stderr)
|
|
@@ -1588,7 +1617,13 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1588
1617
|
# metavar lists only the user-facing commands; recon/proof/calibrate still work but are
|
|
1589
1618
|
# omitted (they get no `help=`, so argparse leaves them out of the listing entirely).
|
|
1590
1619
|
sub = p.add_subparsers(dest="cmd", required=True,
|
|
1591
|
-
metavar="{run,init,doctor,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
|
|
1620
|
+
metavar="{run,init,doctor,update-check,dynamic,mcp,capabilities,demo,explain,feedback,intel,research,repair-verify,install,hooks}")
|
|
1621
|
+
|
|
1622
|
+
uc = sub.add_parser("update-check", help="advisory release metadata; offline unless --online")
|
|
1623
|
+
uc.add_argument("--online", action="store_true",
|
|
1624
|
+
help="explicitly check PyPI metadata (no installation); ask the human first")
|
|
1625
|
+
uc.add_argument("--format", choices=["text", "json"], default="text")
|
|
1626
|
+
uc.set_defaults(func=cmd_update_check)
|
|
1592
1627
|
|
|
1593
1628
|
r = sub.add_parser("run", help="full pipeline → briefing + tailored probes")
|
|
1594
1629
|
r.add_argument("target")
|
|
@@ -1877,7 +1912,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1877
1912
|
return p
|
|
1878
1913
|
|
|
1879
1914
|
|
|
1880
|
-
_COMMANDS = {"run", "recon", "init", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo"}
|
|
1915
|
+
_COMMANDS = {"run", "recon", "init", "doctor", "emit-context", "proof", "dynamic", "calibrate", "mcp", "install", "hooks", "repair-verify", "capabilities", "intel", "research", "feedback", "gate", "attest", "explain", "demo", "update-check"}
|
|
1881
1916
|
|
|
1882
1917
|
|
|
1883
1918
|
def main(argv=None) -> int:
|
|
@@ -15,7 +15,7 @@ def detector_revision() -> str:
|
|
|
15
15
|
dirs[:] = sorted(d for d in dirs if d.casefold() != ".local" and d != "__pycache__")
|
|
16
16
|
for name in sorted(files):
|
|
17
17
|
path = Path(directory) / name
|
|
18
|
-
if path.suffix in {".py", ".json", ".yaml", ".yml", ".md", ".sh", ".txt"} and not path.is_symlink():
|
|
18
|
+
if path.suffix in {".py", ".json", ".yaml", ".yml", ".md", ".sh", ".bash", ".txt"} and not path.is_symlink():
|
|
19
19
|
digest.update(path.relative_to(root).as_posix().encode() + b"\0")
|
|
20
20
|
digest.update(path.read_bytes())
|
|
21
21
|
return "sha256:" + digest.hexdigest()
|
|
@@ -29,8 +29,8 @@ _HUNK = re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@")
|
|
|
29
29
|
|
|
30
30
|
def _git(target: Path, *args: str, timeout: int = 60):
|
|
31
31
|
try:
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
from .git_read import run
|
|
33
|
+
p = run(target, *args, timeout=timeout)
|
|
34
34
|
return (p.stdout, None) if p.returncode == 0 else (None, (p.stderr or "").strip()[:200])
|
|
35
35
|
except FileNotFoundError:
|
|
36
36
|
return None, "git not found on PATH"
|
|
@@ -60,7 +60,7 @@ def compute(target: Path, ref: str) -> dict:
|
|
|
60
60
|
# files → "nothing changed" → the scoped --fail-on gate silently passes. Never let a developer's
|
|
61
61
|
# git config turn the CI gate off.
|
|
62
62
|
diff, err = _git(target, "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false",
|
|
63
|
-
"-c", "core.quotePath=false", "diff", "--no-ext-diff", "-U0", "--no-color",
|
|
63
|
+
"-c", "core.quotePath=false", "diff", "--no-ext-diff", "--no-textconv", "-U0", "--no-color",
|
|
64
64
|
f"{base}...HEAD")
|
|
65
65
|
if err is not None:
|
|
66
66
|
return {"base": base, "files": {}, "error": err}
|
|
@@ -50,7 +50,7 @@ class _NoRedirect(urllib.request.HTTPRedirectHandler):
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
# One shared opener so redirects are NOT followed anywhere in the dynamic phase.
|
|
53
|
-
_NO_REDIRECT_OPENER = urllib.request.build_opener(_NoRedirect)
|
|
53
|
+
_NO_REDIRECT_OPENER = urllib.request.build_opener(urllib.request.ProxyHandler({}), _NoRedirect)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def _read_body(resp, limit: int):
|
|
@@ -74,6 +74,8 @@ def _read_body(resp, limit: int):
|
|
|
74
74
|
|
|
75
75
|
def _request(method: str, url: str, token: str | None, timeout: int = 20,
|
|
76
76
|
data: bytes | None = None, cookie: str | None = None):
|
|
77
|
+
if method.upper() not in {"GET", "HEAD", "OPTIONS"} and not is_localhost(url):
|
|
78
|
+
raise ValueError("mutating probes require localhost; no request sent")
|
|
77
79
|
headers = {"Accept": "application/json"}
|
|
78
80
|
if token:
|
|
79
81
|
headers["Authorization"] = f"Bearer {token}"
|
|
@@ -93,12 +95,19 @@ def _request(method: str, url: str, token: str | None, timeout: int = 20,
|
|
|
93
95
|
# would NOT be caught by the sibling `except Exception` below and would kill the whole run.
|
|
94
96
|
return e.code, _read_body(e, 1000)
|
|
95
97
|
except Exception as e:
|
|
96
|
-
return None,
|
|
98
|
+
return None, type(e).__name__
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
def is_localhost(target: str) -> bool:
|
|
100
102
|
import urllib.parse
|
|
101
|
-
|
|
103
|
+
try:
|
|
104
|
+
parsed = urllib.parse.urlsplit(target)
|
|
105
|
+
parsed.port
|
|
106
|
+
return (parsed.scheme in {"http", "https"} and parsed.username is None and parsed.password is None
|
|
107
|
+
and "\\" not in target and not any(ord(c) < 33 for c in target)
|
|
108
|
+
and (parsed.hostname or "").lower() in {"localhost", "127.0.0.1", "::1", "0.0.0.0"})
|
|
109
|
+
except ValueError:
|
|
110
|
+
return False
|
|
102
111
|
|
|
103
112
|
|
|
104
113
|
def mint(cfg: dict, role: str) -> dict:
|
|
@@ -123,12 +132,12 @@ def mint(cfg: dict, role: str) -> dict:
|
|
|
123
132
|
d = json.load(resp)
|
|
124
133
|
except urllib.error.HTTPError as e:
|
|
125
134
|
if e.code in (301, 302, 303, 307, 308):
|
|
126
|
-
return {"error": f"login returned {e.code}
|
|
135
|
+
return {"error": f"login returned {e.code} instead of a JSON "
|
|
127
136
|
"token (cookie-session login?). Point --config login_path at the JSON "
|
|
128
|
-
"auth endpoint, or supply tokens directly."}
|
|
129
|
-
return {"error": f"HTTP {e.code} from the login endpoint"}
|
|
137
|
+
"auth endpoint, or supply tokens directly.", "error_kind": "login_redirect", "status": e.code}
|
|
138
|
+
return {"error": f"HTTP {e.code} from the login endpoint", "error_kind": "login_http", "status": e.code}
|
|
130
139
|
except Exception as e:
|
|
131
|
-
return {"error":
|
|
140
|
+
return {"error": "login failed", "error_kind": type(e).__name__}
|
|
132
141
|
token = _dig(d, cfg.get("token_json_path", "tokens.accessToken"))
|
|
133
142
|
user = _dig(d, cfg.get("user_json_path", "user")) or {}
|
|
134
143
|
# A login response need not echo the user object; fall back to the credential we sent so the
|
{websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/crypto_usage.py
RENAMED
|
@@ -107,9 +107,28 @@ _NON_CREDENTIAL_ARGUMENT = re.compile(
|
|
|
107
107
|
r"(?:^|\.)(?:id|email|userId|user_id|tenantId|tenant_id|password" + _PW_METADATA + r")$", re.I)
|
|
108
108
|
|
|
109
109
|
|
|
110
|
+
_METADATA_SUFFIXES = {"name", "type", "id", "method", "algorithm", "class", "url", "uri",
|
|
111
|
+
"path", "count", "salt", "format", "state", "required", "status", "date", "time"}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _metadata_operand(value: str) -> bool:
|
|
115
|
+
"""Name heuristic for a simple metadata value, never a compound secret expression."""
|
|
116
|
+
value = _unparenthesized(value)
|
|
117
|
+
if not re.fullmatch(r"[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*", value):
|
|
118
|
+
return False
|
|
119
|
+
leaf = value.rsplit(".", 1)[-1].strip()
|
|
120
|
+
if "." in value and leaf in {"length", "size", "byteLength", "type"}:
|
|
121
|
+
return True
|
|
122
|
+
# Require actual snake/camel token boundaries: `secretValid` is not `secret_id`.
|
|
123
|
+
normalized = re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", leaf)
|
|
124
|
+
parts = normalized.lower().split("_")
|
|
125
|
+
return (len(parts) > 1 and parts[-1] in _METADATA_SUFFIXES
|
|
126
|
+
and bool(_CREDENTIAL_NAME.search("_".join(parts[:-1]))))
|
|
127
|
+
|
|
128
|
+
|
|
110
129
|
def _credential_operand(value: str) -> bool:
|
|
111
130
|
# Literal words in arbitrary message strings aren't credential variables.
|
|
112
|
-
if
|
|
131
|
+
if _metadata_operand(value):
|
|
113
132
|
return False
|
|
114
133
|
bare = re.sub(_TIMING_LITERAL, "''", value)
|
|
115
134
|
if _CREDENTIAL_NAME.search(bare):
|
{websec_validator-0.19.1 → websec_validator-0.20.0}/src/websec_validator/extractors/dependencies.py
RENAMED
|
@@ -14,13 +14,15 @@ dependency-confusion-shaped names (the public-org allowlist is inherently incomp
|
|
|
14
14
|
signals that would actually confirm a hallucinated/typosquatted package (registry resolution, a shipped
|
|
15
15
|
known-hallucinated-name list, Levenshtein-to-top-N) are DEFERRED behind an opt-in `--network` step: this
|
|
16
16
|
extractor makes ZERO network calls in the default pass (`facts['dependencies']['network']['ran']` is
|
|
17
|
-
always False here). No new pip dependency; stdlib
|
|
17
|
+
always False here). No new pip dependency; stdlib only.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
|
+
import configparser
|
|
22
23
|
import json
|
|
23
24
|
import re
|
|
25
|
+
from urllib.parse import urlsplit
|
|
24
26
|
|
|
25
27
|
from .base import Extractor, RepoContext
|
|
26
28
|
|
|
@@ -115,14 +117,43 @@ def _npmrc_private_scopes(ctx: RepoContext) -> set:
|
|
|
115
117
|
|
|
116
118
|
|
|
117
119
|
def _pip_private_index(ctx: RepoContext) -> str:
|
|
118
|
-
"""
|
|
120
|
+
"""Any private or unknown pip index suppresses public package-name queries."""
|
|
119
121
|
for rel in ("pip.conf", ".pip/pip.conf", "pip.ini"):
|
|
120
122
|
text = ctx.text(ctx.root / rel)
|
|
121
123
|
if not text:
|
|
124
|
+
if any(rel in losses for losses in (ctx.unreadable, ctx.oversized, ctx.byte_budget_exceeded)):
|
|
125
|
+
return "private-or-unknown-index:unreadable"
|
|
122
126
|
continue
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
config = configparser.ConfigParser(interpolation=None)
|
|
128
|
+
try:
|
|
129
|
+
config.read_string(text)
|
|
130
|
+
except configparser.Error:
|
|
131
|
+
return "private-or-unknown-index:unknown"
|
|
132
|
+
entries = list(config.defaults().items())
|
|
133
|
+
for section in config.sections():
|
|
134
|
+
entries.extend(config.items(section, raw=True))
|
|
135
|
+
for name, configured in entries:
|
|
136
|
+
name = name.lower().replace("_", "-")
|
|
137
|
+
if name.startswith("--"):
|
|
138
|
+
name = name[2:]
|
|
139
|
+
if name not in {"index-url", "extra-index-url"}:
|
|
140
|
+
continue
|
|
141
|
+
values = configured.split()
|
|
142
|
+
if not values or (name == "index-url" and len(values) != 1):
|
|
143
|
+
return "private-or-unknown-index:unknown"
|
|
144
|
+
for value in values:
|
|
145
|
+
try:
|
|
146
|
+
parsed = urlsplit(value)
|
|
147
|
+
host = (parsed.hostname or "").lower()
|
|
148
|
+
if (parsed.scheme == "https" and host == "pypi.org" and parsed.port in (None, 443)
|
|
149
|
+
and parsed.username is None and parsed.password is None
|
|
150
|
+
and not parsed.query and not parsed.fragment and parsed.path.rstrip("/") in ("", "/simple")):
|
|
151
|
+
continue
|
|
152
|
+
# Never retain userinfo, query, fragment, path, or a raw parsing-error fallback.
|
|
153
|
+
safe_host = host if re.fullmatch(r"[a-z0-9.-]{1,253}", host) else "unknown"
|
|
154
|
+
except ValueError:
|
|
155
|
+
safe_host = "unknown"
|
|
156
|
+
return "private-or-unknown-index:" + safe_host
|
|
126
157
|
return ""
|
|
127
158
|
|
|
128
159
|
|
|
@@ -178,6 +178,10 @@ def build_record(finding: dict, *, verdict: str, reason: str, envelope: dict | N
|
|
|
178
178
|
|
|
179
179
|
def append(path: Path, record: dict) -> Path:
|
|
180
180
|
"""Append one JSON line. Bounded so a scripted loop cannot grow the file forever."""
|
|
181
|
+
from .output import checked_path
|
|
182
|
+
path = checked_path(path.parent, path.name)
|
|
183
|
+
if path.exists() and path.stat().st_nlink != 1:
|
|
184
|
+
raise FeedbackError("feedback destination must not have hard-link aliases")
|
|
181
185
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
182
186
|
if path.exists():
|
|
183
187
|
with path.open("r", encoding="utf-8") as handle:
|
|
@@ -59,8 +59,8 @@ _CODE_SUFFIXES = {".py", ".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx", ".mts", "
|
|
|
59
59
|
|
|
60
60
|
def _git(repo: Path, *args: str):
|
|
61
61
|
try:
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
from .git_read import run
|
|
63
|
+
proc = run(repo, *args, timeout=_TIMEOUT)
|
|
64
64
|
except Exception:
|
|
65
65
|
return None
|
|
66
66
|
return proc.stdout if proc.returncode == 0 else None
|
|
@@ -112,7 +112,8 @@ CONF_ORDER = ["low", "medium", "high"]
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
def evaluate(root: Path, paths: list, threshold: str, *, version: str, scope_source: str,
|
|
115
|
-
min_confidence: str = "low", excludes: list | None = None
|
|
115
|
+
min_confidence: str = "low", excludes: list | None = None,
|
|
116
|
+
scope_truncated: bool = False) -> dict:
|
|
116
117
|
"""The one gate path, shared by `websec gate` and the PostToolUse hook.
|
|
117
118
|
|
|
118
119
|
Both used to build the ledger themselves with no ignore policy, and drifted from `run`
|
|
@@ -123,6 +124,9 @@ def evaluate(root: Path, paths: list, threshold: str, *, version: str, scope_sou
|
|
|
123
124
|
from .extractors.base import RepoContext
|
|
124
125
|
root = Path(root)
|
|
125
126
|
facts = recon.build_facts(root, version, excludes, only=paths)
|
|
127
|
+
if scope_truncated:
|
|
128
|
+
from .coverage import add_gap
|
|
129
|
+
add_gap(facts, "gate_scope_limit", "changed-file selection exceeded the gate limit")
|
|
126
130
|
# One non-walking context serves both reads: `load_*` would otherwise walk the whole tree
|
|
127
131
|
# twice more, tripling the cost of a check that runs on every edit.
|
|
128
132
|
policy = RepoContext(root, walk=False)
|
|
@@ -220,15 +224,24 @@ def verdict(ledger: dict, facts: dict, threshold: str, *, scope_source: str = "e
|
|
|
220
224
|
(outside if state == "outside-scope" else in_scope).append((f, state))
|
|
221
225
|
blocking = [(f, state) for f, state in in_scope if _blocks(f)]
|
|
222
226
|
acknowledged = ledger.get("acknowledged", []) or []
|
|
227
|
+
from .coverage import execution_errors
|
|
228
|
+
coverage = facts.get("coverage")
|
|
229
|
+
# Sparse verdict-only callers predate coverage; production evaluate always supplies it.
|
|
230
|
+
errors = execution_errors(coverage) if coverage is not None else []
|
|
231
|
+
matched = scope.get("matched", [])
|
|
232
|
+
analyzed = [p for p in matched if p in coverage.get("inputs", {})] if isinstance(coverage, dict) else matched
|
|
223
233
|
out = {
|
|
224
234
|
"tool": "websec-validator",
|
|
225
235
|
"command": "gate",
|
|
226
236
|
"threshold": threshold.lower(),
|
|
227
237
|
"min_confidence": min_confidence.lower(),
|
|
228
|
-
"passed": not blocking,
|
|
238
|
+
"passed": not blocking and not errors,
|
|
239
|
+
"execution_complete": not errors,
|
|
240
|
+
"execution_errors": errors,
|
|
229
241
|
"blocking_count": len(blocking),
|
|
230
242
|
"total_findings": ledger.get("total", len(ledger.get("findings", []) or [])),
|
|
231
|
-
"analyzed":
|
|
243
|
+
"analyzed": analyzed,
|
|
244
|
+
"matched": matched,
|
|
232
245
|
"missed": scope.get("missed", []),
|
|
233
246
|
"scope_source": scope_source,
|
|
234
247
|
"findings": [{"severity": f.get("severity"), "confidence": f.get("confidence"),
|
|
@@ -272,6 +285,13 @@ def verdict(ledger: dict, facts: dict, threshold: str, *, scope_source: str = "e
|
|
|
272
285
|
|
|
273
286
|
def render_text(result: dict) -> str:
|
|
274
287
|
"""What the agent harness feeds back to the model on a block — specific enough to act on."""
|
|
288
|
+
incomplete = ""
|
|
289
|
+
if result.get("execution_complete") is False:
|
|
290
|
+
incomplete = ("websec gate: INCOMPLETE — this edit was not fully security-checked.\n"
|
|
291
|
+
+ "\n".join(" " + e for e in result.get("execution_errors", []))
|
|
292
|
+
+ f"\n{result['blocking_count']} blocking finding(s) retained; resolve the execution gaps and re-run.")
|
|
293
|
+
if not result["blocking_count"]:
|
|
294
|
+
return incomplete
|
|
275
295
|
if result["passed"]:
|
|
276
296
|
n = len(result["analyzed"])
|
|
277
297
|
missed = len(result.get("missed") or [])
|
|
@@ -311,7 +331,7 @@ def render_text(result: dict) -> str:
|
|
|
311
331
|
lines.append(f" … and {result['blocking_count'] - 10} more")
|
|
312
332
|
lines += ["", "Fix these, then the check will re-run on the next edit.",
|
|
313
333
|
"This is a scoped check of the changed files, not a full review."]
|
|
314
|
-
return "\n".join(lines)
|
|
334
|
+
return (incomplete + "\n\n" if incomplete else "") + "\n".join(lines)
|
|
315
335
|
|
|
316
336
|
|
|
317
337
|
def to_json(result: dict) -> str:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Git metadata reads must not execute helpers selected by the inspected checkout."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def run(target, *args: str, timeout: int = 20):
|
|
9
|
+
env = {key: value for key, value in os.environ.items() if not key.startswith("GIT_")}
|
|
10
|
+
env.update(GIT_CONFIG_NOSYSTEM="1", GIT_CONFIG_GLOBAL=os.devnull, GIT_TERMINAL_PROMPT="0")
|
|
11
|
+
command = ["git", "-c", "core.fsmonitor=false", "-c", "core.hooksPath=" + os.devnull,
|
|
12
|
+
"-c", "core.pager=cat", "-c", "log.showSignature=false",
|
|
13
|
+
"-c", "gpg.program=" + os.devnull, "-c", "gpg.openpgp.program=" + os.devnull,
|
|
14
|
+
"-c", "gpg.x509.program=" + os.devnull, "-c", "gpg.ssh.program=" + os.devnull,
|
|
15
|
+
"-C", str(target)]
|
|
16
|
+
if "status" in args or "diff" in args:
|
|
17
|
+
# Status may rehash dirty files through clean/process filters from .gitattributes.
|
|
18
|
+
# Read names (not commands) via a non-executing config query, then override every driver.
|
|
19
|
+
filters = subprocess.run([*command, "config", "--null", "--name-only", "--get-regexp",
|
|
20
|
+
r"^filter\..*\.(clean|smudge|process|required)$"],
|
|
21
|
+
env=env, capture_output=True, text=True, timeout=timeout)
|
|
22
|
+
if filters.returncode not in (0, 1) or len(filters.stdout) > 1_000_000:
|
|
23
|
+
raise OSError("cannot isolate checkout filter configuration")
|
|
24
|
+
for key in filters.stdout.split("\0"):
|
|
25
|
+
if key:
|
|
26
|
+
if not key.startswith("filter.") or key.rsplit(".", 1)[-1] not in {"clean", "smudge", "process", "required"}:
|
|
27
|
+
raise OSError("invalid checkout filter configuration")
|
|
28
|
+
command.extend(("-c", key + ("=false" if key.endswith(".required") else "=")))
|
|
29
|
+
command.extend(args)
|
|
30
|
+
return subprocess.run(command, env=env, capture_output=True, text=True, timeout=timeout)
|