Skip to content

M61 (TASK-118-FREE): Zero-Init verity scan . (Project-Scoped Default) & Dev Loopback Noise Tuning

1. Purpose & Architectural Decisions

  • Problem: verity scan . silently sweeps 17 $HOME client configs, risking a "spyware" perception and producing false positives from abandoned editor configs and local 127.0.0.1 dev MCP servers.
  • Decision (P0.6): make verity scan . and verity mcp install work with zero prior verity init files, scope discovery to the project by default, and tune localhost/dev noise without weakening any critical security check.
  • Deterministic truth invariant: for any given filesystem layout and flag set, the discovered config set, severities, and exit code are identical across runs and machines. Downgraded findings keep their rule ID, file_path, and evidence — only severity and the resulting exit code change.
  • Free/Pro boundary: Free owns zero-init defaults, project-scoped discovery, the --global opt-in with stale_config downgrade, and loopback tuning. Pro owns fleet-wide $HOME sweeps, cross-repo drift dashboards, and signed global posture reports.

2. Target Files & Technical Deliverables

File Deliverable
src/verity/discovery/config_scanner.py MultiClientConfigScanner scans project-local configs by default; $HOME / global client sweep only under --global (alias of --scan-global) or --all-clients.
src/verity/discovery/auditor.py Downgrade uninstalled client configs discovered under --global to stale_config (info/low); exclude global config contents from --llm-assist payloads.
src/verity/scanner/static_rules.py Loopback-only HTTP/SSE findings tuned to info/low; 0.0.0.0 binds, wildcard / or ~ mounts, unguarded shells, embedded secrets, hidden Unicode/ANSI, and mcp-lock.json drift remain high/critical.
src/verity/cli.py Zero-init execution with built-in defaults; --global / --all-clients flags; suggest adding .verity/ to .gitignore when creating artifacts.
tests/unit/test_zero_init_and_project_scope.py New ATDD suite (below).

Zero-init contract: verity scan . and verity mcp install run cleanly with zero verity.toml / .verityignore / .verity/ files, using built-in defaults, and print a .verity/ .gitignore suggestion only when artifacts are actually created.

3. ATDD Traceability Matrix

AC ID Acceptance Criterion Paired Benign / Negative Control Verification Tier Test Target
AC-61.1 verity scan . in a clean temp project with zero verity.toml / .verity/ executes cleanly without reading $HOME client configs. A populated $HOME fixture is never opened during a project-scoped run. unit tests/unit/test_zero_init_and_project_scope.py::test_zero_init_project_scan_ignores_home
AC-61.2 --global / --all-clients opts into $HOME discovery, downgrades uninstalled client configs to stale_config (info/low), and excludes global configs from --llm-assist payloads. Default run (no flag) produces zero stale_config findings. unit tests/unit/test_zero_init_and_project_scope.py::test_global_opt_in_downgrades_stale_configs
AC-61.3 Loopback http://127.0.0.1:8080/sse dev MCP config scores info/low and does not trigger exit 1 under default --fail-on-findings / --fail-on-severity high|medium. Negative controls (0.0.0.0 bind, wildcard / mount, embedded secret, ANSI/BiDi payload) remain high/critical and still produce exit 1. unit tests/unit/test_zero_init_and_project_scope.py::test_loopback_dev_noise_tuning_and_negative_controls
AC-61.4 Lint and the full unit suite pass. Clean workspace yields zero lint errors. ruff uv run ruff check src tests scripts && uv run pytest tests/

4. Verification Commands

uv run pytest tests/unit/test_zero_init_and_project_scope.py
uv run pytest tests/
uv run ruff check src tests scripts

5. Execution Checklist

  • [ ] AC-61.1 verified green
  • [ ] AC-61.2 verified green
  • [ ] AC-61.3 verified green
  • [ ] AC-61.4 verified green
  • [ ] Board #5 item PVTI_lAHOD-xmQM4Br351zhOMDbs synced & status updated