Repository navigation
fix(tee): exclude the operator token from the gateway measurement - #768
imran-siddique merged 1 commit into
Conversation
_CONFIG_SECRET_KEYS held only bearer_token, so CMCP_OPERATOR_TOKEN fed the configuration digest. Rotating the operator credential changed the gateway digest, a digest over the secret reached the measurement index and the report nonce, and a verifier recomputing an expected digest needed the production token. The spec already says the configuration is measured with secrets excluded. Add operator_token to the exclusion set. Test that setting or rotating each excluded field of the real Config leaves the digest unchanged, and guard that every credential-named field of Config, nested ones included, is in the set so the next one cannot be missed. Signed-off-by: Yatsuiii <battyrises@gmail.com>
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
rajnisht7
left a comment
There was a problem hiding this comment.
the changes looks good, operator_token was correctly missing from _CONFIG_SECRET_KEYS since #629, rotating it was changing the gateway digest, which shouldn't happen, and the new tests properly guard against the same miss happening again with future credential fields. Matches the security model.
dinakarjs
left a comment
There was a problem hiding this comment.
Independent approval of the bounded measurement correction at ffcb490. No blocking defect found in this three-file change. It excludes operator_token alongside bearer_token; it does not implement TPM sealing or establish hardware resistance.
Linux/Python 3.12 with imports resolving to this checkout: measurement module 45 passed; full unit/conformance selection 2,450 passed, 6 skipped. The first broad run had 9 transport/soak failures from inherited SOCKS proxy settings; the complete rerun with proxy variables unset passed. Ruff passes on the changed Python files and mypy passes measurement.py. Diff whitespace passes. No native TPM operations were performed.
Independent real-Config controls: None, empty, synthetic-A and synthetic-B values for each excluded token yield the same config digest; both names are absent from the reduced payload. Changing dev_mode, listen_addr, policy_bundle_path or catalog_path changes the digest, preserving non-secret configuration sensitivity.
Load-bearing control: temporarily remove only operator_token from the exclusion set. The measurement suite fails its credential-inventory regression (1 failed, 43 passed); a separate Config(operator_token='a') versus Config(operator_token='b') digest-equality assertion also fails. Restored source returns 45/45, clean worktree. The parametrized rotation test enumerates the exclusion set, so that separate inventory test is essential when a credential is accidentally omitted.
The changelog appropriately describes a one-time digest transition and rotation advice. The field-name heuristic catches the documented usual credential spellings; it is not exhaustive secret discovery. Approval applies to source behavior and these software controls, not #462 sealing, live attestation or the wider hardware acceptance tracker.
imran-siddique
left a comment
There was a problem hiding this comment.
Checked ffcb490. On main, config_digest(Config(operator_token="a")) and "b" differ, and on this head they match, so rotating the operator token no longer moves the gateway measurement or the report nonce. The measurement tests pass 45 of 45; dropping operator_token from _CONFIG_SECRET_KEYS fails the credential-name test. The one-time digest change on upgrade is in the changelog, which is what a verifier pinning expected_gateway_measurement needs.
tee/ is a security path, so this needs a second approval. @rajnisht7, could you review it by Monday 19 October?
|
@imran-siddique already approved this head earlier today. Re-ran the gate job and it’s green now |
What
CMCP_OPERATOR_TOKENis no longer part of the measured configuration._CONFIG_SECRET_KEYSintee/measurement.pynow holdsbearer_tokenandoperator_token.Why
This is the precondition named in the #462 design comment, sent on its own first.
operator_tokenwas added toConfigin #629 without being added to_CONFIG_SECRET_KEYS, so since v0.6.0 it has fed the config component of the gateway measurement. Rotating the operator credential changes the gateway digest. With the realload_configandgateway_measurementoverexamples/bfsi-demo, two operator tokens give config components8c9e31da...andde8e9475...on main, and different gateway digests. On this branch both are identical.That is out of line with
docs/spec/tpm-security-model.md, which says the resolved configuration is measured with secrets excluded. It also means a verifier that recomputes the expected digest, asattestation.mdsection 3.3.2 describes, needs the production operator token to do it. For #462, a sealed key would refuse to unseal after every token rotation.Refs #462.
Security impact
bearer_tokenis excluded. The changelog entry, under Security, tells such deployments to rotate the token after upgrading."operator_token": null. A verifier pinningexpected_gateway_measurementrecomputes it on upgrade, as it already must on any release that changes the code digest. Thev1prefix is unchanged, as it was when feat(session): implement the monotonic session boundary the spec describes #629 addedsession_state_pathandoperator_tokento the payload.Test plan
pytestpasses: 2548 passed, 37 skipped, on a host with no TPM visible to the tests, as on a CI runnerruff check src/ tests/passesmypy src/cmcp_runtime/passesNew tests in
tests/unit/test_gateway_measurement.py, both against the realConfig:test_every_credential_field_of_the_real_config_is_excluded: every field ofConfigand its nested config dataclasses whose name ends intoken,secret,passwordorapi_keymust be in the exclusion set, so the next credential field cannot be missed the way this one was. Fails on main.test_config_digest_ignores_each_excluded_field_of_the_real_config, parametrized over the exclusion set: setting or rotating each field leaves the digest unchanged.Manual: the
load_configandgateway_measurementcomparison above, run on main and on this branch with the same two operator tokens.DCO sign-off
Developer Certificate of Origin (https://developercertificate.org).