Skip to content

fix: accept NEAR AI's current OS measurements for nearcloud and neardirect - #233

Open
amiller wants to merge 1 commit into
13rac1:mainfrom
amiller:near-ai-os-2026-11
Open

amiller wants to merge 1 commit into
13rac1:mainfrom
amiller:near-ai-os-2026-11

Conversation

@amiller

@amiller amiller commented Nov 14, 2026

Copy link
Copy Markdown

Problem

NEAR AI's live quotes carry TDX measurements that internal/provider/nearcloud/policy.go and internal/provider/neardirect/policy.go do not allow, so the boot-config factors cannot pass for NEAR AI today. Read from a fresh /v1/attestation/report on 2026-11-14 (all quotes UpToDate under @phala/dcap-qvl), and first seen 2026-11-04:

CVM os_image_hash Register Value In main?
model (DeepSeek-V4.1-Flash-1017, both instances) 91fd5d69… RTMR1 4ae609807c765916… no
model RTMR2 bd67ab7554dc27ab… no
model MRTD, RTMR0 df4d77c8…, bc122d14… yes
nearcloud gateway 8db40cb2… MRTD 7fe60787222bd394… no
gateway RTMR0 d090162bff4b1d1d… no
gateway RTMR1 4ae609807c765916… no
gateway RTMR2 764489f277a85401… no

Change

  • nearcloud.DefaultMeasurementPolicy and neardirect.DefaultMeasurementPolicy: add the model RTMR1 and RTMR2 above.
  • nearcloud.DefaultGatewayMeasurementPolicy: add the gateway MRTD, RTMR0, RTMR1 and RTMR2 above.
  • Regression tests in both policy_test.go files that fail on main and pass with this change.

Effect

teep verify nearcloud and neardirect accept NEAR AI's current OS images. The earlier values stay allowed; nothing else changes. These are observed values: I did not trace 91fd5d69… / 8db40cb2… to a dstack release, so the comments name the os_image_hash and the date seen.

To verify

