Add MFE vendor pin file and verified bake task
What does this MR do and why?
Part 2 of the registry-direct MFE series: the vendor pin file and the verified bake task that turns pins into static release assets, working against the real registry contract (demo: https://gitlab-mfe-registry-demo.storage.googleapis.com).
vendor/mfe.ymlpins each app as{name, version, sha}whereshais the SHA256 of the app's registry version manifest ({registry_url}/{name}/{version}/manifest.json) — the same value the registry app index publishes asversions[].checksum. Seeded with the real publishedduo_chat 0.4.0.Gitlab::Mfe::RegistryManifest+ JSON schema validate the version manifest (module/version/algorithm/assets[]with per-filepath/size/sha256; optionalchecksum/base_url/generated_at/archive, forward-compatible); asset paths are traversal-rejected at schema level and re-checked in Ruby.Gitlab::Mfe::Baker(rakegitlab:mfe:bake) fetches the manifest viaGitlab::HTTP, verifies the pinned sha over the raw bytes, then downloads the version'sassets.zipin a single request, verifies the archive bytes against the manifest's declared sha256, and extracts with zip-slip and decompression-budget guards — re-verifying every file's declared size and sha256 in memory before atomically writingpublic/assets/mfe/{app}/{version}/**andbaked-manifest.json({apps: {name: {version, manifest_sha256, mf_manifest_path}}}). One corrupted byte aborts the whole bake with nothing written. (Live: 211-file duo_chat bake in ~1.1s vs ~103s per-file.)- Pinned-origin policy: asset URLs are always constructed from the configured
registry_url; manifest-suppliedbase_urlandarchive.urlare ignored. - Wired into
gitlab:assets:compile, but skips unlessmfeis enabled ingitlab.yml— default asset builds stay network-free. No DB access on this path.
Verified against the live demo registry: a full bake of duo_chat 0.4.0 (211 assets, 3.3 MB, including its mf-manifest.json) completes with every hash checked.
Forward-compatibility note: a GitLab compatibility range is planned to land in the registry app index later (proposed: gitlab: "<= MAJOR.MINOR" per versions[] entry); readers here ignore unknown fields by design.
How to verify
bin/rspec spec/lib/gitlab/mfe/ spec/tasks/gitlab/mfe_rake_spec.rb spec/lib/gitlab/mfe_spec.rbStack
| # | Scope | MR |
|---|---|---|
| 1 | Config section + instance kill switch | !246732 (merged) |
| 2 | Vendor pin file + registry manifest schema + verified bake task | this MR |
| 3 | Version overrides table + resolver | !246753 (closed) |
| 4 | Admin API + routes + sidebar | !246758 (closed) |
| 5 | Admin UI (Vue) | !246764 (closed) |
| 6a | Runtime loader: gon contract, manifest verification + SRI, baked fallback, CSP connect-src | !246775 (closed) |
| 6b | Duo Chat consumer behind mfe_duo_chat |
!246778 (closed) |
| 7 | Developer mode (local dev server + HMR) | !246833 (closed) |
Related
- Phase 1 issue: #605798
- Epic: gitlab-org#22777
Related to #605798.
Edited by Illya Klymov