Repository navigation
fix(viewer): the wasm import audit reads each import and its shim, and can fail (VW1-21, C6) - #735
Merged
Merged
Conversation
… (VW1-21 canary) A canary for the VW1-21 audit: a module importing `./rvt_bg.js.__wbg_fetch_0` (wasm-bindgen names a binding of fetch `__wbg_fetch_<hash>`), run through the audit's own `wasm-objdump -j Import -x` and quoted pattern. An audit that misses it cannot fail on the real wasm either. Red on draft #734, Deploy viewer run 37379307824 (job 111996809427): ✘ 14 [chromium] › tests/wasm-no-network-imports.spec.ts:57:1 › the import audit flags a module that imports fetch (VW1-21 canary) (11ms) Error: the audit missed the canary's fetch import: canary.wasm: file format wasm 0x1 Section Details: Import[1]: - func[0] sig=0 <./rvt_bg.js.__wbg_fetch_0> <- ./rvt_bg.js.__wbg_fetch_0 expect(received).not.toEqual(expected) // deep equality Expected: not [] 1 failed 20 passed (2.4m) wabt prints an import with no quotes, so the pattern `"(fetch|XMLHttpRequest|WebSocket|EventSource|sendBeacon)"` never matches, and the real-wasm test beside it passed (16ms) whatever the wasm imports.
…d can fail (VW1-21, C6) The audit grepped `wasm-objdump -j Import -x` for `"fetch"` and the like, quoted. wabt prints an import as ` - func[N] sig=M <- module.field`, with no quotes (src/binary-reader-objdump.cc:1607), so no import could ever match: the deploy step, the release step, check-local.sh and the Cursor setup all passed whatever the wasm imported. viewer/scripts/audit-wasm-imports.mjs reads the imports with Node's WebAssembly.Module.imports() (the C6 item: no wabt install) and checks each one twice: its name, which shows a binding of fetch or sendBeacon (`__wbg_fetch_<hash>`), and the body of the shim wasm-bindgen's glue gives it, which is the only place a constructor shows (`new WebSocket` imports as `__wbg_new_<hash>`). The glue's own fetch of the .wasm is in its init function, outside every shim. The audit fails when the wasm or the glue is missing, when an import has no shim it can read, or when its canary (a module importing `__wbg_fetch_0`, `__wbg_new_1` and `__wbg_now_2`) is not flagged as it should be. On the deployed viewer (Pages, rvt_bg-Cn9tN_Wt.wasm and its glue chunk): 52 imports read, none a network primitive, the canary caught; the same glue with one `__wbg_new_` shim edited to `new WebSocket(...)` is flagged. Also in deploy-viewer (C6): the pnpm store cached through setup-node (`cache: pnpm`, keyed on viewer/pnpm-lock.yaml; an explicit `cache` takes precedence over `package-manager-cache`, setup-node src/main.ts:74), the Playwright browsers cached on the Playwright version, and playwright-report/ and test-results/ uploaded when a browser test fails.
…dit script Both tests now read imports with scripts/audit-wasm-imports.mjs instead of wasm-objdump, whose output the old pattern could never match. The existing assertion is kept as it was (`hits` equals `[]`), and so is the canary's (`hits` is not `[]`). The test no longer skips when wabt is missing, since Node is all it needs. It also fails when an import has no shim the audit can read, or when the wasm has no imports at all; either would make the audit vacuous again. Decision (advisor, 2026-10-05): this changes how a pre-existing test reads its input, makes it stricter, and keeps its assertion. Under the standing guidance such a reader change is an engineering call for the advisor rather than one for the maintainer. It is in its own commit.
DrunkOnJava
force-pushed
the
ci/c6-viewer
branch
from
October 18, 2026 08:44
a5aa488 to
b829251
Compare
DrunkOnJava
enabled auto-merge (squash)
October 18, 2026 08:44
3 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Oct 18, 2026
The README had drifted from main and from the documents it summarises. Corrected against the sources each statement depends on: - Release support: Revit 2026 element records are experimental on main (support matrix, RE-124), while two later summaries still said "not yet", and 2023 has typed elements since 0.4.0, while one summary said to treat everything but 2024 and 2025 as scaffold. Each statement now names its release and status; docs/supported-profile.md's 2026 row and docs/status.md's summary say the same. - The browser viewer is built from main (deploy-viewer.yml), not from 0.4.0, and the WebAssembly bindings are the rvt-wasm crate built with `wasm-pack build rvt-wasm ...`, not a `wasm` feature of the root crate. - Privacy: the README and docs/viewer-privacy-posture.md say what each check covers (the wasm import audit repaired in #735, the Playwright no-network test on Einhoven, the Content-Security-Policy) and that they are checks, not a proof; the posture document no longer speaks of the viewer as planned. - Capability summaries: field-type classification is all but 9 to 12 fields per release since #410 (the library table and CONTRIBUTING still said 100%); the walker does use the 7 MVP_TYPED_CLASSES decoders; the ElemTable and IFC rows of the reverse-engineering table describe today's layout and status; Q4 is answered by RE-146, which also corrects the HostObjAttr tag example (the tag a class record carries is its base's). - What main adds since 0.4.0 is summarised from CHANGELOG [Unreleased]; the README listed one item. - A short "Start here" table routes readers to the viewer, install, Python, input support, the library and contribution before the measured tables, which keep their depth. Headings go H1 then H2. - Scope and tone: the April 2026 probe count, class-record count and timing are dated or replaced; quotations disparaging another exporter, novelty claims and a guess about an Autodesk workstation are removed; the UUID's timestamp is stated as it decodes. The licence section keeps the licence, non-affiliation and provenance statements and drops the case-law conclusions; NOTICE is unchanged. - Contributors: the gate and the verification policy match tools/ci/test-targets.txt and verify-real-files.sh (unit tests that predate the policy are kept but not run), and CONTRIBUTING says that approval to run a first-time contributor's checks is separate from approval to merge. All same-page links resolve to headings, every relative link exists, code fences balance, and the "Nineteen CLIs ship" sentence that tests/binary_inventory.rs pins is unchanged. ## Testing - Rendered by GitHub's own renderer (the `readme` API with the HTML media type, on this branch): one H1, 18 H2s, 4 H3s, all 7 tables, and every same-page link resolves to a heading id. - Every relative link in the README exists in the tree, and code fences balance. - No command changed except the WebAssembly build line, which now matches `.github/workflows/deploy-viewer.yml`, `docs/install.md` and `viewer/README.md`; CI's viewer build runs that exact command. - No code changes. `tests/binary_inventory.rs`, the only test that reads the README, pins the CLI sentence, which is unchanged. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0. - [x] No Autodesk proprietary source, decompiled internals or NDA material. - [x] No fixtures added.
6 tasks done
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.
The VW1-21 privacy audit, which checks that the viewer's wasm imports no network primitive, could never fail. This PR fixes it and finishes C6's deploy-viewer items.
The defect. Every copy of the audit grepped
wasm-objdump -j Import -xfor"fetch"and similar names, with the quotes. That covers deploy-viewer, publish.yml, the Playwright spec,tools/check-local.shand.cursor/install.sh. wabt prints an import as<- module.field, with no quotes (src/binary-reader-objdump.cc:1607), so none of those patterns can match.Red on draft #734, Deploy viewer run 37379307824. The canary imports
./rvt_bg.js.__wbg_fetch_0, and the old audit printed the import and still missed it:The fix:
viewer/scripts/audit-wasm-imports.mjs, which needs only Node, so the deploy no longer installs wabt.WebAssembly.Module.imports()and checks each one twice:fetchorsendBeacon__wbg_fetch_<hash>and so on.new WebSocket(...)imports as__wbg_new_<hash>.fetch()of the.wasmfile sits in its init function, outside every shim, so it is not flagged.What it found. I ran it on the deployed viewer's wasm and glue from Pages:
__wbg_new_shim edited tonew WebSocket(...), the audit flags it.The spec change.
viewer/tests/wasm-no-network-imports.spec.tsnow reads imports through the script, in its own commit.hitsequals[].Other deploy-viewer items from C6
cache: pnpmkeyed onviewer/pnpm-lock.yaml. setup-node's explicitcachetakes precedence overpackage-manager-cache(src/main.ts:74).~/.cache/ms-playwright, keyed on the Playwright version. The OS packages are still installed each run.playwright-report/andtest-results/are uploaded and kept for 14 days.The README, AGENTS.md, the privacy-posture and build-pipeline docs, viewer/README.md and the CHANGELOG now describe the new audit.
Note
Medium Risk
Strengthens a privacy-critical CI gate and changes how deploy/publish enforce VW1-21; incorrect shim parsing could false-pass or false-fail builds, but the canary and unread-shim failures mitigate that.
Overview
Fixes VW1-21: the viewer’s wasm network-import gate could never fail because every path grepped
wasm-objdumpfor quoted names like"fetch", which wabt does not emit.New audit:
viewer/scripts/audit-wasm-imports.mjs(Node only) replaceswasm-objdump/wabtin.cursor/install.sh,tools/check-local.sh,deploy-viewer.yml,publish.yml, and the Playwright spec. It lists imports viaWebAssembly.Module.imports(), flags network primitives by import name and by each import’s shim body inviewer/pkg/rvt.js, fails on missing artifacts or unreadable shims, and self-checks with a built-in canary.wasm-no-network-imports.spec.tsimports the script directly and adds a canary test (no skip when wabt is absent).Deploy workflow (C6): drops
wabtinstall; runs the audit after Node/pnpm setup; enables pnpm lockfile caching; caches Playwright browsers by version; uploadsplaywright-report/andtest-results/for 14 days on failure.Docs (
README,AGENTS.md,CHANGELOG, privacy/build docs,viewer/README.md) describe the new check.Reviewed by Cursor Bugbot for commit a5aa488. Configure here.