Validate storage-root and scan-probe-host settings at boot - #700
Merged
Conversation
posix_checksum_roots and scan_probe_allowed_roots had no field validators, so a relative path or a bare "/" passed Settings() and only failed later: "/" normalizes to the empty string (normalize_storage_root), and the run_capture_path vault's CHECK constraint forbids an empty root, so the failure landed on the first write instead of at startup. Both now require every entry to be absolute and to normalize to a non-empty string; a trailing slash is still accepted since normalization already handles it. scan_probe_remote_host="" also passed validation silently: the paired _validate_scan_probe_remote_python check tests "if scan_probe_remote_host and not value", which treats "" as falsy and skips the check, and active_scan_transport's guard is "if host is not None", so "" was accepted as a configured remote host with nothing to connect to and failed the vault's CHECK constraint (host length 1-255) on upsert. Reject empty/whitespace-only host instead of coercing it to None, so the misconfiguration surfaces at boot rather than being silently papered over. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
posix_checksum_rootsandscan_probe_allowed_roots: every entry must be an absolute path and must not normalize to the empty string (catches a relative path or a bare"/"at boot instead of at the first write, where therun_capture_pathvault's CHECK constraint would otherwise reject it).scan_probe_remote_host, closing a silent-skip path:""is falsy so the existing paired-setting check (scan_probe_remote_host and not value) never fired, andactive_scan_transport'sis not Noneguard then treated""as a configured remote host, failing the vault's CHECK constraint on the first upsert.Test plan
tests/unit/test_settings.py(57 passed) — new cases: trailing-slash accepted, relative path rejected, bare/rejected for both root settings; empty/whitespace host rejected; pre-existing host/python pairing check still firestest_checksum_verifier_wiring.py,test_wire_scan_ingest_pair.py,test_capture_path_locator.py,test_capture_scan_ingestor.py,test_run_witness.py(153 passed)tests/architecture: 31288 passed🤖 Generated with Claude Code