go test ./internal/provider/nearcloud/ ./internal/provider/neardirect/ -run OS2026_11 -v
# --- PASS: TestDefaultMeasurementPolicyAcceptsNEARAIModelOS2026_11 (both packages)
# --- PASS: TestDefaultGatewayMeasurementPolicyAcceptsNEARAIGatewayOS2026_11
git stash -- internal/provider/*/policy.go && go test ./internal/provider/nearcloud/ ./internal/provider/neardirect/ -run OS2026_11
# --- FAIL for the same three tests on main
make report-nearcloud   # needs NEARAI_API_KEY; not run here

Point of discussion

Should the gateway RTMR0 (d090162b…) be accepted as a second hardware config, the way the model policy keeps two RTMR0 values? I added it next to the existing one.

Checklist

  • I added unit tests for new code and regression tests for fixed bugs.
  • make check passes. gofmt, go vet and the two packages' tests pass; golangci-lint was not available on this machine.
  • For a major feature: make integration and make reports pass. Not run: no NEARAI_API_KEY on this machine.
  • I updated the documentation that this change affects. None found that lists these values.

Found while porting teep's nearcloud policy to a browser verifier in https://github.com/amiller/abalone (web/near-policy.mjs).

…irect

Live NEAR AI quotes since 2026-11-04 carry measurements the policies lack:
model CVMs (os_image_hash 91fd5d69...) RTMR1 4ae60980... and RTMR2 bd67ab75...;
the nearcloud gateway (os_image_hash 8db40cb2...) MRTD 7fe60787..., RTMR0 d090162b...,
RTMR1 4ae60980... and RTMR2 764489f2.... Add them, with regression tests.
@ai-13rac1

Copy link
Copy Markdown
Contributor

Summary

The six values are the ones NEAR AI serves today. I checked them against attestation reports captured on 2026-11-14:

  • Model CVMs (nearcloud and neardirect, os_image_hash 91fd5d69…): MRTD df4d77c8… and RTMR0 bc122d14…, both already allowed. The new values are RTMR1 4ae60980… and RTMR2 bd67ab75….
  • nearcloud gateway (os_image_hash 8db40cb2…): MRTD 7fe60787…, RTMR0 d090162b…, RTMR1 4ae60980… and RTMR2 764489f2….

The change is not ready to merge, for three reasons. Each new value comes only from live quotes, while the allowlist is a trust anchor. The change contradicts a documented rule for these registers. And it breaks an existing test.

Findings

1. TestIntegration_NearCloud_Fixture fails

With the gateway MRTD 7fe60787… added to DefaultGatewayMeasurementPolicy (internal/provider/nearcloud/policy.go:42), gateway_tee_measurement passes on the captured fixture. The test requires an allowed Fail:

go test ./internal/integration -run TestIntegration_NearCloud_Fixture
nearcloud_test.go:167: factor gateway_tee_measurement: got PASS enforced=false, want an allowed Fail

The test passes on main. go test ./internal/provider/nearcloud ./internal/provider/neardirect ./internal/attestation ./internal/defaults passes on this branch.

2. The values have no source other than the quotes

docs/measurement_allowlists.md ("Observed values are not proofs") says an observed value detects drift but is not proof. It asks for MRTD and RTMR1 to be reproduced from source with dstack-mr measure, or for the provider to publish the values.

The comments in the change say only "in live NEAR AI quotes since 2026-11-04". The change does not name a dstack release, a meta-dstack build or a NEAR AI publication for 91fd5d69…, 8db40cb2… or any of the six values.

Today tee_boot_config, tee_hardware_config and the gateway measurement factors are allowed to fail for NEAR. They report the mismatch and do not block. With this change they pass. A report would then show the boot chain as matching a known image, with no published image behind the value.

3. It contradicts the rule for dstack-nvidia-0.5.12

The captured vm_config names os_image_hash 91fd5d69… as dstack-nvidia-0.5.12, and 8db40cb2… as dstack-0.5.12 (internal/integration/testdata/current/nearcloud_gateway/responses/0001_*.body). The model MRTD df4d77c8… is listed as dstack-nvidia-0.5.11 and 0.5.12 (docs/measurement_allowlists.md:243-247). The same document says (lines 249-251):

For dstack-nvidia-0.5.12, RTMR1 and RTMR2 are not allowed until they are computed with mk-image-mr from meta-dstack on the release files: no published value exists for the nvidia image.

So 4ae60980… and bd67ab75… are the values that this rule keeps out until they are computed. The change does not show that computation, and it does not change the rule.

4. The gateway MRTD was a recorded, allowed failure

internal/attestation/report.go:477-482 records the NEAR Cloud gateway MRTD 7fe60787… as a known failure. It stays allowed "until teep verifies an allowlist update without a release". report.go:766-772 records the same MRTD for the private-ai-gateway that Venice, Phala Cloud and NanoGPT reach.

The change allows this MRTD for nearcloud only. The comment at report.go:477-482 and the paragraph at docs/providers/near/near_attestation.md:274-277 become stale. The same gateway MRTD stays a failure for the other three providers. The change should also state whether 8db40cb2… is the production dstack-0.5.12 image and not a dstack-dev-* image, which would allow operator login. The MRTD is a firmware measurement. It should be traced to its release (the dstack MRTD table at docs/measurement_allowlists.md:241-247 has no entry for it). It should then apply to every gateway policy that sees it, with that table updated.

5. Tests

The new tests (internal/provider/nearcloud/policy_test.go:108-138, internal/provider/neardirect/policy_test.go:68-80) only check that each value is in a map. They do not run a captured quote through the boot-configuration checks, so they did not catch finding 1.

The allowlists check each register on its own. Each new value is therefore accepted together with any other allowed value of the other registers, for example the new RTMR1 with an older image's RTMR2. Values tied to one image as one row would avoid combinations that no image produces. This design is older than this change, but each added value widens it.

6. Documentation

The change does not update docs/measurement_allowlists.md: the MRTD table and the source of each new RTMR value. The repository asks for the allowlists and that document to change together.

Recommendation

Do not merge as it stands. To make it mergeable:

  • Name the dstack release, or the NEAR AI publication, for each value, and show that MRTD, RTMR1 and RTMR2 reproduce from it (dstack-mr measure or mk-image-mr). RTMR0 and the gateway RTMR2 depend on the deployment class; for those, state the hardware parameters used.
  • Update TestIntegration_NearCloud_Fixture, the comments at report.go:477-482 and near_attestation.md:274-277, and decide the same MRTD for the other gateway policies.
  • Add the values and their sources to docs/measurement_allowlists.md.

Until then, the mismatches stay visible as allowed failures, which is the current, correct report.

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.

2 participants