websec-validator 0.19.1__tar.gz → 0.19.2__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.19.2}/PKG-INFO +1 -1
- {websec_validator-0.19.1 → websec_validator-0.19.2}/pyproject.toml +1 -1
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/agenthook.py +2 -3
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/attribution.py +10 -16
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/cli.py +26 -6
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/coverage.py +1 -1
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/diffscope.py +3 -3
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/dynamic.py +16 -7
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/dependencies.py +36 -5
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/feedback.py +4 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/gate.py +26 -6
- websec_validator-0.19.2/src/websec_validator/git_read.py +30 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/hooks.py +22 -2
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/init_scope.py +3 -1
- websec_validator-0.19.2/src/websec_validator/output.py +50 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/probes.py +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/recon.py +2 -2
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/synthetic.py +38 -4
- websec_validator-0.19.2/src/websec_validator/templates/probes/_lib.bash +5 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/_lib.py +79 -2
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/appsync-introspection.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/bola-cross-tenant.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/client-integrity-checklist.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/entitlement-abuse.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/error-disclosure-probe.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/forged-token.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/jwt-attacks.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/password-reuse.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/pii-output-diff.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/race-conditions.py +4 -3
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/rate-limit-burst.sh +2 -1
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/s3-assess.sh +11 -6
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/ssrf-probes.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/unauth-baseline.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/upload-matrix.sh +1 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/webhook-forgery.py +2 -2
- {websec_validator-0.19.1 → websec_validator-0.19.2/src/websec_validator.egg-info}/PKG-INFO +1 -1
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator.egg-info/SOURCES.txt +5 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_gate_policy_and_scope.py +2 -2
- websec_validator-0.19.2/tests/test_probe_transport_boundaries.py +172 -0
- websec_validator-0.19.2/tests/test_security_fix_boundaries.py +294 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/LICENSE +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/README.md +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/setup.cfg +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/briefing.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/calibration.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/calibration.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/clusters.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/demo.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/explain.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/auth.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/base.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/client_exposure.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/crypto_usage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/pii_exposure.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/upload_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/extractors/webext.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/findings.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/graph_enrich.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/install.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/mcp_server.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/pairs.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/provenance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/report.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/scanners.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/schemas/coverage.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/schemas/ledger.schema.json +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/demo/app.py.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_action_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_adoption_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_agent_hook.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_attest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_attribution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_calibration_claimspec.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_calibration_review.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_calibration_scoring.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_constitution.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_coverage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_crypto_comparisons.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_demo.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_detector_fp_followups.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_diffscope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_django_routes.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_dynamic_login_shape.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_enrichment.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_explain.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_explained_brief.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_feedback.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_feedback_calibration_loop.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_field_report_2026_09.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_formats.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_fp_sources.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_gate_and_bypass_record.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_gate_command.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_hardening.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_hooks.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_hooks_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_ignore_claimspec.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_install.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_install_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_intel.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_inventory.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_issue_147_sarif_locations.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_mcp.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_openapi.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_output_boundaries.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_pii_projection_fp.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_profiles.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_provenance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_public_precision.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_read_performance.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_recon.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_research.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_research_cli.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_sarif_workbench.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_scanner_contracts.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_source_budget.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_sql_flow.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_stack_metadata.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_synthetic_pairs.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_testplan.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_triage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_unanalyzed_cli.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/tests/test_unanalyzed_coverage.py +0 -0
- {websec_validator-0.19.1 → websec_validator-0.19.2}/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.19.
|
|
3
|
+
Version: 0.19.2
|
|
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
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "websec-validator"
|
|
7
|
-
version = "0.19.
|
|
7
|
+
version = "0.19.2"
|
|
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
|
|
|
@@ -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
|
|
|
@@ -273,7 +275,11 @@ def cmd_init(args) -> int:
|
|
|
273
275
|
print("\n--- .websec-ignore (dry run, not written) ---")
|
|
274
276
|
print(init_scope.render(proposal))
|
|
275
277
|
return EXIT_OK
|
|
276
|
-
|
|
278
|
+
try:
|
|
279
|
+
result = init_scope.write(target, proposal, force=getattr(args, "force", False))
|
|
280
|
+
except OSError as exc:
|
|
281
|
+
print(f"cannot write scope policy: {exc}", file=sys.stderr)
|
|
282
|
+
return EXIT_USAGE
|
|
277
283
|
if not result["written"]:
|
|
278
284
|
print(f"\n ✗ not written: {result['reason']}\n {result['path']}")
|
|
279
285
|
print(" An existing .websec-ignore is a policy document — it may hold reviewed "
|
|
@@ -287,9 +293,19 @@ def cmd_init(args) -> int:
|
|
|
287
293
|
|
|
288
294
|
def cmd_recon(args) -> int:
|
|
289
295
|
target = _resolve_target(args.target)
|
|
290
|
-
|
|
296
|
+
try:
|
|
297
|
+
out = _default_out(target, args.out)
|
|
298
|
+
from .output import checked_path
|
|
299
|
+
checked_path(out, "FACTS.json")
|
|
300
|
+
except OSError as exc:
|
|
301
|
+
print(f"cannot select recon output: {exc}", file=sys.stderr)
|
|
302
|
+
return EXIT_USAGE
|
|
291
303
|
facts = recon.build_facts(target, __version__)
|
|
292
|
-
|
|
304
|
+
try:
|
|
305
|
+
recon.write_facts(facts, out / "FACTS.json")
|
|
306
|
+
except OSError as exc:
|
|
307
|
+
print(f"cannot write recon output: {exc}", file=sys.stderr)
|
|
308
|
+
return EXIT_USAGE
|
|
293
309
|
print(f"✓ FACTS.json → {out / 'FACTS.json'}")
|
|
294
310
|
_print_facts_summary(facts)
|
|
295
311
|
return 0
|
|
@@ -939,10 +955,12 @@ def cmd_gate(args) -> int:
|
|
|
939
955
|
return EXIT_USAGE
|
|
940
956
|
|
|
941
957
|
scope_source = "explicit"
|
|
958
|
+
scope_truncated = False
|
|
942
959
|
paths = list(getattr(args, "only", None) or [])
|
|
943
960
|
if not paths:
|
|
944
961
|
discovered = _gate.working_tree_paths(target)
|
|
945
962
|
paths, scope_source = discovered["paths"], discovered["source"]
|
|
963
|
+
scope_truncated = discovered.get("truncated", False)
|
|
946
964
|
if scope_source == "working-tree-unavailable":
|
|
947
965
|
# Not a pass: the gate could not determine what to analyse, so it never answered the
|
|
948
966
|
# question. This is the INCOMPLETE class (the check did not run), not the usage class
|
|
@@ -963,7 +981,7 @@ def cmd_gate(args) -> int:
|
|
|
963
981
|
result = _gate.evaluate(target, paths, args.fail_on, version=__version__,
|
|
964
982
|
scope_source=scope_source,
|
|
965
983
|
min_confidence=getattr(args, "min_confidence", "low"),
|
|
966
|
-
excludes=getattr(args, "exclude", None))
|
|
984
|
+
excludes=getattr(args, "exclude", None), scope_truncated=scope_truncated)
|
|
967
985
|
|
|
968
986
|
# --fail-on-missed is applied HERE, not inside verdict(): `verdict` answers "are there blocking
|
|
969
987
|
# findings in what was analysed", and a path that was never analysed produced no finding to
|
|
@@ -973,6 +991,8 @@ def cmd_gate(args) -> int:
|
|
|
973
991
|
print(_gate.to_json(result))
|
|
974
992
|
else:
|
|
975
993
|
print(_gate.render_text(result))
|
|
994
|
+
if result.get("execution_complete") is False and not result.get("blocking_count"):
|
|
995
|
+
return EXIT_INCOMPLETE
|
|
976
996
|
if result["passed"] and result.get("missed") and getattr(args, "fail_on_missed", False):
|
|
977
997
|
print(f"websec gate: --fail-on-missed — {len(result['missed'])} requested path(s) were never "
|
|
978
998
|
"analyzed; refusing to report this as a pass.", file=sys.stderr)
|
|
@@ -1068,7 +1088,7 @@ def cmd_feedback(args) -> int:
|
|
|
1068
1088
|
record = fb.build_missed_record(
|
|
1069
1089
|
attack_class=getattr(args, "attack_class", "") or "", reason=args.reason,
|
|
1070
1090
|
file_extension=getattr(args, "file_extension", "") or "")
|
|
1071
|
-
destination = Path(args.out
|
|
1091
|
+
destination = _default_out(Path.cwd(), args.out) / fb.FEEDBACK_FILENAME
|
|
1072
1092
|
fb.append(destination, record)
|
|
1073
1093
|
except (fb.FeedbackError, OSError) as exc:
|
|
1074
1094
|
print(str(exc), file=sys.stderr)
|
|
@@ -1142,8 +1162,8 @@ def cmd_feedback(args) -> int:
|
|
|
1142
1162
|
record, detector_revision=_cov.get("detector_revision", ""),
|
|
1143
1163
|
analyzed_input_digest=_cov.get("analyzed_input_digest", ""))
|
|
1144
1164
|
|
|
1145
|
-
destination = Path(args.out or "websec-out").resolve() / fb.FEEDBACK_FILENAME
|
|
1146
1165
|
try:
|
|
1166
|
+
destination = _default_out(Path.cwd(), args.out) / fb.FEEDBACK_FILENAME
|
|
1147
1167
|
fb.append(destination, record)
|
|
1148
1168
|
except (fb.FeedbackError, OSError) as exc:
|
|
1149
1169
|
print(f"cannot record feedback: {exc}", file=sys.stderr)
|
|
@@ -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.19.2}/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)
|
|
@@ -120,6 +120,12 @@ def install_agent_hook(project_dir, *, uninstall: bool = False, settings_path=No
|
|
|
120
120
|
evidence that it ran for every change."""
|
|
121
121
|
root = Path(project_dir).expanduser().resolve()
|
|
122
122
|
path = Path(settings_path) if settings_path else root / ".claude" / "settings.json"
|
|
123
|
+
if settings_path is None:
|
|
124
|
+
from .output import checked_path
|
|
125
|
+
try:
|
|
126
|
+
path = checked_path(root, ".claude/settings.json")
|
|
127
|
+
except OSError as error:
|
|
128
|
+
return {"ok": False, "path": str(path), "error": str(error)}
|
|
123
129
|
data: dict = {}
|
|
124
130
|
if path.is_file():
|
|
125
131
|
try:
|
|
@@ -151,8 +157,16 @@ def install_agent_hook(project_dir, *, uninstall: bool = False, settings_path=No
|
|
|
151
157
|
data["hooks"] = hooks_block
|
|
152
158
|
else:
|
|
153
159
|
data.pop("hooks", None)
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
content = json.dumps(data, indent=2) + "\n"
|
|
161
|
+
if settings_path is None:
|
|
162
|
+
from .output import write_text
|
|
163
|
+
try:
|
|
164
|
+
write_text(root, ".claude/settings.json", content)
|
|
165
|
+
except OSError as error:
|
|
166
|
+
return {"ok": False, "path": str(path), "error": str(error)}
|
|
167
|
+
else:
|
|
168
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
169
|
+
path.write_text(content, encoding="utf-8")
|
|
156
170
|
return {"ok": True, "path": str(path), "action": action, "event": AGENT_HOOK_EVENT,
|
|
157
171
|
"matcher": AGENT_HOOK_MATCHER}
|
|
158
172
|
|
|
@@ -160,6 +174,12 @@ def install_agent_hook(project_dir, *, uninstall: bool = False, settings_path=No
|
|
|
160
174
|
def agent_hook_status(project_dir, settings_path=None) -> dict:
|
|
161
175
|
root = Path(project_dir).expanduser().resolve()
|
|
162
176
|
path = Path(settings_path) if settings_path else root / ".claude" / "settings.json"
|
|
177
|
+
if settings_path is None:
|
|
178
|
+
from .output import checked_path
|
|
179
|
+
try:
|
|
180
|
+
path = checked_path(root, ".claude/settings.json")
|
|
181
|
+
except OSError as error:
|
|
182
|
+
return {"installed": False, "path": str(path), "error": str(error)}
|
|
163
183
|
if not path.is_file():
|
|
164
184
|
return {"installed": False, "path": str(path)}
|
|
165
185
|
try:
|
|
@@ -166,7 +166,9 @@ def render(proposal: dict) -> str:
|
|
|
166
166
|
def write(target: Path, proposal: dict, *, force: bool = False) -> dict:
|
|
167
167
|
"""Write `.websec-ignore`. Refuses to clobber an existing one unless `force`."""
|
|
168
168
|
path = Path(target) / IGNORE_NAME
|
|
169
|
+
from .output import checked_path, write_text
|
|
170
|
+
path = checked_path(Path(target), IGNORE_NAME)
|
|
169
171
|
if path.is_file() and not force:
|
|
170
172
|
return {"written": False, "path": str(path), "reason": "already exists (use --force to replace)"}
|
|
171
|
-
|
|
173
|
+
write_text(Path(target), IGNORE_NAME, render(proposal))
|
|
172
174
|
return {"written": True, "path": str(path), "entries": len(proposal["entries"])}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Contained local writes. Explicit bases may be aliases; children must not be.
|
|
2
|
+
|
|
3
|
+
Like run reservation, this assumes an operator-controlled, stable directory tree.
|
|
4
|
+
Atomic replacement prevents truncating a hard-linked destination as a side effect.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import stat
|
|
11
|
+
import tempfile
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def checked_path(base: Path, relative: str | Path) -> Path:
|
|
15
|
+
base = Path(base).expanduser().resolve()
|
|
16
|
+
rel = Path(relative)
|
|
17
|
+
if rel.is_absolute() or not rel.parts or any(p in {"..", "."} for p in rel.parts):
|
|
18
|
+
raise OSError("output must be a contained relative path")
|
|
19
|
+
path = base
|
|
20
|
+
for index, part in enumerate(rel.parts):
|
|
21
|
+
path = path / part
|
|
22
|
+
if path.is_symlink():
|
|
23
|
+
raise OSError("output children must not be symlinks")
|
|
24
|
+
if path.exists():
|
|
25
|
+
mode = path.lstat().st_mode
|
|
26
|
+
expected = stat.S_ISREG if index == len(rel.parts) - 1 else stat.S_ISDIR
|
|
27
|
+
if not expected(mode):
|
|
28
|
+
raise OSError("output has an unexpected file type")
|
|
29
|
+
path.resolve().relative_to(base)
|
|
30
|
+
return path
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def write_text(base: Path, relative: str | Path, content: str) -> Path:
|
|
34
|
+
path = checked_path(base, relative)
|
|
35
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
36
|
+
path = checked_path(base, relative)
|
|
37
|
+
fd, name = tempfile.mkstemp(prefix=".websec-write-", dir=path.parent)
|
|
38
|
+
temporary = Path(name)
|
|
39
|
+
try:
|
|
40
|
+
if path.exists():
|
|
41
|
+
os.fchmod(fd, stat.S_IMODE(path.stat().st_mode))
|
|
42
|
+
with os.fdopen(fd, "w", encoding="utf-8") as handle:
|
|
43
|
+
fd = None
|
|
44
|
+
handle.write(content)
|
|
45
|
+
os.replace(temporary, path)
|
|
46
|
+
finally:
|
|
47
|
+
if fd is not None:
|
|
48
|
+
os.close(fd)
|
|
49
|
+
temporary.unlink(missing_ok=True)
|
|
50
|
+
return path
|
|
@@ -219,6 +219,7 @@ def stage(chosen: list, outdir: Path, facts: dict | None = None) -> list:
|
|
|
219
219
|
# always ship the shared helper the Python probes import (load context + env auth)
|
|
220
220
|
try:
|
|
221
221
|
(dest / "_lib.py").write_text(src_root.joinpath("_lib.py").read_text())
|
|
222
|
+
(dest / "_lib.bash").write_text(src_root.joinpath("_lib.bash").read_text())
|
|
222
223
|
except Exception:
|
|
223
224
|
pass
|
|
224
225
|
for key in chosen:
|
|
@@ -23,8 +23,8 @@ def build_facts(root: Path, version: str, excludes: list | None = None,
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def write_facts(facts: dict, out: Path) -> Path:
|
|
26
|
-
|
|
27
|
-
return out
|
|
26
|
+
from .output import write_text
|
|
27
|
+
return write_text(out.parent, out.name, json.dumps(facts, indent=2))
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def detect_stack(root: Path) -> dict:
|