chore(deps): upgrade Sanity Studio from 5 to 6 (does not improve security)#459
Closed
joaquimds wants to merge 1 commit into
Closed
chore(deps): upgrade Sanity Studio from 5 to 6 (does not improve security)#459joaquimds wants to merge 1 commit into
joaquimds wants to merge 1 commit into
Conversation
DOES NOT IMPROVE SECURITY -- see below. Opening for review on currency grounds only. The stated reason for this upgrade was the high-severity adm-zip chain (adm-zip -> @sanity/runtime-cli -> @sanity/cli -> sanity), which is unfixable on Sanity 5: 5.31.1 is the last 5.x release and pins @sanity/cli ^6.7.2, while the fix needs @sanity/cli 7.x. Sanity 6 does pull @sanity/cli 7.12.1 and does fix that path (@sanity/runtime-cli now uses adm-zip 0.6.0). But it also introduces two new dependency subtrees, @sanity/workbench-cli and @vercel/frameworks, which bring in a different vulnerable adm-zip (0.5.10, via @module-federation/dts-plugin) and a vulnerable js-yaml. Net effect measured on this branch: 15 -> 20 advisories (high 8 -> 11). The upgrade trades one vulnerable transitive path for two new ones. Two code changes were required: - @sanity/image-url v2 removed the deep "lib/types/types" entry point, so SanityImageSource now comes from the package root. - @sanity/icons v5 moved individual icons to subpath exports; the root entry only exports Icon and the icons map. Note that its root .d.ts still declares the individual icons, so tsc passed and only the Turbopack build caught this. Verified with npm run lint, npm run build and the full unit suite (285 passed). No automated test covers the Studio UI: Portable Text editing (@portabletext/editor v7), the Mux video input and React strict mode being enabled by default all need a manual click-through of /studio.
Member
Author
|
Closing per maintainer decision. This upgrade increases the audit count (15 → 20, highs 8 → 11) by pulling in |
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 rationale for this upgrade turned out to be wrong
The reason to go to Sanity 6 was the high-severity adm-zip chain —
adm-zip → @sanity/runtime-cli → @sanity/cli → sanity— which genuinely cannot be fixed on Sanity 5.5.31.1is the last 5.x release and pins@sanity/cli ^6.7.2, while the fix requires@sanity/cli7.x.Sanity 6 does pull
@sanity/cli@7.12.1, and it does fix that path —@sanity/runtime-clinow usesadm-zip@0.6.0.But it also introduces two new dependency subtrees,
@sanity/workbench-cliand@vercel/frameworks, which bring:adm-zip@0.5.10, via@module-federation/dts-pluginjs-yamlMeasured on this branch: 15 → 20 advisories (high 8 → 11). The upgrade trades one vulnerable transitive path for two new ones. All of them are CLI/build-time tooling rather than request-path code, on both sides of the comparison.
Code changes required
Two, both small:
@sanity/image-urlv2 removed the deeplib/types/typesentry point;SanityImageSourcenow comes from the package root.@sanity/iconsv5 moved individual icons to subpath exports — the root entry only exportsIconand theiconsmap, soPlayIconnow comes from@sanity/icons/Play. Worth knowing: its root.d.tsstill declares the individual icons, sotsc --noEmitpassed and only the Turbopack build caught this. A typecheck-only CI gate would have shipped a broken build.Verification
npm run lint— cleannpm run build— succeedsnpm test -- run tests/unit— 285 passed, 15 skippedWhat still needs a human
Nothing automated covers the Studio UI. Before this could merge,
/studioneeds a click-through of:@portabletext/editorv7) — theblockContentschemamp4_support: "standard"optionfeature-childtemplateRecommendation
Merge #458 (Chain A) — that one clears 5 moderate advisories with no migration. Hold this one unless you want Sanity 6 for support/feature reasons, in which case the branch is ready and verified.
🤖 Generated with Claude Code