fix(deps): adopt v0.6.8 digest-verification backport for runtime downloads - #54
fix(deps): adopt v0.6.8 digest-verification backport for runtime downloads#54ya-luotao wants to merge 3 commits into
Conversation
…loads The pinned v0.6.8 core downloads the msb + libkrunfw release bundle with no integrity check on either unverified path — the `prebuilt` build-time installer in the sdk build.rs and the first-use runtime installer behind ensure_runtime!. Upstream #1300 adds fail-closed SHA-256 verification against the release's checksums.sha256 asset but is unmerged and based past v0.6.8, so the git deps move to the ya-luotao fork's `v0.6.8-digest-backport` rev — v0.6.8 plus the two digest-verification commits cherry-picked — until #1300 ships in an upstream release tag. The version_spec runtime-pin guard learns the temporary rev-pin shape (both deps share one rev, the Cargo.toml comment records the v0.6.8 base) so the tag guard can't silently rot. No Ruby API change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191N1iCiTVVFsUpmHGKZBH1
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ef4451793
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tags = cargo.scan(/^microsandbox(?:-network)?\s*=\s*\{[^}]*\btag\s*=\s*"([^"]+)"/).flatten | ||
| expect(tags).not_to be_empty | ||
| expect(tags.uniq).to eq([Microsandbox::RUNTIME_VERSION]) | ||
| if tags.empty? |
There was a problem hiding this comment.
Reject mixed tag/revision dependency pins
When only one dependency is switched back to an official tag while the other remains on the fork revision, tags.empty? is false, so this branch validates the single tag and completely ignores the remaining rev. The test therefore passes even though microsandbox and microsandbox-network come from different sources, defeating the stated guard during the documented unpin workflow; require exactly two tags and no revisions in this branch.
Useful? React with 👍 / 👎.
Review of the backport adoption surfaced four gaps. The fork branch gains a commit closing the remaining unverified download — the prebuilt build script for the embedded agentd guest binary — so the pin moves 13c422fd -> 3b9995e7 (appended, no history rewrite; the release's checksums.sha256 does publish agentd-<arch> entries). The version_spec pin guard now parses both dependency declarations exactly and accepts only two shapes — official repo + tag equal to RUNTIME_VERSION, or the approved fork URL + approved rev recorded in the spec — rejecting the mixed pin kinds and sources it previously let through. The Cargo.lock is rebuilt from main's with only the microsandbox git sources rewritten (plus the filesystem crate's new hex/sha2 build-deps), dropping the eleven unrelated windows-sys edge upgrades the earlier cargo update dragged in. RUNTIME_VERSION's doc comment now describes the actual rev-pin and guard semantics instead of the pre-backport tag pin. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191N1iCiTVVFsUpmHGKZBH1
… version Re-review round two. The fork branch gains a commit hardening the agentd verification edge cases (cached OUT_DIR bytes re-hashed against the published digest before reuse, local artifact read once and the verified buffer embedded, non-UTF-8 MSB_AGENTD_SHA256 fails instead of silently skipping verification), so the pin moves 3b9995e7 -> 32b8b98e (appended, no history rewrite). The version_spec pin guard previously never tied the approved rev to RUNTIME_VERSION — bumping the constant alone passed all specs; the approved-backport record now carries the base release it vouches for and the rev branch asserts it equals RUNTIME_VERSION. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191N1iCiTVVFsUpmHGKZBH1
|
Closing as superseded. Status as of main @ 0.15.0 (runtime v0.6.14):
Residual gaps (tracked, not addressed here): the compile-from-source build.rs download when The fork branch |
Summary
The pinned v0.6.8 core downloads release binaries with no integrity check on any of the gem's three download paths — the
prebuiltbuild-time installer for the msb bundle (sdkbuild.rs), the first-use runtime installer behindensure_runtime!, and the prebuiltagentdguest-agent download embedded by the filesystem crate's build script. Upstream superradcompany/microsandbox#1300 adds fail-closed SHA-256 verification for the first two, but it is unmerged and based past v0.6.8 (8+ commits of unrelated API drift), and does not cover the agentd path at all.This PR therefore moves the
microsandbox/microsandbox-networkgit deps to theya-luotao/microsandboxfork'sv0.6.8-digest-backportbranch (rev32b8b98e) — exactly v0.6.8 plus the two digest-verification commits from #1300 cherry-picked (byte-identical diff, zero conflicts), plus two commits extending the same fail-closed verification to the agentd prebuilt download — including re-hashing cached OUT_DIR bytes against the published digest before reuse, and failing on a non-UTF-8MSB_AGENTD_SHA256pin (the release'schecksums.sha256publishesagentd-<arch>entries; an externally supplied localbuild/agentdcan be pinned withMSB_AGENTD_SHA256). Temporary pin: switch back to the official upstream tag once equivalent verification ships in a release.ext/microsandbox/Cargo.toml— rev-pin both git deps to the fork; features unchanged; TEMPORARY comment documents the v0.6.8 base and exit condition.spec/unit/version_spec.rb— the RUNTIME_VERSION guard parses both dependency declarations exactly and accepts only two shapes: both deps tag-pinned to the official repo atRUNTIME_VERSION, or both rev-pinned to the approved fork URL + approved rev recorded in the spec. Mixed pin kinds/sources fail.lib/microsandbox/version.rb— RUNTIME_VERSION doc comment describes the actual rev-pin and guard semantics.CHANGELOG.md— Unreleased entry.Cargo.lock— rebuilt from main's lock with only the microsandbox git sources rewritten plus the filesystem crate's newhex/sha2build-deps; no unrelated resolution churn.No Ruby API change.
Microsandbox::RUNTIME_VERSIONstays"v0.6.8".Verification
bundle exec rspec spec/unit: 370 examples, 0 failures.cargo clippy --manifest-path ext/microsandbox/Cargo.toml -- -D warnings,cargo fmt --check,bundle exec standardrb,cargo metadata --locked: all clean.bundle exec rake compilewith a freshMSB_HOME: build.rs download + digest verification exercised for real — msb 0.6.8 + libkrunfw installed after verification against the release'schecksums.sha256.MSB_AGENTD_SHA256digest fails the build (fail-closed observed live, as do transient checksums-fetch failures).Unpin checklist (when equivalent verification lands in a release tag)
ext/microsandbox/Cargo.toml: back totag = "vX.Y.Z"on superradcompany/microsandbox; drop the TEMPORARY comment.spec/unit/version_spec.rb: dropapproved_backportand the rev branch of the guard.lib/microsandbox/version.rb: restore the tag-pin wording of the RUNTIME_VERSION comment.CHANGELOG.md: fold the Unreleased entry into the release notes.v0.6.8-digest-backportbranch be deleted — the rev must stay reachable until every consumer is off it.🤖 Generated with Claude Code
https://claude.ai/code/session_0191N1iCiTVVFsUpmHGKZBH1