fix(security): pin vendored model-viewer bundle to verified upstream - #2709
fix(security): pin vendored model-viewer bundle to verified upstream#2709superm1 wants to merge 3 commits into
Conversation
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks, right direction, but not ready yet:
e1bb81e to
0e6e28b
Compare
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks, better, but not fully there yet.
0e6e28b to
b61b0fe
Compare
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks, this is much closer. I still see one blocker though: model-viewer.min.js itself is unchanged from the base branch, so the PR currently documents and hashes the existing blob as pristine 4.3.1 without actually replacing it.
Could you also make the update snippet fail closed (set -euo pipefail, ideally extract into a fresh temp dir), and change the workflow comment from “equivalent of SRI” to “drift guard” to match the README?
Once those are fixed, this looks good to me.
fl0rianr
left a comment
There was a problem hiding this comment.
Thanks, the previous points look good now. One small thing remains: please use mktemp -d for the extraction directory as well, so the update flow is fully isolated and fail-closed even after an interrupted previous run.
It would also be helpful to note that the verified 4.3.1 artifact produces the existing 283b06… SHA-256, which explains why the vendored bundle itself does not appear in the diff.
Merge conflicts, rebase or main sync is due.
With that, this looks good to me.
The vendored model-viewer.min.js had drifted from the documented upstream (@google/model-viewer@4.3.1) and carried no integrity hash, so a webpack import could not detect tampering or corruption. Replace it with the pristine bundle extracted from the npm registry tarball, pin its SHA-256 in a sidecar checked by CI, and document the hash chain plus a hash-preserving update process that verifies npm's dist.integrity.
… and drift guard comment
…h in README Address final review feedback from fl0rianr: - Use mktemp -d for extraction directory instead of hardcoded /tmp path so the update flow is fully isolated and fail-closed even after an interrupted previous run. - Add a note explaining that the verified 4.3.1 artifact produces the existing 283b06… SHA-256, which is why the bundle itself does not appear in the diff.
0e5f0e8 to
34e848a
Compare
Summary
The vendored
src/app/src/renderer/vendor/model-viewer.min.jshad drifted from the documented upstream and carried no integrity hash, so a webpack import could not detect tampering or corruption.This PR pins to the pristine artifact and secures it:
dist/model-viewer.min.jsfrom the npm registry tarball for@google/model-viewer@4.3.1, verified against npm's published sha512 integrity.model-viewer.min.js.sha256(SHA-256283b06…) and a CI job indocs_and_style.ymlthat runssha256sum -cto fail on any drift.README.mdto record the hash chain (npm tarball integrity → extracted-file SHA-256) and a hash-preserving update process that validates npm's dist.integrity before extraction.Review notes
Shadow mapping fix (upstream #5168)
The locally patched 4.3.0 file contained a shadow-depth shader fix from google/model-viewer#5168 correcting the orthographic frustum and floor/blur-plane scaling for models larger than 1×1. That fix is included in the official 4.3.1 release, so the bundle is now pristine upstream with the fix intact.
"Drift guard" vs SRI
The sidecar SHA-256 check is a drift guard rather than a true SRI replacement: the file and checksum can be changed together in the same commit. The npm dist.integrity (SHA-512) is the authoritative upstream trust anchor, and the documented update process verifies it before extracting the file.