fix(config): make catalog drift policy configurable - #536
Conversation
Signed-off-by: Noah Ing <98993329+noah-ing@users.noreply.github.com>
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
imran-siddique
left a comment
There was a problem hiding this comment.
Verified the dead-code path this reconnects. load_config already did raw.get("catalog", {}) and built a DriftPolicy from it, but _KNOWN_TOP_KEYS omitted catalog, so strict validation rejected the block before the parser ever reached that line. The default worked only because it required no block at all, which means every operator who wrote an explicit catalog: stanza got a config error for a setting the proxy was already enforcing.
The unknown-nested-key guard is the part worth having. test_unknown_catalog_key_raises pins the misspelling case, so drift_polciy: warn_only is a config error rather than a silent fall back to fail_closed while the operator believes they set warn_only. That matches what agent_manifest and kill_switch already do, so the block reads like the rest of the file.
Default unchanged, no change to drift detection or comparison, nothing near the signing or attestation path. Merging.
What
Allow the existing
catalog.drift_policysetting through strict configuration validation, reject unknown keys inside thecatalogblock, and document both supported policies.Why
This is a narrow follow-up to #523 and #58. The parser already consumed
catalog.drift_policyand the proxy already enforced it, but_KNOWN_TOP_KEYSomittedcatalog. Every explicitcatalog:block was therefore rejected before the parser ran; the defaultfail_closedbehavior worked only because it required no block.This reconnects the existing configuration contract without changing drift detection, comparison, or the default policy.
Security impact
None. This does not touch the TEE boundary, signing path, audit chain, capability tokens, or trust-score inputs.
fail_closedremains the default,warn_onlyremains an explicit operator choice, and unknown nested keys are rejected so misspellings cannot silently fall back.Test plan
pytestpasses — 1,179 passed, 6 skippedruff checkpassesmypypasses — 63 source filesbandit -r src/ -c pyproject.tomlpassesmkdocs build --strictpassesManual test: on the parent commit, loading YAML with
catalog.drift_policy: warn_onlyraisesConfigError: Unknown config key 'catalog'. With this change, it loads asDriftPolicy.WARN_ONLY. The suite also covers the omitted default, invalid enum, non-mapping block, and unknown nested key.DCO sign-off