Skip to content

feat(phase-2): NVIDIA NRAS post-attestation appraisal client - #262

Merged
imran-siddique merged 2 commits into
mainfrom
feat/phase2-nras-client
Jun 8, 2026
Merged

imran-siddique merged 2 commits into
mainfrom
feat/phase2-nras-client

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Summary

  • Adds src/cmcp_gateway/tee/nras.py with NRASClient, AppraisalResult, NRASAuthError, NRASAppraisalError, and try_appraise() — the complete Phase 2 / v0.2 NRAS integration per issue [phase-2] NVIDIA NRAS integration — post-attestation appraisal via NVIDIA Remote Attestation Service #125
  • NRASClient.appraise() POSTs {nonce, attestation_report} to https://nras.nvidia.com/v1/attestation/gpu with Bearer auth, parses the EAR JSON, and returns an AppraisalResult with status, verifier, timestamp, ear_raw
  • try_appraise() is the non-fatal startup wrapper: if CMCP_NRAS_API_KEY is unset or the call fails, it logs a WARNING and returns None — gateway startup is never blocked
  • GatewayContext gains a nras_appraisal: AppraisalResult | None field (defaults None); run_startup() calls try_appraise() after attestation completes
  • 21 tests using httpx.MockTransport cover affirming / warning / contraindicated happy paths, 401 auth failure, 4xx appraisal rejection, timeout, non-JSON response, and warning-log assertions — zero real HTTP calls

Closes #125

Test plan

  • pytest tests/unit/test_nras_client.py -v — 21/21 pass
  • pytest 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 — clean
  • Set CMCP_NRAS_API_KEY= (empty) and verify startup log contains CMCP_NRAS_API_KEY is not set warning

Generated with Claude Code

…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
imran-siddique force-pushed the feat/phase2-nras-client branch from 5619b2f to fabf495 Compare June 8, 2026 20:53
@imran-siddique
imran-siddique merged commit e4b9fd4 into main Jun 8, 2026
8 checks passed
@imran-siddique
imran-siddique deleted the feat/phase2-nras-client branch July 29, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[phase-2] NVIDIA NRAS integration — post-attestation appraisal via NVIDIA Remote Attestation Service

1 participant