feat(phase-2): NVIDIA NRAS post-attestation appraisal client - #262
Merged
Merged
Conversation
…125) - Add src/cmcp_gateway/tee/nras.py: NRASClient, AppraisalResult, NRASAuthError, NRASAppraisalError, NRASError, and try_appraise() convenience wrapper - Endpoint: https://nras.nvidia.com/v1/attestation/gpu - Auth: Bearer token from CMCP_NRAS_API_KEY env var - Request: {nonce: base64, attestation_report: base64} - Response parsed to AppraisalResult (status, verifier, timestamp, ear_raw) - Missing CMCP_NRAS_API_KEY or any NRAS failure is non-fatal: logs WARNING, returns None -- gateway startup is never blocked - Wire try_appraise() into run_startup() after get_attestation_report(); result stored as GatewayContext.nras_appraisal (None by default) - 21 tests covering affirming/warning/contraindicated happy paths, 401 auth failure, 4xx appraisal rejection, timeout, non-JSON response, and warning logging; all mocked with httpx.MockTransport (no real HTTP calls) - Phase 2 / v0.2 marker in all docstrings per issue spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
imran-siddique
force-pushed
the
feat/phase2-nras-client
branch
from
June 8, 2026 20:53
5619b2f to
fabf495
Compare
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
src/cmcp_gateway/tee/nras.pywithNRASClient,AppraisalResult,NRASAuthError,NRASAppraisalError, andtry_appraise()— the complete Phase 2 / v0.2 NRAS integration per issue [phase-2] NVIDIA NRAS integration — post-attestation appraisal via NVIDIA Remote Attestation Service #125NRASClient.appraise()POSTs{nonce, attestation_report}tohttps://nras.nvidia.com/v1/attestation/gpuwith Bearer auth, parses the EAR JSON, and returns anAppraisalResultwithstatus,verifier,timestamp,ear_rawtry_appraise()is the non-fatal startup wrapper: ifCMCP_NRAS_API_KEYis unset or the call fails, it logs a WARNING and returnsNone— gateway startup is never blockedGatewayContextgains anras_appraisal: AppraisalResult | Nonefield (defaultsNone);run_startup()callstry_appraise()after attestation completeshttpx.MockTransportcover affirming / warning / contraindicated happy paths, 401 auth failure, 4xx appraisal rejection, timeout, non-JSON response, and warning-log assertions — zero real HTTP callsCloses #125
Test plan
pytest tests/unit/test_nras_client.py -v— 21/21 passpytest tests/unit/test_startup.py -v— all pass (GatewayContext.nras_appraisal field present)ruff check src/cmcp_gateway/tee/nras.py tests/unit/test_nras_client.py src/cmcp_gateway/startup.py— cleanCMCP_NRAS_API_KEY=(empty) and verify startup log containsCMCP_NRAS_API_KEY is not setwarningGenerated with Claude Code