Repository navigation
Conversation
Leechael
marked this pull request as ready for review
November 10, 2026 15:37
3 tasks
Leechael
force-pushed
the
feat/dstack-verifier-wasm
branch
from
November 11, 2026 14:08
b89de51 to
81cca86
Compare
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Signed-off-by: Leechael Yim <yanleech@gmail.com>
Leechael
force-pushed
the
feat/dstack-verifier-wasm
branch
from
November 11, 2026 16:13
81cca86 to
0192c42
Compare
Playwright --with-deps on ubuntu-latest (26.04) fails resolving apt mirrors. Signed-off-by: Leechael Yim <yanleech@gmail.com>
- Return Result<()> from verify_tdx_lite_os: TdxLiteOsCheck only echoed vm_config.os_image_hash and an always-true acpi_tables_verified. - Make dstack_mr::tdx::assert_tdx_mrs_eq public and drop the identical copy in dstack-verifier. - Drop the now-unused cc-eventlog dependency from dstack-verifier. - Drop the unused PartialEq/Eq derive on TdxRtmr0AcpiHashes. - Read fixture MRs with dcap-qvl in tests instead of hand-coded quote offsets, and share one payload builder in the wasm crate tests. - Lowercase a carried-over error context message. Signed-off-by: Kevin Wang <wy721@qq.com>
This branch has not been deployed
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.
Problem
An external JS/TS verifier (Node, Electron main, Bun) needs to check a dstack 0.6.x TDX CVM's OS locally, with no hosted service. It already verifies the DCAP quote and replays RTMR3. What it cannot do itself is dstack's lite OS check:
vm_config.tdx_measurementagainstos_image_hash, regenerate the three RTMR0 ACPI digests fromvm_config(they depend on QEMU version/settings, vCPU, memory, NICs, verity volumes, GPU/NUMA layout), recompute MRTD/RTMR0-2, and compare with the quote.dstack-verifierdoes that check today, but it does not build for wasm32 (tokio, reqwest, tempfile, tar, getrandom). A static table or allowlist does not scale.Fix
Extract the lite check out of the verifier's
&selfmethod into a pure function indstack-mr, and havedstack-verifiercall it. No duplicated logic.Why
dstack-mrrather than a new crate. This is the same split asdstack_mr::sev::verify_sev_launch: measurement math lives indstack-mr, the service only supplies already-verified MRs.expected_rtmr0_acpi_hashesandtdx_measurements_from_measurement_documentalready live here. The function adds acc-eventlogdependency to parse named RTMR0 ACPI DATA events; that crate already builds for wasm32. A new glue crate would only wrap ~100 lines.Public API:
It does not judge os_image_hash approval, DCAP, or RTMR3.
On top of that function:
dstack-verifier-wasm: wasm32 cdylib, JSON in/out, zero imports, no wasm-bindgen.@phala/dstack-verifier-wasm: ESM, Node>=20.19, wasm bytes embedded in the JS module, synchronous lazy instantiation,.d.ts. Never throws: a trap is caught, the instance recreated,{ ok: false }returned. Published as 0.1.0-beta.0 (see Published below).On an MR mismatch, dstack-verifier's HTTP
details.acpi_tables_verifiedis nowfalse(previouslytrueafter the ACPI compare and before the MR compare).is_validis unchanged (still false). JSosImageHashis non-null only whenokis true.JS contract (
osImageHashonly whenok; noacpiTablesVerified):MRs are hex (any case).
eventLogandvmConfigare the GetQuote strings verbatim.Verification
cargo test -p dstack-mr tdx_lite: publictdx-lite-getquote.jsonfixture accepted; memory_size, pci_hole64_size, hotplug_off, num_nics, cpu_count, qemu_version, an ACPI digest, and RTMR2 tampers rejected.cargo test -p dstack-verifier tdx_liteandverifies_real: existing lite fixtures still pass, no image download.cargo clippy -p dstack-mr -p dstack-verifier -p dstack-verifier-wasmand--target wasm32-unknown-unknownfor the wasm crate.wasm32-unknown-unknown),opt-level=z, LTO,panic=abort: 466832 bytes raw, 174830 gzip.WebAssembly.Module.importsis empty.Runtime coverage is in
.github/workflows/verifier-wasm.yml:ELECTRON_RUN_AS_NODEplus a real main-process app), and Chromium/Firefox/WebKit via Playwright (page main thread and a module worker), when the PR has labelverifier-wasm-runtimes, onworkflow_dispatch(runtimes, default true), and on pushes tonext/ release tags.Not verified locally: Electron itself, browsers (those run in CI when the label is set).
qemu-user cannot run the x86_64 rustc 1.92.0 (SIGSEGV even with RUST_MIN_STACK=16MiB); wasm verification is linux/amd64 native or an x86_64 VM, not emulated amd64 on arm64.
Published
@phala/dstack-verifier-wasm@0.1.0-beta.0was published by hand from commit7f466e2f4cdd0094e47c1dff264cd13ef3839114, using theverifier-wasm-bytesartifact of run 42871855257. Decoded wasm sha256f25a714e3d7e8febcf0bbfe1629e4801ef273f81034a675750bb98b6e9175c71;wasm-bytes.jssha256515018bc79a5609533a41685aea665a12902905a31b632ceb491a2bbb3a7b1b1. Manual publish, no provenance. The next release must be0.1.0-beta.1or later. Do not push tagverifier-wasm-v0.1.0-beta.0: the release workflow would try to publish a version that already exists.Releasing
The package exists on npm. A maintainer configures trusted publishing on npmjs.com for
@phala/dstack-verifier-wasm:Dstack-TEEdstackverifier-wasm-release.ymlOptionally disallow token publishing on that package afterwards. Then: merge, bump
sdk/verifier-wasm/package.jsonto a version that is not already on npm (0.1.0-beta.1or later), push tagverifier-wasm-v<version>.