Repository navigation
Conversation
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
noah-ing
left a comment
There was a problem hiding this comment.
Reviewed exact head 6139bddaf1c68392f17947cffb5f55be0f485edf. The 31 focused tests, touched-file Ruff and module mypy checks pass locally. Synthetic negative controls found two remaining contract gaps:
- The new endpoint check accepts
http://. With a synthetic key and mock transport,_postsends theAuthorization: Bearerheader to that HTTP URL. #814 requires HTTPS with a host. Please reject non-HTTPS and hostless URLs before making a request. - A valid JSON object whose EAR
statusis[]or{}raises an uncaughtTypeErrorin_parse_ear;try_appraisepropagates it instead of returning a controlled non-fatal failure. A whitespace-onlyCMCP_NRAS_API_KEYlikewise raisesValueErrorduring client construction outside the startup error handler. Please type-check status, handle invalid client configuration at the call site, and add regressions for both paths.
One contract detail needs reconciliation: #814 says 64 hex characters for report_data, while the providers emit a 64-byte nonce as 128 hex characters. Please define and test the provider-compatible length rather than enforcing the issue wording blindly; the current validator accepts a two-character value. The substantive hosted CI suite has not run on this head. I am requesting these focused changes before approval.
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed exact head 6139bddaf1c68392f17947cffb5f55be0f485edf in an isolated checkout.
Independent mocked controls confirm the current-head findings that still need correction:
- The constructor accepts an HTTP endpoint and a hostless HTTPS URL. Issue #814 requires HTTPS with a hostname; validate both before constructing a request.
- EAR status=[] or status={} escapes as TypeError, including through try_appraise. A whitespace-only API-key environment value escapes as ValueError during construction outside its error handler. Please preserve try_appraise's documented non-fatal contract for both invalid configuration and malformed EAR types.
- A one-byte report_data value is accepted. Reconcile and test the intended nonce length with the providers' actual report-data format; the issue's character-count wording should not override the provider-compatible byte length.
The valid HTTPS/normal-status control passes, and all additional requests used an in-process mock transport with a synthetic key. No live NRAS call was made. The ordinary suite passes (2,535 passed, 20 skipped); pip check, Ruff, mypy, configured Bandit, sign-offs and diff whitespace checks also pass. Those checks do not cover these remaining contract gaps. Requesting the focused repair before approval.
Reviewed with OpenAI Codex.
|
Thank you @noah-ing and @carloshvp! Addressed all points in
|
6139bdd to
6c2c2ea
Compare
noah-ing
left a comment
There was a problem hiding this comment.
Reviewed exact head 6c2c2ea34f21a24fd415ea69b045493c5b026fd8. The HTTPS/hostname checks, controlled handling of malformed EAR statuses and blank API keys, and provider-compatible report_data length checks address my prior requests. Positive and malformed cases passed with a synthetic key and mock transport; no live NRAS call was made.
Locally, the 42 focused tests and full unit suite passed (2,555 passed, 20 skipped); touched-file Ruff and module mypy also passed. I have no further changes requested on these paths and approve this scope. The fork's substantive hosted workflows currently require authorization to run, so this review does not claim a hosted CI pass.
dinakarjs
left a comment
There was a problem hiding this comment.
Current-head follow-up at 6c2c2ea. The source contains the HTTPS/hostname, EAR-status shape, blank API-key and supported nonce-length corrections requested in prior reviews. I ran tests/unit/test_nras_client.py from this checkout: 42 passed in Python 3.12.14 using the current-main hash-locked cMCP review environment. These are synthetic/mock transport controls; I made no live NRAS request. Noah has already approved this exact scope/head. No additional blocking defect found in this focused follow-up; I am leaving COMMENT rather than asserting a fresh full-suite or independent hardware/hosted acceptance.
carloshvp
left a comment
There was a problem hiding this comment.
Reviewed current head 6c2c2ea34f21a24fd415ea69b045493c5b026fd8 in an isolated checkout.
The HTTPS/hostname, controlled EAR status/configuration errors and provider-compatible nonce-length repairs resolve my earlier requests. The 42 focused cases and the full unit/conformance selection pass (2613 passed, 20 skipped); Ruff, mypy, Bandit, dependency consistency, sign-offs and whitespace checks pass.
One strict numeric boundary remains. With a synthetic key and httpx.MockTransport, an ordinary affirming EAR passes, literal NaN is refused, but {"status":"affirming","score":1e1000} and the equivalent nested -1e1000 return an affirming result whose retained ear_raw contains infinity. parse_constant does not intercept exponent overflow. Please add a finite parse_float hook, with top-level and nested regressions through appraise and controlled try_appraise failure. This is a strict-input/retained-evidence gap; I did not demonstrate a signature or hardware-attestation bypass and made no live NRAS call.
Reviewed with OpenAI Codex.
| parsed = json.loads( | ||
| response.text, | ||
| object_pairs_hook=_no_duplicate_keys, | ||
| parse_constant=_no_nonfinite, |
There was a problem hiding this comment.
[P2] Reject exponent-overflow numbers in EAR JSON. parse_constant catches literal NaN/Infinity, but 1e1000 becomes float("inf") without calling that hook. A mocked appraise still returns an affirming result and retains that value in ear_raw, including when nested. Add a finite parse_float hook and paired finite/top-level/nested regression cases.
|
@drk-ram @carloshvp Prepared the narrow finite-EAR correction on top of current 6c2c2ea, preserving its history: dinakarjs#10 (commit 61c9975). The finite parse_float hook closes the reported top-level/nested exponent-overflow gap through appraise and controlled try_appraise failure. 53 focused tests pass; removing the hook fails eight new rejection cases while three finite controls pass. Full unit suite: 2580 passed, 6 skipped; Ruff, strict mypy, configured Bandit and pip check pass. Exact environment prerequisites/limits are in the companion. Please adopt and obtain independent current-head review; no live NRAS/hardware claim or self-approval. Prepared with OpenAI Codex. |
6c2c2ea to
e4cc625
Compare
|
Thank you @carloshvp! Rebased onto
|
There was a problem hiding this comment.
Reviewed commit e4cc625ee0aa70cf19c670320653fc1dc4d5823c.
The parse_float hook now rejects both signs of exponent overflow, including nested EAR fields, while preserving finite exponent values. The public appraise path raises NRASError and try_appraise returns a controlled failure. This resolves my previous overflow change request.
Focused tests: 55 passed; repository Ruff, mypy and configured Bandit pass. This is software verifier/parser evidence. Required hosted checks and the independent security review requirement remain in force.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
e4cc625 to
cc727f1
Compare
noah-ing
left a comment
There was a problem hiding this comment.
Re-reviewed current head cc727f198366ad4c4e89b0a0a82ea0699ac70e59, including the exponent-overflow correction made after my earlier approval. The production NRAS module is byte-identical to Carlos’s reviewed fix. All 56 focused tests passed in a hash-locked Python 3.12 environment. Independent synthetic HTTP controls accepted a finite EAR value and rejected non-finite top-level and nested exponent values; the earlier head accepted those malformed responses. Ruff, mypy, dependency consistency, and the exact-head hosted Linux/Windows matrix, fuzz, CodeQL, governance, and Docker/signing checks pass. I approve the technical fix. Please remove the extra end-of-file blank line in tests/unit/test_nras_client.py as a minor cleanup; the independent maintainer gate remains separate. This review did not exercise a live NRAS service or hardware.
carloshvp
left a comment
There was a problem hiding this comment.
The rebased client preserves the reviewed EAR parsing and configuration checks. The new test also covers the requirement that the EAR payload be a JSON object. I ran 56 NRAS client tests locally. No live attestation service was involved.
There was a problem hiding this comment.
Reviewed the head cc727f1, a few things needs to be addressed:
- endpoint validation is incomplete, urlsplit + scheme/hostname check accepts invalid ports,"https://example.com:invalid/v1" and "https://nras.nvidia.com:not-a-port/v1" pass init, but later httpx.Request raises httpx.InvalidURL, InvalidURL does not inherit from httpx.HTTPError or ValueError, so it escapes the handlers in appraise() instead of becoming a controlled NRASError / ValueError.
Out-of-range ports (:99999, :65536) have the same problem
kindly validate the port (and preferably use httpx.URL) during init and add tests for non-numeric + out-of-range ports - Huge integer timeout can raise OverflowError, math.isfinite(10**1000) raises OverflowError: int too large to convert to float instead of the promised ValueError, kindly catch the conversion overflow and reject with ValueError
- report_data length, All production nonce paths (make_nonce / audit-bound / measurement-bound) produce a 64-byte nonce and emit nonce.hex() -> 128 hex chars. Accepting 64 hex chars (32 bytes) has no current provider justification
nits:
- Extra blank line at the end of tests/unit/test_nras_client.py(already asked by Noah)
noah-ing
left a comment
There was a problem hiding this comment.
Re-reviewed the same exact head cc727f198366ad4c4e89b0a0a82ea0699ac70e59 that I approved on November 20, after the newer endpoint/timeout findings. All 56 focused NRAS tests still pass locally, but two synthetic negative controls violate the documented error boundary:
NRASClient(api_key="synthetic", endpoint="https://example.com:not-a-port/v1")passes initialization.appraisethen raiseshttpx.InvalidURL, which is neitherNRASErrornor caught by thehttpx.HTTPErrorhandler. A malformed configured endpoint therefore escapes the controlled appraisal path.NRASClient(api_key="synthetic", timeout=10**1000)raisesOverflowErrorfrommath.isfiniterather than the promisedValueError.
Please validate the URL port at initialization and reject numeric conversion overflow as ValueError, with regressions for both paths. Please also reconcile the accepted 64-character report_data form with the current producers' 128-character nonce form. This changes my earlier approval on this head; I did not call a live NRAS service.
… 128-char report_data nonce, string EAR status, and finite EAR JSON numbers (agentrust-io#814) - Parse the endpoint with httpx.URL in NRASClient.__init__ and require HTTPS, a hostname and a port in 1-65535, so a malformed endpoint such as https://example.com:not-a-port/v1 raises ValueError at construction instead of httpx.InvalidURL at appraise time. An InvalidURL raised by an injected transport is also reported as NRASError. - Validate timeout with a chained comparison (0 < timeout <= 3600) instead of math.isfinite, so NaN, infinity and oversized ints such as 10**1000 raise ValueError rather than OverflowError, and no value that overflows a socket timeout reaches httpx. - Accept only the 128-character lowercase hex form of the 64-byte nonce as report.report_data (docs/spec/attestation.md section 3.3). Every provider emits nonce.hex() of that nonce, so the 64-character form had no producer. - Reject duplicate keys, non-finite constants, and exponent-overflow floats (parse_float with math.isfinite) in _post, and require string EAR status in _parse_ear. - Handle blank/whitespace CMCP_NRAS_API_KEY and invalid client/EAR payloads non-fatally in try_appraise. - Add regressions for malformed and out-of-range ports, oversized timeouts, the 128-character nonce contract and the real-client timeout path, and drop the extra blank line at the end of the test file. Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
cc727f1 to
765ae96
Compare
|
Thanks @noah-ing, both controls reproduce and are fixed in 765ae96 (rebased on current main).
|
noah-ing
left a comment
There was a problem hiding this comment.
Re-reviewed current head 765ae96. The URL parser now rejects malformed and out-of-range endpoint ports at construction; the bounded timeout check rejects oversized integers, NaN, and infinity as ValueError; and transport InvalidURL becomes a controlled NRASError. The report_data rule now matches the providers' 64-byte nonce encoded as 128 lowercase hex characters. I checked those producer paths and ran all 99 focused NRAS tests locally on Python 3.13; they passed. The current-head hosted technical checks also pass. My earlier change requests are resolved, so I approve this scope. I did not call a live NRAS service; independent maintainer approval remains a separate gate.
imran-siddique
left a comment
There was a problem hiding this comment.
Rechecked at 765ae96: the httpx.URL port check, the overflow-safe timeout bound, and the finite-float and duplicate-key hooks on the EAR parse are all in place. Approving as the first roster maintainer.
|
@carloshvp @rajnisht7 this touches tee/, so it needs a second roster approval. Could one of you re-approve at 765ae96 by 2 December? Carlos, your open thread on exponent overflow is covered by _finite_float. |
|
Thank you @imran-siddique, @rajnisht7, and @noah-ing for re-checking and approving 765ae96. |
What
Validate
api_key, the HTTPSendpoint(scheme, hostname and a port in 1-65535) andtimeout(a number greater than 0 and at most 3600, neverbool) inNRASClient.__init__.NRASClient.appraiserequiresreport.report_datato be the 128-character lowercase hex form of the 64-byte attestation nonce and raisesNRASErrorotherwise.NRASClient._postand_parse_earenforce duplicate-key,NaN/Infinity/exponent-overflow and JSON-object validation on EAR responses.Why
Closes #814.
report_datais the 64-byte nonce fromdocs/spec/attestation.mdsection 3.3, and every provider emits it asnonce.hex(), so 128 characters. The 64-character form has no producer and is rejected.Security impact
Prevents duplicate-key status smuggling in NRAS EAR responses (
{"status": "contraindicated", "status": "affirming"}) and keeps every malformed configuration or response inside the controlled appraisal path: a malformed endpoint port, an oversized timeout or a malformedreport_datanow surfaces asValueErrorat construction orNRASErroratappraise, never as an uncaughthttpx.InvalidURL,OverflowError,ValueErrororAttributeErrorfromtry_appraise.Test plan
pytestpasses:python -m pytest tests/unit/test_nras_client.py tests/unit/test_startup.py -q->137 passed(99 intest_nras_client.py)src/cmcp_runtime/tee/nras.py:python -m pytest tests/unit/test_nras_client.py --cov=cmcp_runtime.tee.nras --cov-branch->126 stmts, 32 branches, 0 missedruff checkpasses:ruff check src tests->All checks passed!;ruff format --checkon both touched files -> already formattedmypypasses on the touched module:mypy src/cmcp_runtime/tee/nras.py->Success: no issues found. Whole-projectmypyon a local Python 3.11 reports one error in the untouchedsrc/cmcp_runtime/mcp/proxy.py:479.git diff origin/main...HEAD --check-> cleanNRASClient(api_key="synthetic", endpoint="https://example.com:not-a-port/v1")andNRASClient(api_key="synthetic", timeout=10**1000)now raiseValueErrorat construction; no live NRAS service was called.DCO sign-off
Developer Certificate of Origin (https://developercertificate.org).