websec-validator 0.15.3__tar.gz → 0.16.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {websec_validator-0.15.3/src/websec_validator.egg-info → websec_validator-0.16.0}/PKG-INFO +24 -5
- {websec_validator-0.15.3 → websec_validator-0.16.0}/README.md +23 -4
- {websec_validator-0.15.3 → websec_validator-0.16.0}/pyproject.toml +1 -1
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/calibration.py +92 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/cli.py +34 -1
- {websec_validator-0.15.3 → websec_validator-0.16.0/src/websec_validator.egg-info}/PKG-INFO +24 -5
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator.egg-info/SOURCES.txt +1 -0
- websec_validator-0.16.0/tests/test_calibration_claimspec.py +202 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/LICENSE +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/setup.cfg +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/__init__.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/agenthook.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/attest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/attribution.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/baseline.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/briefing.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/calibration.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/constitution.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/corpus.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/coverage.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/dast_ingest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/dast_predict.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/demo.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/diffscope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/dynamic.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/enrichment.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/explain.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/__init__.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/agent_config.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/auth.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/authz.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/authz_dataflow.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/base.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/client_exposure.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/client_integrity.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/crypto_usage.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/dependencies.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/django_urls.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/graphql.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/iac_ci.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/integrations.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/llm_security.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/pii_exposure.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/policy_consistency.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/profiles.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/routes.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/schemas.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/sql_flow.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/stack.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/surface.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/syntax.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/tenant.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/transport_security.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/upload_security.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/extractors/webext.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/feedback.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/findings.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/fixprompt.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/formats.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/fpfilter.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/gate.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/graph_enrich.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/hooks.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/install.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/intel.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/inventory.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/mcp_server.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/openapi.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/probes.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/proof.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/provenance.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/recon.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/registry.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/repairs.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/report.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/research/control-scope-cases.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/research/example.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/research/profile-cases.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/research.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/rules/error-stack-disclosure.yml +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/rules/insecure-default-secret.yml +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/sarif_ingest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/scanners.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/schemas/coverage.schema.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/schemas/facts.schema.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/schemas/ledger.schema.json +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/demo/app.py.txt +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/demo/requirements.txt.txt +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/_lib.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-cswsh.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-introspection.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/appsync-subscription-bola.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/bola-cross-tenant.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/bola-write-verbs.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/client-integrity-checklist.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/compare-roles.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/dlp-bypass-offline.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/entitlement-abuse.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/error-disclosure-probe.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/forged-token.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/hs256-brute-force.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/jwt-attacks.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/mass-assignment.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/password-reuse.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/pii-output-diff.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/race-conditions.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/rate-limit-burst.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/s3-assess.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/ssrf-probes.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/unauth-baseline.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/upload-matrix.sh +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/probes/webhook-forgery.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/reports/FINDINGS-SUMMARY.md.template +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/reports/access-control-matrix.md.template +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/reports/findings-triage.md.template +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/reports/pentest-handover-brief.md.template +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/templates/reports/per-tool-FINDINGS.md.template +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator/testplan.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator.egg-info/dependency_links.txt +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator.egg-info/entry_points.txt +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator.egg-info/top_level.txt +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_action_contracts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_adoption_contracts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_agent_hook.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_agent_hosts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_agent_launch_specs.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_analysis_scope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_assurance_regressions.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_attest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_attribution.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_auth_control_scope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_constitution.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_control_scope_research.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_coverage.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_crypto_comparisons.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_dast_ingest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_dast_predict.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_demo.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_detector_precision.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_diffscope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_django_routes.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_enrichment.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_entitlement_webext.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_evidence_verdicts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_explain.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_extension_controls.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_feedback.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_fixprompt_fpfilter.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_formats.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_gate_and_bypass_record.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_gate_command.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_gitleaks_worktree.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_graph_enrich.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_hardening.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_hooks.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_hooks_contracts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_install.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_install_contracts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_intel.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_inventory.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_lifecycle.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_mcp.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_mcp_security.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_openapi.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_output_boundaries.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_pentest_regressions.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_profiles.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_proof_revisions.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_provenance.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_public_precision.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_read_boundary.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_read_performance.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_recon.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_registry_existence.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_remaining_control_scope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_research.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_research_cli.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_sarif_ingest.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_sarif_workbench.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_scanner_contracts.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_source_budget.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_sql_flow.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_stack_metadata.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_testplan.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_transport_pii_scope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_transport_stack_scope.py +0 -0
- {websec_validator-0.15.3 → websec_validator-0.16.0}/tests/test_workbench_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: websec-validator
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app.
|
|
5
5
|
Author: Ricardo Accioly
|
|
6
6
|
License: MIT
|
|
@@ -299,6 +299,11 @@ Extractor failures, source read loss/caps, invalid scanner reports, timeouts, an
|
|
|
299
299
|
missing scanners remain visible in `coverage.json`; partial artifacts are preserved. Optional missing
|
|
300
300
|
unselected scanners are reported as unavailable. `--scanners` requires `--scan`.
|
|
301
301
|
|
|
302
|
+
**Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
|
|
303
|
+
have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
|
|
304
|
+
--require-complete` exits 2 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
|
|
305
|
+
install failed fails instead of reporting zero findings from a scan that never ran.
|
|
306
|
+
|
|
302
307
|
Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
|
|
303
308
|
advances only after a completed execution has written its artifacts; a partial attempt retains its
|
|
304
309
|
own directory and leaves the previous completed scan selected. Completed execution describes the
|
|
@@ -591,6 +596,19 @@ unproven samples are quarantined. Unknown-only input reports no successful measu
|
|
|
591
596
|
existing fitted calibration unchanged. A DAST hit may confirm a scoped lead; absence from a report
|
|
592
597
|
cannot refute it. Manual labels should include reviewer/evidence provenance, not only a boolean.
|
|
593
598
|
|
|
599
|
+
**Shared format.** `websec calibrate --claimspec PATH` (or `-` for stdout) exports the table the
|
|
600
|
+
runtime actually uses — shipped corpus table plus your local overlay, merged — as a
|
|
601
|
+
[claimspec](https://github.com/raccioly/testguard/tree/main/spec) v1 `calibration` document, the
|
|
602
|
+
Guard-family interchange format. Nothing is lost in translation: the caveat, limitation, evidence
|
|
603
|
+
status, `minN` floor, the per-confidence backoff tier and the labelled uncalibrated prior all travel
|
|
604
|
+
with the numbers (`measures: finding-real`, `bucketBy: attackClass|confidence`). Each cell carries
|
|
605
|
+
raw `n` and `positives`, so a consumer can recompute `p` and the Wilson interval and merge two
|
|
606
|
+
tables by summing counts — the only merge the spec allows. `source.kind` says where the labels came
|
|
607
|
+
from: `human-label` for the shipped table, `tool-oracle` for an overlay-only table, `mixed` once
|
|
608
|
+
your samples are folded in. The writer refuses to export a cell whose stored numbers do not
|
|
609
|
+
reproduce from its counts rather than emit a document the spec validator would reject. The
|
|
610
|
+
internal `calibration.json` shape and the local overlay are unchanged.
|
|
611
|
+
|
|
594
612
|
## Dynamic phase (v2 — read-only so far)
|
|
595
613
|
|
|
596
614
|
When you have a *running TEST instance*, `websec dynamic` mints role tokens and runs the probes the
|
|
@@ -626,7 +644,7 @@ add the matching dated changelog and migration guidance, and validate the combin
|
|
|
626
644
|
In the 0.x series, feature additions or incompatible contracts increment the minor version.
|
|
627
645
|
|
|
628
646
|
After reviewing current main and overlapping PRs, merge the approved release PR only after its
|
|
629
|
-
required CI checks pass. The resulting main commit subject must be `release: v0.
|
|
647
|
+
required CI checks pass. The resulting main commit subject must be `release: v0.16.0` for this
|
|
630
648
|
release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
|
|
631
649
|
package version, creates the matching tag/GitHub Release, and explicitly dispatches
|
|
632
650
|
[publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
|
|
@@ -642,18 +660,19 @@ omit an independent version field. Check both sources when diagnosing stale inst
|
|
|
642
660
|
|
|
643
661
|
## Status / roadmap
|
|
644
662
|
|
|
645
|
-
Version 0.
|
|
663
|
+
Version 0.16.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
|
|
646
664
|
SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
|
|
647
665
|
intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
|
|
648
666
|
(`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
|
|
649
667
|
existence check (`--network`), run attribution with graded assurance, recorded gate verdicts and
|
|
650
|
-
hook bypasses,
|
|
668
|
+
hook bypasses, an audit-evidence projection (`websec attest`), and a claimspec export of the
|
|
669
|
+
calibration table (`websec calibrate --claimspec`). These are scoped review tools;
|
|
651
670
|
manual profiles, unknown routes, dynamic behavior and unsupported syntax remain limitations. The
|
|
652
671
|
in-loop gate is developer ergonomics, not a control, and `attest` reports evidence without
|
|
653
672
|
rendering a compliance verdict.
|
|
654
673
|
|
|
655
674
|
The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
|
|
656
|
-
changes. 0.
|
|
675
|
+
changes. 0.16.0 adds the claimspec calibration export over 0.15.3 and needs no migration.
|
|
657
676
|
The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
|
|
658
677
|
unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
|
|
659
678
|
Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
|
|
@@ -270,6 +270,11 @@ Extractor failures, source read loss/caps, invalid scanner reports, timeouts, an
|
|
|
270
270
|
missing scanners remain visible in `coverage.json`; partial artifacts are preserved. Optional missing
|
|
271
271
|
unselected scanners are reported as unavailable. `--scanners` requires `--scan`.
|
|
272
272
|
|
|
273
|
+
**Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
|
|
274
|
+
have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
|
|
275
|
+
--require-complete` exits 2 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
|
|
276
|
+
install failed fails instead of reporting zero findings from a scan that never ran.
|
|
277
|
+
|
|
273
278
|
Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
|
|
274
279
|
advances only after a completed execution has written its artifacts; a partial attempt retains its
|
|
275
280
|
own directory and leaves the previous completed scan selected. Completed execution describes the
|
|
@@ -562,6 +567,19 @@ unproven samples are quarantined. Unknown-only input reports no successful measu
|
|
|
562
567
|
existing fitted calibration unchanged. A DAST hit may confirm a scoped lead; absence from a report
|
|
563
568
|
cannot refute it. Manual labels should include reviewer/evidence provenance, not only a boolean.
|
|
564
569
|
|
|
570
|
+
**Shared format.** `websec calibrate --claimspec PATH` (or `-` for stdout) exports the table the
|
|
571
|
+
runtime actually uses — shipped corpus table plus your local overlay, merged — as a
|
|
572
|
+
[claimspec](https://github.com/raccioly/testguard/tree/main/spec) v1 `calibration` document, the
|
|
573
|
+
Guard-family interchange format. Nothing is lost in translation: the caveat, limitation, evidence
|
|
574
|
+
status, `minN` floor, the per-confidence backoff tier and the labelled uncalibrated prior all travel
|
|
575
|
+
with the numbers (`measures: finding-real`, `bucketBy: attackClass|confidence`). Each cell carries
|
|
576
|
+
raw `n` and `positives`, so a consumer can recompute `p` and the Wilson interval and merge two
|
|
577
|
+
tables by summing counts — the only merge the spec allows. `source.kind` says where the labels came
|
|
578
|
+
from: `human-label` for the shipped table, `tool-oracle` for an overlay-only table, `mixed` once
|
|
579
|
+
your samples are folded in. The writer refuses to export a cell whose stored numbers do not
|
|
580
|
+
reproduce from its counts rather than emit a document the spec validator would reject. The
|
|
581
|
+
internal `calibration.json` shape and the local overlay are unchanged.
|
|
582
|
+
|
|
565
583
|
## Dynamic phase (v2 — read-only so far)
|
|
566
584
|
|
|
567
585
|
When you have a *running TEST instance*, `websec dynamic` mints role tokens and runs the probes the
|
|
@@ -597,7 +615,7 @@ add the matching dated changelog and migration guidance, and validate the combin
|
|
|
597
615
|
In the 0.x series, feature additions or incompatible contracts increment the minor version.
|
|
598
616
|
|
|
599
617
|
After reviewing current main and overlapping PRs, merge the approved release PR only after its
|
|
600
|
-
required CI checks pass. The resulting main commit subject must be `release: v0.
|
|
618
|
+
required CI checks pass. The resulting main commit subject must be `release: v0.16.0` for this
|
|
601
619
|
release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
|
|
602
620
|
package version, creates the matching tag/GitHub Release, and explicitly dispatches
|
|
603
621
|
[publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
|
|
@@ -613,18 +631,19 @@ omit an independent version field. Check both sources when diagnosing stale inst
|
|
|
613
631
|
|
|
614
632
|
## Status / roadmap
|
|
615
633
|
|
|
616
|
-
Version 0.
|
|
634
|
+
Version 0.16.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
|
|
617
635
|
SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
|
|
618
636
|
intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
|
|
619
637
|
(`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
|
|
620
638
|
existence check (`--network`), run attribution with graded assurance, recorded gate verdicts and
|
|
621
|
-
hook bypasses,
|
|
639
|
+
hook bypasses, an audit-evidence projection (`websec attest`), and a claimspec export of the
|
|
640
|
+
calibration table (`websec calibrate --claimspec`). These are scoped review tools;
|
|
622
641
|
manual profiles, unknown routes, dynamic behavior and unsupported syntax remain limitations. The
|
|
623
642
|
in-loop gate is developer ergonomics, not a control, and `attest` reports evidence without
|
|
624
643
|
rendering a compliance verdict.
|
|
625
644
|
|
|
626
645
|
The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
|
|
627
|
-
changes. 0.
|
|
646
|
+
changes. 0.16.0 adds the claimspec calibration export over 0.15.3 and needs no migration.
|
|
628
647
|
The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
|
|
629
648
|
unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
|
|
630
649
|
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.16.0"
|
|
8
8
|
description = "Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -258,6 +258,98 @@ def samples_from_dynamic(dynamic: dict) -> list:
|
|
|
258
258
|
return out
|
|
259
259
|
|
|
260
260
|
|
|
261
|
+
# ---- claimspec `calibration` writer (additive: the internal table shape above is unchanged) ----
|
|
262
|
+
# claimspec is the Guard-family shared spec (testguard `spec/`). Its `calibration` kind carries the
|
|
263
|
+
# same honesty fields this table does — corpus, caveat, limitation, evidence status, min-n floor,
|
|
264
|
+
# backoff tier and a labelled fallback — under different names. This writer is the translation.
|
|
265
|
+
CLAIMSPEC_SCHEMA_VERSION = 1
|
|
266
|
+
CLAIMSPEC_MEASURES = "finding-real" # P(a reported finding of this class is a real vulnerability)
|
|
267
|
+
CLAIMSPEC_BUCKET_BY = "attackClass|confidence" # `by_class_label` keys are `class|LABEL`
|
|
268
|
+
CLAIMSPEC_BACKOFF_BY = "confidence" # `by_label` keys are `LABEL`
|
|
269
|
+
CLAIMSPEC_CONFIDENCE = 0.95 # Z95 above is the exact quantile for this level
|
|
270
|
+
_EVIDENCE_STATUS = {"historical-unverified": "unverified", "historical-quarantined": "quarantined"}
|
|
271
|
+
# meta keys that are websec provenance with no claimspec field; they travel in `source.detail`.
|
|
272
|
+
_DETAIL_KEYS = ("n_total", "n_unknown", "unmatched_rule", "researched_classes", "personalized",
|
|
273
|
+
"local_samples", "legacy_uncertain_samples", "historical_uncertain_samples",
|
|
274
|
+
"shipped_table", "method")
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _claimspec_cell(key: str, cell: dict) -> dict:
|
|
278
|
+
"""Translate one `{n, k, p, ci}` cell to `{n, positives, p, ci}`, refusing one that does not
|
|
279
|
+
reproduce from its own counts.
|
|
280
|
+
|
|
281
|
+
The stored `p`/`ci` are passed through, not recomputed: they are the numbers `apply()` actually
|
|
282
|
+
attaches to findings, and an exported document must not quote a different one. The validator
|
|
283
|
+
recomputes both from `positives`/`n` at the document's own precision, so a stale hand-edited
|
|
284
|
+
cell would make the whole document non-conforming — better to refuse here and name the cell.
|
|
285
|
+
Precision note: `_cell` uses Python `round()` (round-half-even on the binary value) where the
|
|
286
|
+
JS validator uses `toFixed` (round-half-away); an exact tie at 3 dp is effectively impossible
|
|
287
|
+
for a Wilson bound, so the two agree in practice.
|
|
288
|
+
"""
|
|
289
|
+
n, k = int(cell.get("n", 0)), int(cell.get("k", 0))
|
|
290
|
+
if k > n or n < 0:
|
|
291
|
+
raise ValueError(f"calibration cell {key!r} has {k} positives in {n} trials")
|
|
292
|
+
expected = _cell(k, n)
|
|
293
|
+
got = {"p": cell.get("p"), "ci": list(cell.get("ci", []))}
|
|
294
|
+
if got["p"] != expected["p"] or got["ci"] != expected["ci"]:
|
|
295
|
+
raise ValueError(f"calibration cell {key!r} does not reproduce from its counts "
|
|
296
|
+
f"({k}/{n}): stored p={got['p']} ci={got['ci']}, "
|
|
297
|
+
f"expected p={expected['p']} ci={expected['ci']}")
|
|
298
|
+
return {"n": n, "positives": k, "p": got["p"], "ci": got["ci"]}
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def to_claimspec(table: dict, computed_at: str | None = None) -> dict:
|
|
302
|
+
"""Render an internal calibration table (shipped, local-only or merged, i.e. anything `load()`
|
|
303
|
+
returns) as a claimspec v1 `calibration` document.
|
|
304
|
+
|
|
305
|
+
Field mapping is fixed by the spec's own reference translation of the shipped table
|
|
306
|
+
(`spec/conformance/examples/calibration-websec.json` in testguard). `source.kind` says where
|
|
307
|
+
the labels came from: `human-label` for the shipped corpus table, `tool-oracle` when only the
|
|
308
|
+
operator's confirmed local samples exist, `mixed` once local samples are folded over shipped.
|
|
309
|
+
`source.caveat` is always written — a number quoted without it is a misquote.
|
|
310
|
+
"""
|
|
311
|
+
from datetime import datetime, timezone
|
|
312
|
+
from . import __version__
|
|
313
|
+
|
|
314
|
+
meta = table.get("meta", {}) or {}
|
|
315
|
+
if meta.get("shipped_table") is False:
|
|
316
|
+
kind, ref = "tool-oracle", "calibration-local.json (operator overlay; no shipped table)"
|
|
317
|
+
elif meta.get("personalized"):
|
|
318
|
+
kind, ref = "mixed", "shipped calibration.json + operator overlay calibration-local.json"
|
|
319
|
+
else:
|
|
320
|
+
kind, ref = "human-label", "src/websec_validator/calibration.json, shipped in the package"
|
|
321
|
+
source: dict = {"kind": kind, "ref": ref}
|
|
322
|
+
if meta.get("corpus"):
|
|
323
|
+
source["corpus"] = list(meta["corpus"])
|
|
324
|
+
source["caveat"] = meta.get("caveat") or CAVEAT
|
|
325
|
+
if meta.get("limitation"):
|
|
326
|
+
source["limitation"] = meta["limitation"]
|
|
327
|
+
source["evidenceStatus"] = _EVIDENCE_STATUS.get(meta.get("evidence_status"), "verified")
|
|
328
|
+
detail = {key: meta[key] for key in _DETAIL_KEYS if meta.get(key) is not None}
|
|
329
|
+
if detail:
|
|
330
|
+
source["detail"] = detail
|
|
331
|
+
|
|
332
|
+
if computed_at is None:
|
|
333
|
+
computed_at = datetime.now(timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z")
|
|
334
|
+
return {
|
|
335
|
+
"schemaVersion": CLAIMSPEC_SCHEMA_VERSION,
|
|
336
|
+
"tool": {"name": "websec-validator", "version": __version__},
|
|
337
|
+
"computedAt": computed_at,
|
|
338
|
+
"method": "wilson",
|
|
339
|
+
"confidence": CLAIMSPEC_CONFIDENCE,
|
|
340
|
+
"measures": CLAIMSPEC_MEASURES,
|
|
341
|
+
"bucketBy": CLAIMSPEC_BUCKET_BY,
|
|
342
|
+
"minN": int(meta.get("min_n", MIN_N)),
|
|
343
|
+
"source": source,
|
|
344
|
+
"buckets": {key: _claimspec_cell(key, cell)
|
|
345
|
+
for key, cell in sorted((table.get("by_class_label") or {}).items())},
|
|
346
|
+
"backoff": [{"bucketBy": CLAIMSPEC_BACKOFF_BY,
|
|
347
|
+
"buckets": {key: _claimspec_cell(key, cell)
|
|
348
|
+
for key, cell in sorted((table.get("by_label") or {}).items())}}],
|
|
349
|
+
"fallback": {"basis": "uncalibrated-prior", "values": dict(table.get("prior") or PRIOR)},
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
261
353
|
def apply(attack_class: str, confidence: str, table: dict | None) -> dict:
|
|
262
354
|
"""Attach a calibrated estimate for a finding's (attack_class, confidence) bucket.
|
|
263
355
|
|
|
@@ -1121,6 +1121,33 @@ def cmd_calibrate(args) -> int:
|
|
|
1121
1121
|
write calibration.json (shipped + applied at runtime by findings.build_ledger)."""
|
|
1122
1122
|
from importlib import resources
|
|
1123
1123
|
|
|
1124
|
+
# --claimspec: export the calibration the runtime actually uses (shipped table + your local
|
|
1125
|
+
# overlay, merged) as a claimspec v1 `calibration` document — the Guard-family shared format,
|
|
1126
|
+
# so another tool can read websec's P(real) table with its caveat, floor, backoff and
|
|
1127
|
+
# labelled fallback intact. Additive: the internal calibration.json shape is unchanged.
|
|
1128
|
+
if getattr(args, "claimspec", None):
|
|
1129
|
+
table = calibration.load()
|
|
1130
|
+
if not table:
|
|
1131
|
+
print("websec calibrate --claimspec: no calibration table is available (neither the shipped "
|
|
1132
|
+
"table nor a local overlay loaded). Nothing to export.")
|
|
1133
|
+
return 2
|
|
1134
|
+
try:
|
|
1135
|
+
doc = calibration.to_claimspec(table)
|
|
1136
|
+
except ValueError as e:
|
|
1137
|
+
sys.exit(f"error: --claimspec refused to export a non-reproducible table: {e}")
|
|
1138
|
+
text = json.dumps(doc, indent=2) + "\n"
|
|
1139
|
+
if args.claimspec == "-":
|
|
1140
|
+
sys.stdout.write(text)
|
|
1141
|
+
return 0
|
|
1142
|
+
dest = Path(args.claimspec).expanduser().resolve()
|
|
1143
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
1144
|
+
dest.write_text(text)
|
|
1145
|
+
cells = len(doc["buckets"])
|
|
1146
|
+
print(f"websec calibrate --claimspec: wrote {dest} — source.kind={doc['source']['kind']}, "
|
|
1147
|
+
f"evidenceStatus={doc['source']['evidenceStatus']}, {cells} primary cell(s), "
|
|
1148
|
+
f"minN={doc['minN']}.")
|
|
1149
|
+
return 0
|
|
1150
|
+
|
|
1124
1151
|
# --ingest-dast: close the loop with a REAL scan — a ZAP/Nuclei report confirms/refutes websec's
|
|
1125
1152
|
# DAST-predictable findings (§4b) and folds the verdicts into your local overlay. Needs the ledger.
|
|
1126
1153
|
if getattr(args, "ingest_dast", None):
|
|
@@ -1286,7 +1313,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1286
1313
|
help="also emit a Software Bill of Materials (default cyclonedx → sbom.cdx.json) via "
|
|
1287
1314
|
"Trivy — offline, for CI/compliance (SLSA, EO 14028)")
|
|
1288
1315
|
r.add_argument("--scanners", metavar="A,B",
|
|
1289
|
-
help="comma-separated
|
|
1316
|
+
help="comma-separated scanners to REQUIRE and run with --scan (e.g. gitleaks,semgrep). "
|
|
1317
|
+
"Selection is also a requirement: a selected scanner that is not installed is "
|
|
1318
|
+
"recorded as unavailable, makes the run incomplete, and exits 2 under --fail-on "
|
|
1319
|
+
"or --require-complete — a gate never reports green from a scanner that never ran.")
|
|
1290
1320
|
r.add_argument("--format", choices=["briefing", "sarif", "json"], default="briefing",
|
|
1291
1321
|
help="stdout format: briefing (human, default) | sarif (SARIF 2.1.0) | json (envelope). "
|
|
1292
1322
|
"results.sarif is ALWAYS written to the run dir regardless.")
|
|
@@ -1367,6 +1397,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1367
1397
|
"(needs --ledger)")
|
|
1368
1398
|
cal.add_argument("--ledger", metavar="findings-ledger.json",
|
|
1369
1399
|
help="the websec ledger the --ingest-dast report is matched against")
|
|
1400
|
+
cal.add_argument("--claimspec", metavar="PATH",
|
|
1401
|
+
help="export the calibration the runtime uses (shipped + local overlay) as a "
|
|
1402
|
+
"claimspec v1 `calibration` document; `-` writes to stdout")
|
|
1370
1403
|
cal.set_defaults(func=cmd_calibrate)
|
|
1371
1404
|
|
|
1372
1405
|
dyn = sub.add_parser("dynamic", help="dynamic probes vs a LIVE target (read-only): cross-tenant BOLA (--config) or unauth reachability (--unauth)")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: websec-validator
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Defensive, local-first security recon that briefs your AI coding agent on your own codebase — read-only by default (code in, artifacts out): facts + tailored probe scripts, no LLM, no server, no running app.
|
|
5
5
|
Author: Ricardo Accioly
|
|
6
6
|
License: MIT
|
|
@@ -299,6 +299,11 @@ Extractor failures, source read loss/caps, invalid scanner reports, timeouts, an
|
|
|
299
299
|
missing scanners remain visible in `coverage.json`; partial artifacts are preserved. Optional missing
|
|
300
300
|
unselected scanners are reported as unavailable. `--scanners` requires `--scan`.
|
|
301
301
|
|
|
302
|
+
**Naming a scanner requires it.** `--scanners` is not only a subset filter: a scanner you select but
|
|
303
|
+
have not installed is an incomplete run, not a clean one. `websec run . --scan --scanners trivy,osv-scanner
|
|
304
|
+
--require-complete` exits 2 with `trivy: unavailable` in `coverage.json`, so a CI job whose scanner
|
|
305
|
+
install failed fails instead of reporting zero findings from a scan that never ran.
|
|
306
|
+
|
|
302
307
|
Every attempt receives a unique directory under `websec-out/runs/`. The atomic `latest` pointer
|
|
303
308
|
advances only after a completed execution has written its artifacts; a partial attempt retains its
|
|
304
309
|
own directory and leaves the previous completed scan selected. Completed execution describes the
|
|
@@ -591,6 +596,19 @@ unproven samples are quarantined. Unknown-only input reports no successful measu
|
|
|
591
596
|
existing fitted calibration unchanged. A DAST hit may confirm a scoped lead; absence from a report
|
|
592
597
|
cannot refute it. Manual labels should include reviewer/evidence provenance, not only a boolean.
|
|
593
598
|
|
|
599
|
+
**Shared format.** `websec calibrate --claimspec PATH` (or `-` for stdout) exports the table the
|
|
600
|
+
runtime actually uses — shipped corpus table plus your local overlay, merged — as a
|
|
601
|
+
[claimspec](https://github.com/raccioly/testguard/tree/main/spec) v1 `calibration` document, the
|
|
602
|
+
Guard-family interchange format. Nothing is lost in translation: the caveat, limitation, evidence
|
|
603
|
+
status, `minN` floor, the per-confidence backoff tier and the labelled uncalibrated prior all travel
|
|
604
|
+
with the numbers (`measures: finding-real`, `bucketBy: attackClass|confidence`). Each cell carries
|
|
605
|
+
raw `n` and `positives`, so a consumer can recompute `p` and the Wilson interval and merge two
|
|
606
|
+
tables by summing counts — the only merge the spec allows. `source.kind` says where the labels came
|
|
607
|
+
from: `human-label` for the shipped table, `tool-oracle` for an overlay-only table, `mixed` once
|
|
608
|
+
your samples are folded in. The writer refuses to export a cell whose stored numbers do not
|
|
609
|
+
reproduce from its counts rather than emit a document the spec validator would reject. The
|
|
610
|
+
internal `calibration.json` shape and the local overlay are unchanged.
|
|
611
|
+
|
|
594
612
|
## Dynamic phase (v2 — read-only so far)
|
|
595
613
|
|
|
596
614
|
When you have a *running TEST instance*, `websec dynamic` mints role tokens and runs the probes the
|
|
@@ -626,7 +644,7 @@ add the matching dated changelog and migration guidance, and validate the combin
|
|
|
626
644
|
In the 0.x series, feature additions or incompatible contracts increment the minor version.
|
|
627
645
|
|
|
628
646
|
After reviewing current main and overlapping PRs, merge the approved release PR only after its
|
|
629
|
-
required CI checks pass. The resulting main commit subject must be `release: v0.
|
|
647
|
+
required CI checks pass. The resulting main commit subject must be `release: v0.16.0` for this
|
|
630
648
|
release. [release-tag.yml](.github/workflows/release-tag.yml) validates that subject against the
|
|
631
649
|
package version, creates the matching tag/GitHub Release, and explicitly dispatches
|
|
632
650
|
[publish.yml](.github/workflows/publish.yml) at that tag. A version edit alone does not publish.
|
|
@@ -642,18 +660,19 @@ omit an independent version field. Check both sources when diagnosing stale inst
|
|
|
642
660
|
|
|
643
661
|
## Status / roadmap
|
|
644
662
|
|
|
645
|
-
Version 0.
|
|
663
|
+
Version 0.16.0 provides 22 recon extractors, eleven optional scanner entries, nine named profiles,
|
|
646
664
|
SARIF import/export, bounded source/query analysis, explicit coverage and lifecycle evidence,
|
|
647
665
|
intelligence/research commands, and opt-in agent/hook/CI adoption. It adds an in-loop security gate
|
|
648
666
|
(`websec gate` and a `PostToolUse` hook), analysis scoping with `--only`, an opt-in dependency
|
|
649
667
|
existence check (`--network`), run attribution with graded assurance, recorded gate verdicts and
|
|
650
|
-
hook bypasses,
|
|
668
|
+
hook bypasses, an audit-evidence projection (`websec attest`), and a claimspec export of the
|
|
669
|
+
calibration table (`websec calibrate --claimspec`). These are scoped review tools;
|
|
651
670
|
manual profiles, unknown routes, dynamic behavior and unsupported syntax remain limitations. The
|
|
652
671
|
in-loop gate is developer ergonomics, not a control, and `attest` reports evidence without
|
|
653
672
|
rendering a compliance verdict.
|
|
654
673
|
|
|
655
674
|
The [0.14.0 migration guide](docs/MIGRATING-0.14.0.md) explains schema 2.0 and gate/artifact
|
|
656
|
-
changes. 0.
|
|
675
|
+
changes. 0.16.0 adds the claimspec calibration export over 0.15.3 and needs no migration.
|
|
657
676
|
The [remaining-work specification](specs/001-continuous-security-improvement/spec.md) consolidates
|
|
658
677
|
unresolved gaps and acceptance tests so overlapping old-base PRs do not become competing roadmaps.
|
|
659
678
|
Existing runtime probes are opt-in; their earlier isolated results are not current deployment proofs.
|
{websec_validator-0.15.3 → websec_validator-0.16.0}/src/websec_validator.egg-info/SOURCES.txt
RENAMED
|
@@ -126,6 +126,7 @@ tests/test_assurance_regressions.py
|
|
|
126
126
|
tests/test_attest.py
|
|
127
127
|
tests/test_attribution.py
|
|
128
128
|
tests/test_auth_control_scope.py
|
|
129
|
+
tests/test_calibration_claimspec.py
|
|
129
130
|
tests/test_constitution.py
|
|
130
131
|
tests/test_control_scope_research.py
|
|
131
132
|
tests/test_coverage.py
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""The claimspec `calibration` writer: websec's internal table rendered as the Guard-family shared
|
|
2
|
+
format, without changing the internal shape or the runtime cascade.
|
|
3
|
+
|
|
4
|
+
Two layers. The structural tests run everywhere and pin the field mapping, the provenance kinds and
|
|
5
|
+
the arithmetic. The round-trip test hands the emitted documents to the spec's own Node validator
|
|
6
|
+
(testguard `spec/lib/validate.mjs`), which recomputes every `p`/`ci`; it is skipped — never silently
|
|
7
|
+
passed — when `node`, a testguard checkout, or a schema that knows the calibration format is absent.
|
|
8
|
+
Point `WEBSEC_CLAIMSPEC_SPEC_DIR` at a testguard `spec/` directory to run it against a specific one;
|
|
9
|
+
otherwise the sibling checkout `../testguard/spec` is tried.
|
|
10
|
+
"""
|
|
11
|
+
import contextlib
|
|
12
|
+
import copy
|
|
13
|
+
import io
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import re
|
|
17
|
+
import shutil
|
|
18
|
+
import subprocess
|
|
19
|
+
import sys
|
|
20
|
+
import tempfile
|
|
21
|
+
import unittest
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from unittest.mock import patch
|
|
24
|
+
|
|
25
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'src'))
|
|
26
|
+
from websec_validator import calibration, cli # noqa: E402
|
|
27
|
+
|
|
28
|
+
REPO = Path(__file__).resolve().parents[1]
|
|
29
|
+
SHIPPED = json.loads((REPO / 'src' / 'websec_validator' / 'calibration.json').read_text())
|
|
30
|
+
STAMP = '2026-09-18T00:00:00Z'
|
|
31
|
+
ISO = re.compile(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$')
|
|
32
|
+
KEY = re.compile(r'^[A-Za-z0-9][A-Za-z0-9._-]*(\|[A-Za-z0-9][A-Za-z0-9._-]*)*$')
|
|
33
|
+
LOCAL = {'schema_version': 2, 'meta': {'source': 'local evidence overlay', 'samples': 7, 'runs': 3},
|
|
34
|
+
'by_class_label': {'bola|MEDIUM': {'n': 6, 'k': 5}, 'missing-auth|MEDIUM': {'n': 1, 'k': 0}},
|
|
35
|
+
'by_label': {'MEDIUM': {'n': 7, 'k': 5}}, 'observations': {}}
|
|
36
|
+
|
|
37
|
+
# The runner is written to a temp dir at test time; `ajv` resolves from the validator's own location.
|
|
38
|
+
RUNNER = '''
|
|
39
|
+
import { readFileSync } from 'node:fs';
|
|
40
|
+
import { pathToFileURL } from 'node:url';
|
|
41
|
+
const [specDir, file] = process.argv.slice(2);
|
|
42
|
+
let validate;
|
|
43
|
+
try { ({ validate } = await import(pathToFileURL(specDir + '/lib/validate.mjs').href)); }
|
|
44
|
+
catch (e) { console.error(String(e)); process.exit(3); }
|
|
45
|
+
try {
|
|
46
|
+
const r = validate('calibration', JSON.parse(readFileSync(file, 'utf8')));
|
|
47
|
+
console.log(JSON.stringify(r));
|
|
48
|
+
process.exit(r.ok ? 0 : 1);
|
|
49
|
+
} catch (e) { console.error(String(e)); process.exit(4); }
|
|
50
|
+
'''
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def shapes():
|
|
54
|
+
"""The four tables a consumer can meet: raw shipped, what `load()` returns today (the shipped
|
|
55
|
+
table is quarantined), an operator's overlay with no shipped table, and the two merged."""
|
|
56
|
+
return {
|
|
57
|
+
'shipped': calibration.to_claimspec(copy.deepcopy(SHIPPED), computed_at=STAMP),
|
|
58
|
+
'runtime': calibration.to_claimspec(calibration.load(), computed_at=STAMP),
|
|
59
|
+
'local-only': calibration.to_claimspec(calibration._merge(None, copy.deepcopy(LOCAL)), computed_at=STAMP),
|
|
60
|
+
'merged': calibration.to_claimspec(calibration._merge(copy.deepcopy(SHIPPED), copy.deepcopy(LOCAL)), computed_at=STAMP),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class ClaimspecWriterTests(unittest.TestCase):
|
|
65
|
+
def setUp(self):
|
|
66
|
+
self.temp = tempfile.TemporaryDirectory(); self.addCleanup(self.temp.cleanup)
|
|
67
|
+
self.root = Path(self.temp.name)
|
|
68
|
+
# no operator overlay unless a test writes one
|
|
69
|
+
p = patch.object(calibration, 'LOCAL_PATH', self.root / 'calibration-local.json'); p.start(); self.addCleanup(p.stop)
|
|
70
|
+
|
|
71
|
+
def test_shipped_table_maps_field_for_field(self):
|
|
72
|
+
doc = calibration.to_claimspec(copy.deepcopy(SHIPPED), computed_at=STAMP)
|
|
73
|
+
self.assertEqual(doc['schemaVersion'], 1)
|
|
74
|
+
self.assertEqual(doc['tool']['name'], 'websec-validator'); self.assertTrue(doc['tool']['version'])
|
|
75
|
+
self.assertEqual((doc['method'], doc['confidence'], doc['measures']), ('wilson', 0.95, 'finding-real'))
|
|
76
|
+
self.assertEqual(doc['bucketBy'], 'attackClass|confidence'); self.assertEqual(doc['minN'], SHIPPED['meta']['min_n'])
|
|
77
|
+
src = doc['source']
|
|
78
|
+
self.assertEqual(src['kind'], 'human-label'); self.assertEqual(src['evidenceStatus'], 'unverified')
|
|
79
|
+
self.assertEqual(src['corpus'], SHIPPED['meta']['corpus'])
|
|
80
|
+
self.assertEqual(src['caveat'], SHIPPED['meta']['caveat']); self.assertEqual(src['limitation'], SHIPPED['meta']['limitation'])
|
|
81
|
+
for key in ('n_total', 'unmatched_rule', 'researched_classes'):
|
|
82
|
+
self.assertEqual(src['detail'][key], SHIPPED['meta'][key])
|
|
83
|
+
self.assertEqual(set(doc['buckets']), set(SHIPPED['by_class_label']))
|
|
84
|
+
for key, cell in SHIPPED['by_class_label'].items():
|
|
85
|
+
self.assertEqual(doc['buckets'][key], {'n': cell['n'], 'positives': cell['k'], 'p': cell['p'], 'ci': cell['ci']})
|
|
86
|
+
self.assertEqual(doc['backoff'][0]['bucketBy'], 'confidence')
|
|
87
|
+
self.assertEqual(set(doc['backoff'][0]['buckets']), set(SHIPPED['by_label']))
|
|
88
|
+
self.assertEqual(doc['fallback'], {'basis': 'uncalibrated-prior', 'values': SHIPPED['prior']})
|
|
89
|
+
self.assertEqual(doc['computedAt'], STAMP)
|
|
90
|
+
|
|
91
|
+
def test_every_cell_reproduces_from_its_counts_with_either_z(self):
|
|
92
|
+
for name, doc in shapes().items():
|
|
93
|
+
tiers = [(doc['bucketBy'], doc['buckets'])] + [(t['bucketBy'], t['buckets']) for t in doc['backoff']]
|
|
94
|
+
for by, buckets in tiers:
|
|
95
|
+
arity = by.count('|') + 1
|
|
96
|
+
for key, cell in buckets.items():
|
|
97
|
+
with self.subTest(shape=name, key=key):
|
|
98
|
+
self.assertRegex(key, KEY); self.assertEqual(key.count('|') + 1, arity)
|
|
99
|
+
self.assertLessEqual(cell['positives'], cell['n'])
|
|
100
|
+
n, k = cell['n'], cell['positives']
|
|
101
|
+
self.assertEqual(cell['p'], round(k / n, 3) if n else None)
|
|
102
|
+
candidates = [[round(v, 3) for v in calibration.wilson(k, n, z)] for z in (calibration.Z95, 1.96)]
|
|
103
|
+
self.assertIn(cell['ci'], candidates)
|
|
104
|
+
if n:
|
|
105
|
+
self.assertTrue(cell['ci'][0] <= cell['p'] <= cell['ci'][1])
|
|
106
|
+
|
|
107
|
+
def test_runtime_table_is_quarantined_with_empty_buckets_and_a_caveat(self):
|
|
108
|
+
doc = calibration.to_claimspec(calibration.load(), computed_at=STAMP)
|
|
109
|
+
self.assertEqual(doc['source']['evidenceStatus'], 'quarantined'); self.assertEqual(doc['source']['kind'], 'human-label')
|
|
110
|
+
self.assertEqual(doc['buckets'], {}); self.assertEqual(doc['backoff'][0]['buckets'], {})
|
|
111
|
+
self.assertIn('retained for audit', doc['source']['caveat'])
|
|
112
|
+
self.assertGreater(doc['source']['detail']['historical_uncertain_samples'], 0)
|
|
113
|
+
self.assertNotIn('corpus', doc['source']) # the quarantined numbers are not the corpus numbers
|
|
114
|
+
self.assertEqual(doc['fallback']['values'], calibration.PRIOR)
|
|
115
|
+
|
|
116
|
+
def test_local_only_overlay_is_a_tool_oracle_without_corpus_provenance(self):
|
|
117
|
+
doc = calibration.to_claimspec(calibration._merge(None, copy.deepcopy(LOCAL)), computed_at=STAMP)
|
|
118
|
+
self.assertEqual(doc['source']['kind'], 'tool-oracle'); self.assertEqual(doc['source']['evidenceStatus'], 'verified')
|
|
119
|
+
self.assertTrue(doc['source']['caveat'].startswith(calibration.LOCAL_ONLY_CAVEAT))
|
|
120
|
+
self.assertNotIn('corpus', doc['source']); self.assertNotIn('limitation', doc['source'])
|
|
121
|
+
self.assertIs(doc['source']['detail']['shipped_table'], False); self.assertEqual(doc['source']['detail']['local_samples'], 7)
|
|
122
|
+
self.assertEqual(doc['buckets']['bola|MEDIUM'], {'n': 6, 'positives': 5, 'p': 0.833, 'ci': [round(v, 3) for v in calibration.wilson(5, 6)]})
|
|
123
|
+
|
|
124
|
+
def test_merged_table_is_mixed_and_carries_summed_counts(self):
|
|
125
|
+
doc = calibration.to_claimspec(calibration._merge(copy.deepcopy(SHIPPED), copy.deepcopy(LOCAL)), computed_at=STAMP)
|
|
126
|
+
self.assertEqual(doc['source']['kind'], 'mixed'); self.assertEqual(doc['source']['evidenceStatus'], 'unverified')
|
|
127
|
+
cell = doc['buckets']['missing-auth|MEDIUM']
|
|
128
|
+
self.assertEqual((cell['n'], cell['positives'], cell['p']), (42, 27, round(27 / 42, 3)))
|
|
129
|
+
self.assertEqual(doc['backoff'][0]['buckets']['MEDIUM']['n'], 51 + 7)
|
|
130
|
+
self.assertIn('local sample(s) folded in', doc['source']['caveat']); self.assertEqual(doc['source']['corpus'], SHIPPED['meta']['corpus'])
|
|
131
|
+
|
|
132
|
+
def test_zero_trial_cell_has_null_p_and_maximal_ignorance(self):
|
|
133
|
+
table = {'meta': {}, 'by_class_label': {'sqli|LOW': calibration._cell(0, 0)}, 'by_label': {}, 'prior': calibration.PRIOR}
|
|
134
|
+
doc = calibration.to_claimspec(table, computed_at=STAMP)
|
|
135
|
+
self.assertEqual(doc['buckets']['sqli|LOW'], {'n': 0, 'positives': 0, 'p': None, 'ci': [0.0, 1.0]})
|
|
136
|
+
self.assertEqual(doc['source']['caveat'], calibration.CAVEAT) # always written, even with no meta
|
|
137
|
+
self.assertNotIn('detail', doc['source']) # nothing to say ≠ an empty object
|
|
138
|
+
|
|
139
|
+
def test_writer_refuses_a_cell_whose_numbers_do_not_reproduce(self):
|
|
140
|
+
stale = copy.deepcopy(SHIPPED); stale['by_class_label']['missing-auth|MEDIUM']['p'] = 0.7
|
|
141
|
+
with self.assertRaisesRegex(ValueError, r"'missing-auth\|MEDIUM'.*27/41"):
|
|
142
|
+
calibration.to_claimspec(stale, computed_at=STAMP)
|
|
143
|
+
bad = copy.deepcopy(SHIPPED); bad['by_label']['LOW'] = {'n': 2, 'k': 3, 'p': 1.5, 'ci': [0.0, 1.0]}
|
|
144
|
+
with self.assertRaisesRegex(ValueError, "'LOW'"):
|
|
145
|
+
calibration.to_claimspec(bad, computed_at=STAMP)
|
|
146
|
+
|
|
147
|
+
def test_default_timestamp_is_iso_utc(self):
|
|
148
|
+
self.assertRegex(calibration.to_claimspec(copy.deepcopy(SHIPPED))['computedAt'], ISO)
|
|
149
|
+
|
|
150
|
+
def test_cli_exports_the_runtime_table_to_a_file_or_stdout(self):
|
|
151
|
+
out = self.root / 'nested' / 'calibration.claimspec.json'
|
|
152
|
+
with contextlib.redirect_stdout(io.StringIO()) as buf:
|
|
153
|
+
self.assertEqual(cli.main(['calibrate', '--claimspec', str(out)]), 0)
|
|
154
|
+
self.assertIn('evidenceStatus=quarantined', buf.getvalue())
|
|
155
|
+
doc = json.loads(out.read_text())
|
|
156
|
+
self.assertEqual(doc['schemaVersion'], 1); self.assertEqual(doc['measures'], 'finding-real')
|
|
157
|
+
with contextlib.redirect_stdout(io.StringIO()) as buf:
|
|
158
|
+
self.assertEqual(cli.main(['calibrate', '--claimspec', '-']), 0)
|
|
159
|
+
self.assertEqual(json.loads(buf.getvalue())['bucketBy'], 'attackClass|confidence')
|
|
160
|
+
|
|
161
|
+
def test_cli_reports_no_table_instead_of_inventing_one(self):
|
|
162
|
+
with patch.object(calibration, 'load', return_value=None), contextlib.redirect_stdout(io.StringIO()) as buf:
|
|
163
|
+
self.assertEqual(cli.main(['calibrate', '--claimspec', str(self.root / 'x.json')]), 2)
|
|
164
|
+
self.assertIn('Nothing to export', buf.getvalue()); self.assertFalse((self.root / 'x.json').exists())
|
|
165
|
+
|
|
166
|
+
def test_cli_refuses_to_export_a_non_reproducible_table(self):
|
|
167
|
+
stale = copy.deepcopy(SHIPPED); stale['by_label']['LOW']['ci'] = [0.0, 0.5]
|
|
168
|
+
with patch.object(calibration, 'load', return_value=stale), self.assertRaises(SystemExit) as ctx:
|
|
169
|
+
cli.main(['calibrate', '--claimspec', str(self.root / 'x.json')])
|
|
170
|
+
self.assertIn('non-reproducible', str(ctx.exception)); self.assertFalse((self.root / 'x.json').exists())
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class ClaimspecRoundTripTests(unittest.TestCase):
|
|
174
|
+
"""Hand every emitted shape to the spec's own validator, which recomputes p and every ci."""
|
|
175
|
+
|
|
176
|
+
def spec_dir(self) -> Path:
|
|
177
|
+
env = os.environ.get('WEBSEC_CLAIMSPEC_SPEC_DIR')
|
|
178
|
+
spec = Path(env).expanduser() if env else REPO.parent / 'testguard' / 'spec'
|
|
179
|
+
schema = spec / 'schemas' / 'calibration.schema.json'
|
|
180
|
+
if not shutil.which('node'):
|
|
181
|
+
self.skipTest('node is not installed; the claimspec validator is a Node module')
|
|
182
|
+
if not schema.is_file() or not (spec / 'lib' / 'validate.mjs').is_file():
|
|
183
|
+
self.skipTest(f'no claimspec checkout at {spec} (set WEBSEC_CLAIMSPEC_SPEC_DIR)')
|
|
184
|
+
if 'measures' not in json.loads(schema.read_text()).get('properties', {}):
|
|
185
|
+
self.skipTest(f'claimspec checkout at {spec} predates the calibration format (testguard#95)')
|
|
186
|
+
return spec
|
|
187
|
+
|
|
188
|
+
def test_every_shape_conforms_to_the_claimspec_validator(self):
|
|
189
|
+
spec = self.spec_dir()
|
|
190
|
+
with tempfile.TemporaryDirectory() as td, patch.object(calibration, 'LOCAL_PATH', Path(td) / 'calibration-local.json'):
|
|
191
|
+
runner = Path(td) / 'validate-calibration.mjs'; runner.write_text(RUNNER)
|
|
192
|
+
for name, doc in shapes().items():
|
|
193
|
+
with self.subTest(shape=name):
|
|
194
|
+
path = Path(td) / f'{name}.json'; path.write_text(json.dumps(doc, indent=2))
|
|
195
|
+
res = subprocess.run(['node', str(runner), str(spec), str(path)], capture_output=True, text=True, timeout=60)
|
|
196
|
+
if res.returncode == 3:
|
|
197
|
+
self.skipTest(f'claimspec validator could not load (npm install in testguard?): {res.stderr.strip()}')
|
|
198
|
+
self.assertEqual(res.returncode, 0, f'{name}: {res.stdout.strip() or res.stderr.strip()}')
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
if __name__ == '__main__':
|
|
202
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|