websec-validator 0.18.0__tar.gz → 0.19.1__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.18.0/src/websec_validator.egg-info → websec_validator-0.19.1}/PKG-INFO +29 -7
- {websec_validator-0.18.0 → websec_validator-0.19.1}/README.md +28 -6
- {websec_validator-0.18.0 → websec_validator-0.19.1}/pyproject.toml +1 -1
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/agenthook.py +4 -6
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/calibration.json +1 -1
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/cli.py +34 -4
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/coverage.py +10 -4
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/base.py +6 -1
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/crypto_usage.py +24 -3
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/pii_exposure.py +33 -4
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/upload_security.py +24 -2
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/webext.py +115 -11
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/findings.py +85 -1
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/gate.py +130 -7
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/graph_enrich.py +2 -1
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/hooks.py +15 -4
- {websec_validator-0.18.0 → websec_validator-0.19.1/src/websec_validator.egg-info}/PKG-INFO +29 -7
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator.egg-info/SOURCES.txt +5 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_coverage.py +66 -0
- websec_validator-0.19.1/tests/test_detector_fp_followups.py +248 -0
- websec_validator-0.19.1/tests/test_explained_brief.py +333 -0
- websec_validator-0.19.1/tests/test_gate_policy_and_scope.py +335 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_hooks.py +59 -0
- websec_validator-0.19.1/tests/test_ignore_claimspec.py +231 -0
- websec_validator-0.19.1/tests/test_pii_projection_fp.py +72 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/LICENSE +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/setup.cfg +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/attribution.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/briefing.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/calibration.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/clusters.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/demo.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/diffscope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/dynamic.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/explain.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/auth.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/client_exposure.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/dependencies.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/feedback.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/init_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/install.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/mcp_server.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/pairs.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/probes.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/provenance.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/recon.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/report.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/research.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/scanners.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/schemas/coverage.schema.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/schemas/ledger.schema.json +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/synthetic.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/demo/app.py.txt +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/_lib.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/forged-token.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/race-conditions.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_action_contracts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_adoption_contracts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_agent_hook.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_attest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_attribution.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_calibration_claimspec.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_calibration_review.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_calibration_scoring.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_constitution.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_crypto_comparisons.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_demo.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_diffscope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_django_routes.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_dynamic_login_shape.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_enrichment.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_explain.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_feedback.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_feedback_calibration_loop.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_field_report_2026_09.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_formats.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_fp_sources.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_gate_and_bypass_record.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_gate_command.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_hardening.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_hooks_contracts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_install.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_install_contracts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_intel.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_inventory.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_issue_147_sarif_locations.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_mcp.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_openapi.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_output_boundaries.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_profiles.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_provenance.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_public_precision.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_read_performance.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_recon.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_research.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_research_cli.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_sarif_workbench.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_scanner_contracts.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_source_budget.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_sql_flow.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_stack_metadata.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_synthetic_pairs.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_testplan.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_triage.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_unanalyzed_cli.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/tests/test_unanalyzed_coverage.py +0 -0
- {websec_validator-0.18.0 → websec_validator-0.19.1}/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.19.1
|
|
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
|
|
@@ -49,6 +49,12 @@ A senior pentester's "here's what to test and how" handoff — auto-generated fr
|
|
|
49
49
|
|
|
50
50
|
[](assets/demo.gif)
|
|
51
51
|
|
|
52
|
+
**New here?** Read the eight-page technical brief — what it reads, how a finding earns its severity,
|
|
53
|
+
what it refuses to say, and the field evidence:
|
|
54
|
+
**[raccioly.github.io/websec-validator](https://raccioly.github.io/websec-validator/websec-explained.html)**
|
|
55
|
+
· [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). Every number in it is
|
|
56
|
+
asserted against this tree by `tests/test_explained_brief.py`, so it cannot drift silently.
|
|
57
|
+
|
|
52
58
|
It is *not* an autonomous scanner and *not* a SaaS. It's the missing front-half: the thing that
|
|
53
59
|
turns a repo into a precise, fact-grounded security brief an AI agent (with a human in the loop)
|
|
54
60
|
can act on — an auto-filled, repo-aware version of a senior pentester's "here's what to test and
|
|
@@ -128,12 +134,15 @@ No need to install Noir or the scanners separately — the image carries a worki
|
|
|
128
134
|
```bash
|
|
129
135
|
docker build -t websec-validator .
|
|
130
136
|
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/scan" websec-validator run /scan --out /scan/websec-out
|
|
137
|
+
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/scan" websec-validator run /scan --out /scan/websec-out --scan # …and execute the bundled scanners
|
|
131
138
|
```
|
|
132
139
|
|
|
133
140
|
The image carries Noir + Trivy + Gitleaks + Semgrep + Checkov — not the full list above, so
|
|
134
141
|
OSV-Scanner, Prowler and the per-language SAST tools (Bandit, gosec, Brakeman) are absent and are
|
|
135
|
-
reported as missing rather than silently skipped.
|
|
136
|
-
|
|
142
|
+
reported as missing rather than silently skipped. **Bundling them is not the same as running them:**
|
|
143
|
+
Noir is the route engine and runs on every `run`, but the four static scanners execute only under
|
|
144
|
+
`--scan` — a plain `run` lists them and prints `(add --scan to execute them)`, exactly as it does
|
|
145
|
+
outside Docker. Mount your repo at `/scan`; artifacts land in `/scan/websec-out`.
|
|
137
146
|
|
|
138
147
|
## Usage
|
|
139
148
|
|
|
@@ -482,6 +491,13 @@ tracked modifications plus untracked files — because agent edits are uncommitt
|
|
|
482
491
|
`base...HEAD` diff would see nothing. It writes no artifacts, publishes no run directory and never
|
|
483
492
|
advances an accepted baseline.
|
|
484
493
|
|
|
494
|
+
`gate` applies `.websec-ignore` exactly as `run` does: an active `fingerprint:` acknowledgement is
|
|
495
|
+
reported under `acknowledged` and does not block; an expired or reasonless one excuses nothing. A
|
|
496
|
+
finding blocks only when it names a file you asked about. One attributed to a *different*
|
|
497
|
+
repository file — some extractors read CI workflows or config manifests such as `wrangler.jsonc`
|
|
498
|
+
whatever `--only` names — is reported under `outside_scope` instead; one that names no file at all still
|
|
499
|
+
blocks, because it cannot be shown to be outside the scope.
|
|
500
|
+
|
|
485
501
|
The default threshold is **medium, not high**: command injection and SSRF on agent-written code are
|
|
486
502
|
frequently rated MEDIUM, so a HIGH default would miss the main case. `--min-confidence` filters
|
|
487
503
|
low-confidence leads for teams that measure them as noisy; there is no confidence floor by default,
|
|
@@ -697,8 +713,9 @@ add the matching dated changelog and migration guidance, and validate the combin
|
|
|
697
713
|
In the 0.x series, feature additions or incompatible contracts increment the minor version.
|
|
698
714
|
|
|
699
715
|
After reviewing current main and overlapping PRs, merge the approved release PR only after its
|
|
700
|
-
required CI checks pass. The resulting main commit subject must be `release:
|
|
701
|
-
|
|
716
|
+
required CI checks pass. The resulting main commit subject must be `release: v<version>`, where
|
|
717
|
+
`<version>` is whatever `pyproject.toml` currently declares — do not hard-code a number here, it
|
|
718
|
+
drifts. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
|
|
702
719
|
package version, creates the matching tag/GitHub Release, and explicitly dispatches
|
|
703
720
|
[publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
|
|
704
721
|
|
|
@@ -713,7 +730,7 @@ omit an independent version field. Check both sources when diagnosing stale inst
|
|
|
713
730
|
|
|
714
731
|
## Status / roadmap
|
|
715
732
|
|
|
716
|
-
Version 0.
|
|
733
|
+
Version 0.18.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
|
|
717
734
|
SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
|
|
718
735
|
intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
|
|
719
736
|
(`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
|
|
@@ -725,7 +742,12 @@ in-loop gate is developer ergonomics, not a control, and `attest` reports eviden
|
|
|
725
742
|
rendering a compliance verdict.
|
|
726
743
|
|
|
727
744
|
The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
|
|
728
|
-
changes. 0.16.0
|
|
745
|
+
changes. 0.16.0 added the claimspec calibration export over 0.15.3 and needed no migration.
|
|
746
|
+
0.17.0 split the exit codes (`2` = usage error, `3` = incomplete run) — the one breaking change in the
|
|
747
|
+
project's history; CI scripts that tested for `2` as "incomplete" must test for `3`. 0.17.1 changed no
|
|
748
|
+
behaviour: it corrected only what the tool says about itself.
|
|
749
|
+
0.18.0 adds a measured `P(real)` from a relabelled corpus, and stops a scan that could read no
|
|
750
|
+
analyzable source from reporting as a completed clean run (`--require-analyzed`, exit 3).
|
|
729
751
|
The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
|
|
730
752
|
unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
|
|
731
753
|
Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
|
|
@@ -20,6 +20,12 @@ A senior pentester's "here's what to test and how" handoff — auto-generated fr
|
|
|
20
20
|
|
|
21
21
|
[](assets/demo.gif)
|
|
22
22
|
|
|
23
|
+
**New here?** Read the eight-page technical brief — what it reads, how a finding earns its severity,
|
|
24
|
+
what it refuses to say, and the field evidence:
|
|
25
|
+
**[raccioly.github.io/websec-validator](https://raccioly.github.io/websec-validator/websec-explained.html)**
|
|
26
|
+
· [PDF](https://raccioly.github.io/websec-validator/websec-explained.pdf). Every number in it is
|
|
27
|
+
asserted against this tree by `tests/test_explained_brief.py`, so it cannot drift silently.
|
|
28
|
+
|
|
23
29
|
It is *not* an autonomous scanner and *not* a SaaS. It's the missing front-half: the thing that
|
|
24
30
|
turns a repo into a precise, fact-grounded security brief an AI agent (with a human in the loop)
|
|
25
31
|
can act on — an auto-filled, repo-aware version of a senior pentester's "here's what to test and
|
|
@@ -99,12 +105,15 @@ No need to install Noir or the scanners separately — the image carries a worki
|
|
|
99
105
|
```bash
|
|
100
106
|
docker build -t websec-validator .
|
|
101
107
|
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/scan" websec-validator run /scan --out /scan/websec-out
|
|
108
|
+
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD:/scan" websec-validator run /scan --out /scan/websec-out --scan # …and execute the bundled scanners
|
|
102
109
|
```
|
|
103
110
|
|
|
104
111
|
The image carries Noir + Trivy + Gitleaks + Semgrep + Checkov — not the full list above, so
|
|
105
112
|
OSV-Scanner, Prowler and the per-language SAST tools (Bandit, gosec, Brakeman) are absent and are
|
|
106
|
-
reported as missing rather than silently skipped.
|
|
107
|
-
|
|
113
|
+
reported as missing rather than silently skipped. **Bundling them is not the same as running them:**
|
|
114
|
+
Noir is the route engine and runs on every `run`, but the four static scanners execute only under
|
|
115
|
+
`--scan` — a plain `run` lists them and prints `(add --scan to execute them)`, exactly as it does
|
|
116
|
+
outside Docker. Mount your repo at `/scan`; artifacts land in `/scan/websec-out`.
|
|
108
117
|
|
|
109
118
|
## Usage
|
|
110
119
|
|
|
@@ -453,6 +462,13 @@ tracked modifications plus untracked files — because agent edits are uncommitt
|
|
|
453
462
|
`base...HEAD` diff would see nothing. It writes no artifacts, publishes no run directory and never
|
|
454
463
|
advances an accepted baseline.
|
|
455
464
|
|
|
465
|
+
`gate` applies `.websec-ignore` exactly as `run` does: an active `fingerprint:` acknowledgement is
|
|
466
|
+
reported under `acknowledged` and does not block; an expired or reasonless one excuses nothing. A
|
|
467
|
+
finding blocks only when it names a file you asked about. One attributed to a *different*
|
|
468
|
+
repository file — some extractors read CI workflows or config manifests such as `wrangler.jsonc`
|
|
469
|
+
whatever `--only` names — is reported under `outside_scope` instead; one that names no file at all still
|
|
470
|
+
blocks, because it cannot be shown to be outside the scope.
|
|
471
|
+
|
|
456
472
|
The default threshold is **medium, not high**: command injection and SSRF on agent-written code are
|
|
457
473
|
frequently rated MEDIUM, so a HIGH default would miss the main case. `--min-confidence` filters
|
|
458
474
|
low-confidence leads for teams that measure them as noisy; there is no confidence floor by default,
|
|
@@ -668,8 +684,9 @@ add the matching dated changelog and migration guidance, and validate the combin
|
|
|
668
684
|
In the 0.x series, feature additions or incompatible contracts increment the minor version.
|
|
669
685
|
|
|
670
686
|
After reviewing current main and overlapping PRs, merge the approved release PR only after its
|
|
671
|
-
required CI checks pass. The resulting main commit subject must be `release:
|
|
672
|
-
|
|
687
|
+
required CI checks pass. The resulting main commit subject must be `release: v<version>`, where
|
|
688
|
+
`<version>` is whatever `pyproject.toml` currently declares — do not hard-code a number here, it
|
|
689
|
+
drifts. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
|
|
673
690
|
package version, creates the matching tag/GitHub Release, and explicitly dispatches
|
|
674
691
|
[publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
|
|
675
692
|
|
|
@@ -684,7 +701,7 @@ omit an independent version field. Check both sources when diagnosing stale inst
|
|
|
684
701
|
|
|
685
702
|
## Status / roadmap
|
|
686
703
|
|
|
687
|
-
Version 0.
|
|
704
|
+
Version 0.18.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
|
|
688
705
|
SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
|
|
689
706
|
intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
|
|
690
707
|
(`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
|
|
@@ -696,7 +713,12 @@ in-loop gate is developer ergonomics, not a control, and `attest` reports eviden
|
|
|
696
713
|
rendering a compliance verdict.
|
|
697
714
|
|
|
698
715
|
The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
|
|
699
|
-
changes. 0.16.0
|
|
716
|
+
changes. 0.16.0 added the claimspec calibration export over 0.15.3 and needed no migration.
|
|
717
|
+
0.17.0 split the exit codes (`2` = usage error, `3` = incomplete run) — the one breaking change in the
|
|
718
|
+
project's history; CI scripts that tested for `2` as "incomplete" must test for `3`. 0.17.1 changed no
|
|
719
|
+
behaviour: it corrected only what the tool says about itself.
|
|
720
|
+
0.18.0 adds a measured `P(real)` from a relabelled corpus, and stops a scan that could read no
|
|
721
|
+
analyzable source from reporting as a completed clean run (`--require-analyzed`, exit 3).
|
|
700
722
|
The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
|
|
701
723
|
unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
|
|
702
724
|
Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "websec-validator"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.19.1"
|
|
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"
|
|
@@ -115,13 +115,11 @@ def run(event: dict | None = None, *, env: dict | None = None) -> int:
|
|
|
115
115
|
# * it avoids a second interpreter start (~0.2s) on every edit.
|
|
116
116
|
# The harness's own hook timeout is the outer guard.
|
|
117
117
|
try:
|
|
118
|
-
from . import
|
|
118
|
+
from . import gate as _gate
|
|
119
119
|
from . import __version__ as _version
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
scope_source="agent-hook",
|
|
124
|
-
min_confidence=env.get("WEBSEC_GATE_MIN_CONFIDENCE", "low"))
|
|
120
|
+
result = _gate.evaluate(Path(root), relative, env.get("WEBSEC_GATE_FAIL_ON", "medium"),
|
|
121
|
+
version=_version, scope_source="agent-hook",
|
|
122
|
+
min_confidence=env.get("WEBSEC_GATE_MIN_CONFIDENCE", "low"))
|
|
125
123
|
except Exception as error:
|
|
126
124
|
# FAIL OPEN, LOUDLY. A security check that blocks every edit when it is broken gets
|
|
127
125
|
# uninstalled within the hour, and then there is no check at all.
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"caveat": "indicative \u2014 calibrated on a deliberately-vulnerable app corpus; skews optimistic on clean production code",
|
|
25
25
|
"evidence_status": "reviewed",
|
|
26
26
|
"reviewed_on": "2026-09-22",
|
|
27
|
-
"limitation": "21 of 56 corpus findings carry a reviewed label; the other 35 are UNKNOWN and are excluded from every count rather than treated as false.
|
|
27
|
+
"limitation": "21 of 56 corpus findings carry a reviewed label; the other 35 are UNKNOWN and are excluded from every count rather than treated as false. All per-class cells except missing-auth|MEDIUM (n=7) are below min_n=5, so every other class falls back to the per-label tier. Measured after the 2026-09-22 false-positive fixes (vendored assets, spec-as-handler, Express route middleware, displayed source), so these rates describe the current detector and not any earlier one."
|
|
28
28
|
},
|
|
29
29
|
"by_class_label": {
|
|
30
30
|
"command-injection|LOW": {
|
|
@@ -229,6 +229,33 @@ def cmd_init(args) -> int:
|
|
|
229
229
|
said. Proposals are evidence-based and always printed before anything is written."""
|
|
230
230
|
from . import init_scope
|
|
231
231
|
target = _resolve_target(args.target)
|
|
232
|
+
# --claimspec: export the REVIEWED acknowledgements ALREADY in .websec-ignore as a claimspec v1
|
|
233
|
+
# `ignore` document (the Guard-family shared format). This reads policy instead of scaffolding
|
|
234
|
+
# it, so it short-circuits before any proposal is computed and never writes .websec-ignore.
|
|
235
|
+
if getattr(args, "claimspec", None):
|
|
236
|
+
doc, report = findings.to_claimspec_ignore(target)
|
|
237
|
+
payload = json.dumps(doc, indent=2, sort_keys=False) + "\n"
|
|
238
|
+
if args.claimspec == "-":
|
|
239
|
+
sys.stdout.write(payload)
|
|
240
|
+
else:
|
|
241
|
+
dest = Path(args.claimspec).expanduser().resolve()
|
|
242
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
243
|
+
dest.write_text(payload)
|
|
244
|
+
print(f"websec init --claimspec: wrote {dest} — {report['entries']} entr(y/ies)")
|
|
245
|
+
# The omissions are the whole point of reporting at all: a claimspec `ignore` document that
|
|
246
|
+
# silently dropped half the policy would read to an auditor as the complete one. They go to
|
|
247
|
+
# stderr so `--claimspec -` stays a clean pipe.
|
|
248
|
+
if not report["complete"]:
|
|
249
|
+
print(" NOT the complete suppression policy:", file=sys.stderr)
|
|
250
|
+
if report["omitted_patterns"]:
|
|
251
|
+
print(f" {report['omitted_patterns']} path/category pattern(s) omitted — a bare "
|
|
252
|
+
".websec-ignore pattern carries\n no reason, and claimspec requires one; "
|
|
253
|
+
"inventing one would make an unreviewed\n suppression read as reviewed.",
|
|
254
|
+
file=sys.stderr)
|
|
255
|
+
for row in report["omitted_acknowledgements"]:
|
|
256
|
+
print(f" acknowledgement {row['fingerprint']} omitted "
|
|
257
|
+
f"({row['state']}): {row['why']}", file=sys.stderr)
|
|
258
|
+
return EXIT_OK
|
|
232
259
|
proposal = init_scope.propose(target)
|
|
233
260
|
print(f"websec-validator v{__version__} — scope setup for {target}\n")
|
|
234
261
|
if proposal["entries"]:
|
|
@@ -933,10 +960,10 @@ def cmd_gate(args) -> int:
|
|
|
933
960
|
"reason": "no changed files to analyze"}))
|
|
934
961
|
return 0
|
|
935
962
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
963
|
+
result = _gate.evaluate(target, paths, args.fail_on, version=__version__,
|
|
964
|
+
scope_source=scope_source,
|
|
965
|
+
min_confidence=getattr(args, "min_confidence", "low"),
|
|
966
|
+
excludes=getattr(args, "exclude", None))
|
|
940
967
|
|
|
941
968
|
# --fail-on-missed is applied HERE, not inside verdict(): `verdict` answers "are there blocking
|
|
942
969
|
# findings in what was analysed", and a path that was never analysed produced no finding to
|
|
@@ -1650,6 +1677,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1650
1677
|
help="print the proposed .websec-ignore without writing it")
|
|
1651
1678
|
i.add_argument("--force", action="store_true",
|
|
1652
1679
|
help="replace an existing .websec-ignore (it may hold reviewed acknowledgements)")
|
|
1680
|
+
i.add_argument("--claimspec", metavar="PATH",
|
|
1681
|
+
help="export the reviewed `fingerprint:` acknowledgements already in "
|
|
1682
|
+
".websec-ignore as a claimspec v1 `ignore` document; `-` writes to stdout")
|
|
1653
1683
|
i.set_defaults(func=cmd_init)
|
|
1654
1684
|
|
|
1655
1685
|
d = sub.add_parser("doctor", help="show which scanners are installed")
|
|
@@ -21,8 +21,8 @@ def detector_revision() -> str:
|
|
|
21
21
|
return "sha256:" + digest.hexdigest()
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def include_reads(cov: dict, ctx, *, input_prefix: str = "") -> None:
|
|
25
|
-
"""Merge
|
|
24
|
+
def include_reads(cov: dict, ctx, *, input_prefix: str = "", execution: bool = True) -> None:
|
|
25
|
+
"""Merge auxiliary reads; optional enrichment losses are scope gaps, not source losses."""
|
|
26
26
|
cov.setdefault("inputs", {}).update({input_prefix + key: value for key, value in ctx.input_hashes.items()})
|
|
27
27
|
cov["analyzed_input_digest"] = _digest(cov["inputs"])
|
|
28
28
|
files = cov.setdefault("files", {})
|
|
@@ -30,9 +30,15 @@ def include_reads(cov: dict, ctx, *, input_prefix: str = "") -> None:
|
|
|
30
30
|
files.setdefault("auxiliary_read_policies", {})[input_prefix] = source_read_policy(ctx)
|
|
31
31
|
files.setdefault("auxiliary_source_bytes", {})[input_prefix] = ctx.cached_source_bytes
|
|
32
32
|
for key in ("unreadable", "oversized", "byte_budget_exceeded"):
|
|
33
|
-
|
|
33
|
+
paths = {input_prefix + path for path in getattr(ctx, key)}
|
|
34
|
+
# The source-loss lists are independently checked by repair/proof consumers.
|
|
35
|
+
# Optional enrichment must not contaminate that required-execution evidence.
|
|
36
|
+
if execution:
|
|
37
|
+
files[key] = sorted(set(files.get(key, [])) | paths)
|
|
34
38
|
if getattr(ctx, key):
|
|
35
|
-
add_gap({"coverage": cov}, key,
|
|
39
|
+
add_gap({"coverage": cov}, key,
|
|
40
|
+
"auxiliary input could not be read completely: " + ", ".join(sorted(paths)),
|
|
41
|
+
execution=execution)
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
def source_read_policy(ctx) -> dict:
|
|
@@ -301,7 +301,12 @@ class RepoContext:
|
|
|
301
301
|
self.all_code_files: list[Path] = []
|
|
302
302
|
self.scope: set[str] | None = None
|
|
303
303
|
if only:
|
|
304
|
-
|
|
304
|
+
# Path() already drops a leading "./". `.lstrip("./")` used to follow it, and lstrip
|
|
305
|
+
# removes CHARACTERS, not a prefix: `.github/scripts/triage.py` became
|
|
306
|
+
# `github/scripts/triage.py`, matched nothing, and every code file under a
|
|
307
|
+
# dot-directory or named as a dotfile (.husky/*.js, .eslintrc.js) was reported missed
|
|
308
|
+
# — never analyzed by the gate. It also turned `../app.py` into `app.py`.
|
|
309
|
+
self.scope = {Path(str(p)).as_posix() for p in only if str(p).strip()}
|
|
305
310
|
self.scope_requested: list[str] = sorted(self.scope) if self.scope else []
|
|
306
311
|
self.scope_matched: list[str] = []
|
|
307
312
|
self.scope_missed: list[str] = []
|
{websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/crypto_usage.py
RENAMED
|
@@ -23,7 +23,10 @@ import re
|
|
|
23
23
|
from .base import Extractor, RepoContext, is_test_file
|
|
24
24
|
from .syntax import expression_end, in_literal, js_functions, without_comments
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
# Exact metadata suffixes are not password bytes. Hashes/tokens in general remain
|
|
27
|
+
# credential-shaped; a broad suffix exemption would hide double-hashed passwords.
|
|
28
|
+
_PW_METADATA = r"_?(?:reset_?(?:token|url)|attempt_?count|file_?path|salt)"
|
|
29
|
+
_PW = r"(?:password|passwd|passphrase|\bpwd\b|userPassword|plainPassword)(?!" + _PW_METADATA + r"\b)"
|
|
27
30
|
# a fast digest fed a password-shaped value (either arg order, within a small window)
|
|
28
31
|
WEAK_PW_HASH = re.compile(
|
|
29
32
|
r"createHash\s*\(\s*['\"](?:md5|sha1|sha256|sha224)['\"]\s*\)[\s\S]{0,160}?\.update\s*\([^)]*" + _PW
|
|
@@ -99,8 +102,15 @@ def _unparenthesized(value: str) -> str:
|
|
|
99
102
|
return value
|
|
100
103
|
|
|
101
104
|
|
|
105
|
+
# Identifier-shaped arguments: not credentials, so hashing them weakly is not a password-hash bug.
|
|
106
|
+
_NON_CREDENTIAL_ARGUMENT = re.compile(
|
|
107
|
+
r"(?:^|\.)(?:id|email|userId|user_id|tenantId|tenant_id|password" + _PW_METADATA + r")$", re.I)
|
|
108
|
+
|
|
109
|
+
|
|
102
110
|
def _credential_operand(value: str) -> bool:
|
|
103
111
|
# Literal words in arbitrary message strings aren't credential variables.
|
|
112
|
+
if re.search(r'\.(?:length|size|byteLength|type)$', value):
|
|
113
|
+
return False
|
|
104
114
|
bare = re.sub(_TIMING_LITERAL, "''", value)
|
|
105
115
|
if _CREDENTIAL_NAME.search(bare):
|
|
106
116
|
return True
|
|
@@ -112,7 +122,7 @@ def _credential_operand(value: str) -> bool:
|
|
|
112
122
|
|
|
113
123
|
def _presence_literal(value: str, suffix: str) -> bool:
|
|
114
124
|
value = _unparenthesized(value)
|
|
115
|
-
if value in {"''", '""'}:
|
|
125
|
+
if value in {"''", '""', '0', '"0"', "'0'"}:
|
|
116
126
|
return True
|
|
117
127
|
if suffix == ".py":
|
|
118
128
|
return value in {"None", "True", "False"}
|
|
@@ -244,7 +254,18 @@ class CryptoUsageExtractor(Extractor):
|
|
|
244
254
|
arg_start = end + update.end()
|
|
245
255
|
arg_end = expression_end(body, arg_start-1, closing=")")
|
|
246
256
|
argument = body[arg_start:arg_end-1].strip()
|
|
247
|
-
|
|
257
|
+
# A PKCE verifier is hashed by design, and an identifier is not a
|
|
258
|
+
# credential: `md5(user.id)` inside a password-ish function is a cache key,
|
|
259
|
+
# not a password hash. Hashing an identifier to MINT a token is a different
|
|
260
|
+
# bug (predictable token), not this one, so it is skipped here rather than
|
|
261
|
+
# reported under a class that would misdescribe it.
|
|
262
|
+
# These arguments CONTRIBUTE NOTHING; they must not clear a weak hash found
|
|
263
|
+
# earlier in the same function. Assigning False here instead let a later
|
|
264
|
+
# PKCE/identifier hash clobber a real `md5(password)` above it —
|
|
265
|
+
# test_pkce_exception_belongs_only_to_its_own_hash_argument catches exactly
|
|
266
|
+
# that, and the exception belongs to its own argument, not to the function.
|
|
267
|
+
if argument not in {"codeVerifier", "code_verifier"} \
|
|
268
|
+
and not _NON_CREDENTIAL_ARGUMENT.search(argument):
|
|
248
269
|
weak = True
|
|
249
270
|
if weak:
|
|
250
271
|
add("HIGH", "weak-password-hash", "weak-password-hash", rel,
|
{websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/pii_exposure.py
RENAMED
|
@@ -63,13 +63,42 @@ def _projected_binding(code: str, position: int, argument: str, scopes: list[dic
|
|
|
63
63
|
return False
|
|
64
64
|
body = code[scope["body_start"]:scope["end"]]
|
|
65
65
|
name = re.escape(argument)
|
|
66
|
-
if len(re.findall(r"\b" + name + r"\b", body)) != 2:
|
|
66
|
+
if len(re.findall(r"\b" + re.escape(name) + r"\b", body)) != 2:
|
|
67
67
|
return False
|
|
68
68
|
prefix = code[scope["body_start"]:position]
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
# Destructuring rest parameter: const { email, ...safeProfile } = user;
|
|
71
|
+
destruct_match = re.search(r"\b(?:const|let)\s*\{\s*([^}]*?)\.\.\.\s*" + re.escape(name) + r"\s*\}\s*=\s*[^;]+;", prefix)
|
|
72
|
+
if destruct_match:
|
|
73
|
+
destructured_fields = [f.strip() for f in destruct_match.group(1).split(",") if f.strip()]
|
|
74
|
+
if any(PII_FIELD.search(f) for f in destructured_fields):
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
# Lodash omit equivalent: const safeAdmin = omit(admin, ['ssn', 'email']);
|
|
78
|
+
omit_match = re.search(r"\b(?:const|let)\s+" + re.escape(name) + r"\s*=\s*(?:_\.)?omit\s*\([^,]+,\s*\[(.*?)\]\s*\)", prefix)
|
|
79
|
+
if omit_match and bool(PII_FIELD.search(omit_match.group(1))):
|
|
80
|
+
return True
|
|
81
|
+
|
|
82
|
+
# Lodash pick equivalent: const safeAdmin = pick(admin, ['id', 'name']);
|
|
83
|
+
pick_match = re.search(r"\b(?:const|let)\s+" + re.escape(name) + r"\s*=\s*(?:_\.)?pick\s*\([^,]+,\s*\[(.*?)\]\s*\)", prefix)
|
|
84
|
+
if pick_match and not bool(PII_FIELD.search(pick_match.group(1))):
|
|
85
|
+
return True
|
|
86
|
+
|
|
87
|
+
# Array map destructuring: const safe = arr.map(({ pii, ...rest }) => rest)
|
|
88
|
+
map_destruct_match = re.search(r"\b(?:const|let)\s+" + re.escape(name) + r"\s*=\s*[\w$.]+\.map\s*\(\s*\(\s*\{\s*([^}]*?)\.\.\.\s*([A-Za-z_$][\w$]*)\s*\}\s*\)\s*=>\s*\2\s*\)\s*;", prefix)
|
|
89
|
+
if map_destruct_match:
|
|
90
|
+
destructured_fields = [f.strip() for f in map_destruct_match.group(1).split(",") if f.strip()]
|
|
91
|
+
if any(PII_FIELD.search(f) for f in destructured_fields):
|
|
92
|
+
return True
|
|
93
|
+
|
|
94
|
+
# Map projection to object literal: const safe = arr.map(u => ({ id: u.id }))
|
|
95
|
+
map_binding = re.search(r"\b(?:const|let)\s+" + re.escape(name) + r"\s*=\s*[\w$.]+\.map\s*\(\s*(?:[^)]+)\s*=>\s*\(?\s*(\{[^{}]*\})\s*\)?\s*\)\s*;", prefix)
|
|
96
|
+
binding = re.search(r"\bconst\s+" + re.escape(name) + r"\s*=\s*(\{[^{};]*\})\s*;\s*$", prefix)
|
|
97
|
+
|
|
98
|
+
match_literal = map_binding or binding
|
|
99
|
+
if not match_literal or in_literal(prefix, match_literal.start()):
|
|
71
100
|
return False
|
|
72
|
-
fields = split_arguments(
|
|
101
|
+
fields = split_arguments(match_literal.group(1)[1:-1])
|
|
73
102
|
return bool(fields) and all(re.fullmatch(r"[\w$]+\s*:\s*[\w$.]+", field)
|
|
74
103
|
and not PII_FIELD.search(field) for field in fields)
|
|
75
104
|
|
|
@@ -27,8 +27,7 @@ ALLOW_LIST = re.compile(r"isAllowedMediaType|allowedMimeTypes|allow[_-]?list|whi
|
|
|
27
27
|
r"|ACCEPTED_(?:MIME|TYPES?|EXT)|accepted(?:Mime|File|Content)?(?:Types?|Extensions?)"
|
|
28
28
|
r"|\bfile-type\b|fileTypeFrom|magic[_-]?byte|detectContentType|\.fromBuffer\b|sniff", re.I)
|
|
29
29
|
KEY_FROM_NAME = re.compile(r"(?:Key|key|path|filename|filepath|destination|filename\s*\()\s*[:=(][^;\n]{0,90}"
|
|
30
|
-
r"\b(?:originalname|originalName|file\.name)\b"
|
|
31
|
-
r"|`[^`]*\$\{[^}]*\boriginalname\b[^}]*\}[^`]*`", re.I)
|
|
30
|
+
r"\b(?:originalname|originalName|file\.name)\b", re.I)
|
|
32
31
|
TRUST_CLIENT_MIME = re.compile(r"(?:\b(?:req|request)\.files?(?:\.[\w$]+)*|\bfile)\.mimetype\b|headers\[['\"]content-type['\"]\]", re.I)
|
|
33
32
|
ACCEPT_SVG = re.compile(r"image/svg\+xml|['\"]svg['\"]", re.I)
|
|
34
33
|
# file-serving: streaming a STORED/PROXIED object back to the client. Tightened to genuine
|
|
@@ -162,7 +161,30 @@ def _byte_allowlist(scope: dict | None, file_object: str, source: str) -> bool:
|
|
|
162
161
|
return True
|
|
163
162
|
|
|
164
163
|
|
|
164
|
+
def _logged_mime_only(source: str, match) -> bool:
|
|
165
|
+
"""Exclude simple logging arguments, never nested calls or decisions."""
|
|
166
|
+
literal = r'''"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*' '''
|
|
167
|
+
value = re.escape(match[0])
|
|
168
|
+
simple = re.compile(r"(?:" + literal + "|" + value + r")(?:\s*\+\s*(?:" + literal + "|" + value + r"))*", re.X)
|
|
169
|
+
for log in re.finditer(r"\b(?:console|logger|logging)\.(?:log|info|debug|warn|warning|error)\s*\(", source):
|
|
170
|
+
if log.start() >= match.start():
|
|
171
|
+
break
|
|
172
|
+
if in_literal(source, log.start()):
|
|
173
|
+
continue
|
|
174
|
+
expression = call_expression(source, log.start())
|
|
175
|
+
if log.start() + len(expression) <= match.end() or not expression.endswith(")"):
|
|
176
|
+
continue
|
|
177
|
+
# Every argument must be inert literals or this MIME property. Unknown
|
|
178
|
+
# expressions (including nested validation calls) contribute no exemption.
|
|
179
|
+
args = split_arguments(expression[expression.find("(") + 1:-1])
|
|
180
|
+
if args and all(simple.fullmatch(arg) for arg in args):
|
|
181
|
+
return True
|
|
182
|
+
return False
|
|
183
|
+
|
|
184
|
+
|
|
165
185
|
def _mime_unsafe(source: str, match, scopes: list[dict]) -> bool:
|
|
186
|
+
if _logged_mime_only(source, match):
|
|
187
|
+
return False
|
|
166
188
|
containing = [scope for scope in scopes if scope["body_start"] <= match.start() < scope["end"]]
|
|
167
189
|
scope = min(containing, key=lambda item: item["end"]-item["start"]) if containing else None
|
|
168
190
|
file_match = re.search(r"([\w$]+(?:\.[\w$]+)*)\.mimetype", match[0])
|
{websec_validator-0.18.0 → websec_validator-0.19.1}/src/websec_validator/extractors/webext.py
RENAMED
|
@@ -42,28 +42,132 @@ ON_MESSAGE_EXTERNAL = re.compile(r"\.onMessageExternal\.addListener")
|
|
|
42
42
|
BROAD_HOST = re.compile(r"<all_urls>|\*://\*/\*|https?://\*/\*")
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
# `const { origin } = sender;` before the guard is the common modern shape, and it was uncredited:
|
|
46
|
+
# `guarded_body` requires the body to START with `if (`, so any binding in front of the check made
|
|
47
|
+
# the whole handler read as unvalidated. That first-statement rule is deliberate and right — a guard
|
|
48
|
+
# that runs after something has already acted on untrusted input is too late — but a BINDING acts on
|
|
49
|
+
# nothing. So a prologue is allowed only when every statement in it is an inert alias of the sender,
|
|
50
|
+
# and the alias is then rewritten back to `sender.<prop>` so the existing predicate judges the real
|
|
51
|
+
# read rather than a name.
|
|
52
|
+
#
|
|
53
|
+
# Three things keep this from becoming a false negative:
|
|
54
|
+
# * only `const`/`let`/`var <name> = sender.<id|origin|url>` and `{ id, origin, url }` destructuring
|
|
55
|
+
# count — anything else in the prologue (a call, an await, an assignment to something else)
|
|
56
|
+
# abandons the rewrite and leaves the original, stricter behaviour,
|
|
57
|
+
# * an alias that is REBOUND anywhere in the body disqualifies the whole handler, because the value
|
|
58
|
+
# checked would not be the value used,
|
|
59
|
+
# * the prologue must be inert: no call, no await, no increment.
|
|
60
|
+
_ALIAS_PROP = r"(?:id|origin|url)"
|
|
61
|
+
_ALIAS_DESTRUCTURE = re.compile(
|
|
62
|
+
r"^(?:const|let|var)\s*\{\s*([^{}=;]+?)\s*\}\s*=\s*(\w[\w$]*)\s*;?$")
|
|
63
|
+
_ALIAS_ASSIGN = re.compile(
|
|
64
|
+
r"^(?:const|let|var)\s+([\w$]+)\s*=\s*(\w[\w$]*)\s*\??\.\s*(" + _ALIAS_PROP + r")\s*;?$")
|
|
65
|
+
_INERT = re.compile(r"""^[\w$\s{}:,.?\[\]'"=-]*$""")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _resolve_sender_aliases(body: str, sender: str) -> str:
|
|
69
|
+
"""Rewrite an inert alias prologue back to direct `sender.<prop>` reads, or return body unchanged.
|
|
70
|
+
|
|
71
|
+
Returns "" when an alias is rebound later — the caller must then refuse to credit, because the
|
|
72
|
+
value that was checked is not the value that gets used.
|
|
73
|
+
"""
|
|
74
|
+
statements, rest = [], body.strip()
|
|
75
|
+
aliases: dict = {}
|
|
76
|
+
while True:
|
|
77
|
+
head, sep, tail = rest.partition(";")
|
|
78
|
+
if not sep:
|
|
79
|
+
break
|
|
80
|
+
statement = head.strip()
|
|
81
|
+
if statement.startswith("if") or not statement:
|
|
82
|
+
break
|
|
83
|
+
if not _INERT.match(statement):
|
|
84
|
+
return body # a call/await ran before the guard: original rules
|
|
85
|
+
match = _ALIAS_ASSIGN.match(statement)
|
|
86
|
+
if match and match.group(2) == sender:
|
|
87
|
+
aliases[match.group(1)] = match.group(3)
|
|
88
|
+
else:
|
|
89
|
+
match = _ALIAS_DESTRUCTURE.match(statement)
|
|
90
|
+
if not match or match.group(2) != sender:
|
|
91
|
+
return body # an inert binding we cannot attribute to the sender
|
|
92
|
+
for part in match.group(1).split(","):
|
|
93
|
+
part = part.strip()
|
|
94
|
+
if not part:
|
|
95
|
+
continue
|
|
96
|
+
renamed = re.fullmatch(r"(" + _ALIAS_PROP + r")\s*:\s*([\w$]+)", part)
|
|
97
|
+
if renamed:
|
|
98
|
+
aliases[renamed.group(2)] = renamed.group(1)
|
|
99
|
+
elif re.fullmatch(_ALIAS_PROP, part):
|
|
100
|
+
aliases[part] = part
|
|
101
|
+
else:
|
|
102
|
+
return body # destructuring something other than the sender props
|
|
103
|
+
statements.append(statement)
|
|
104
|
+
rest = tail.lstrip()
|
|
105
|
+
if not aliases or not rest.startswith("if"):
|
|
106
|
+
return body
|
|
107
|
+
for alias in aliases:
|
|
108
|
+
rebind = re.compile(r"\b" + re.escape(alias) + r"\s*(?:=(?!=)|\+\+|--)")
|
|
109
|
+
if any(not in_literal(rest, m.start()) for m in rebind.finditer(rest)):
|
|
110
|
+
return "" # checked value != used value
|
|
111
|
+
rest = re.sub(r"\b" + re.escape(alias) + r"\b", f"{sender}.{aliases[alias]}", rest)
|
|
112
|
+
return rest
|
|
113
|
+
|
|
114
|
+
|
|
45
115
|
def _sender_control(scope: dict) -> bool:
|
|
46
116
|
if len(scope["params"]) < 2:
|
|
47
117
|
return False
|
|
48
118
|
sender = scope["params"][1]
|
|
49
|
-
body = scope["body"]
|
|
119
|
+
body = _resolve_sender_aliases(scope["body"], sender)
|
|
120
|
+
if not body:
|
|
121
|
+
return False # an alias was rebound after the check
|
|
50
122
|
# A check on an earlier value does not authorize a replaced sender object.
|
|
51
123
|
mutations = re.finditer(r"\b" + re.escape(sender) + r"(?:\.[\w$]+)?\s*(?:=(?!=)|\+\+|--)", body)
|
|
52
124
|
if any(not in_literal(body, match.start()) for match in mutations):
|
|
53
125
|
return False
|
|
54
126
|
|
|
55
127
|
def predicate(condition):
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
128
|
+
condition = condition.strip()
|
|
129
|
+
|
|
130
|
+
inverted = False
|
|
131
|
+
if condition.startswith("!"):
|
|
132
|
+
inverted = True
|
|
133
|
+
condition = condition[1:].strip()
|
|
134
|
+
if condition.startswith("(") and condition.endswith(")"):
|
|
135
|
+
condition = condition[1:-1].strip()
|
|
136
|
+
|
|
137
|
+
# `sender?.origin` as well as `sender.origin`: optional chaining is the same read.
|
|
138
|
+
# Deliberately NOT extended to local aliases (`const { origin } = sender`) — an alias can be
|
|
139
|
+
# reassigned between the binding and the check, and crediting one would turn a missing
|
|
140
|
+
# sender check into silence. Any extension needs a control proving a REASSIGNED alias is
|
|
141
|
+
# still reported.
|
|
142
|
+
sender_prop = re.escape(sender) + r"(?:\?)?\.(?:id|origin|url)"
|
|
143
|
+
op = r"(===|!==|==|!=)"
|
|
144
|
+
|
|
145
|
+
match1 = re.fullmatch(sender_prop + r"\s*" + op + r"\s*(['\"])([^'\"*\\$`]+)\2", condition)
|
|
146
|
+
match2 = re.fullmatch(r"(['\"])([^'\"*\\$`]+)\1\s*" + op + r"\s*" + sender_prop, condition)
|
|
147
|
+
|
|
148
|
+
if match1:
|
|
149
|
+
operator = match1[1]
|
|
150
|
+
elif match2:
|
|
151
|
+
operator = match2[3]
|
|
152
|
+
else:
|
|
153
|
+
operator = None
|
|
154
|
+
|
|
155
|
+
if operator:
|
|
156
|
+
is_equality = (operator in {"===", "=="})
|
|
157
|
+
if inverted:
|
|
158
|
+
is_equality = not is_equality
|
|
159
|
+
return 1 if is_equality else -1
|
|
160
|
+
|
|
161
|
+
match3 = re.fullmatch(r"(!)?\s*(\[[^\[\]]+\])\.includes\(\s*" + sender_prop + r"\s*\)", condition)
|
|
162
|
+
if match3:
|
|
163
|
+
includes_inverted = bool(match3[1])
|
|
164
|
+
if inverted:
|
|
165
|
+
includes_inverted = not includes_inverted
|
|
166
|
+
|
|
167
|
+
items = split_arguments(match3[2][1:-1])
|
|
65
168
|
if items and all(re.fullmatch(r"(['\"])[^'\"*\\$`]+\1", item) for item in items):
|
|
66
|
-
return -1 if
|
|
169
|
+
return -1 if includes_inverted else 1
|
|
170
|
+
|
|
67
171
|
return 0
|
|
68
172
|
|
|
69
173
|
return guarded_body(body, predicate)
|