UID2-6717: validate operator key against core service before enclave startup#2477
Open
UID2-6717: validate operator key against core service before enclave startup#2477
Conversation
…startup
Adds a pre-flight POST to `{core_base_url}/attest` with the operator key in
the Authorization header. The core service returns 401 before inspecting the
attestation payload for any unrecognised key, so a 401 here unambiguously
means the key is wrong. Any other response (400 for missing payload, 5xx,
timeout) is logged and does not block startup, keeping the change safe to
roll out without new failure modes.
This catches subtle transcription errors (e.g. I vs l) that pass the existing
regex and environment-alignment checks but are rejected at attestation time,
saving operators from a confusing failure deep inside a running enclave.
Adds unit tests covering: 401 rejection, 400 pass-through, 200 pass-through,
connection error, timeout, unexpected exception, and endpoint URL/header
correctness.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…th_core_service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
OperatorKeyRejectedError(E07) toconfidential_compute.py— a new startup error class for when the core service explicitly rejects the operator key.validate_operator_key_with_service()called at the end ofvalidate_configuration(), after the existing connectivity check. It POSTs to{core_base_url}/attestwithAuthorization: Bearer {operator_key}and no attestation payload. The core service authenticates the key before touching the payload, so a 401 → invalid key / 400 → valid key distinction is reliable and stable.scripts/tests/test_confidential_compute.pycovering all relevant code paths.Background
Private operators can misconfigure their key by copying it incorrectly (e.g.
Ivsl). The existing validations (regex format + env alignment + network connectivity) pass for such keys; the failure only surfaces asAttestationFailure: invalid operator keyinside the running enclave, which is hard to diagnose. See UID2-6717 and the originating Slack thread.How it works
E07: OperatorKeyRejectedError, abort startupTest plan
python3 -m pytest scripts/tests/test_confidential_compute.py -v— all 9 tests pass🤖 Generated with Claude Code