ποΈ Security Fix dependency vitest to v4 [SECURITY]#31
Merged
1 commit merged intoJun 8, 2026
Merged
Conversation
Contributor
Author
|
d249676 to
85e4b6e
Compare
85e4b6e to
ee68322
Compare
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.
This PR contains the following updates:
3.2.4β4.1.0When Vitest UI server is listening, arbitrary file can be read and executed
CVE-2026-47429 / GHSA-5xrq-8626-4rwp
More information
Details
Summary
Arbitrary file can be read on Windows when Vitest UI server is listening, especially when exposed to the network.
Impact
Only users that match either of the following conditions are affected:
--api.hostorapi.hostconfig option)Details
The API handler for
/__vitest_attachment__uses the deprecatedisFileServingAllowedincorrectly.https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/ui/node/index.ts#L77
The function expects the passed value to use
cleanUrlafter the check before file system related operation.Because of this, it is possible to bypass the check by
\\?\\..\\. This is not possible on Linux as Linux errors if a directory named?does not exist.A similar problem exists in other places as well.
That said, this
isFileServingAllowedcheck does not actually prevent the API to be abused. Since the API has rerun feature and file write feature, it's possible to run arbitrary script by writing a script as a test file usingsaveTestFileand running it usingrerun. This means exposing the API / Vitest UI is equivalent to giving script execution access.On the browser mode side, there're
readFile/writeFile/saveSnapshotFile. So exposing the browser mode is equivalent to giving file read / write access.PoC
curl http://localhost:51204/__vitest__/curl "http://localhost:51204/__vitest_attachment__?path=C:\\path\\to\\project\\?\\..\\..\\secret.txt&contentType=text/plain&token=$TOKEN"(TOKEN is the API token)secret.txtthat is outside the project directoryMitigations
Vitest now ships two configuration flags,
allowWriteandallowExec, that gate the privileged operations exploited by this vulnerability. Both are disabled by default whenever the API server is bound to a non-localhosthost, ensuring that exposing the server to the network no longer implicitly grants write or execute capabilities to remote clients.When these flags are disabled, the UI also enters a read-only mode: in-browser code editing and test file execution are turned off, removing the attack surface that allowed remote code execution. Many Browser Mode features are also disabled, like attachments, artifacts or snapshots. See
browser.api.Users who require the full interactive UI on a networked host must explicitly opt in by setting
allowWriteand/orallowExectotrue.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
vitest-dev/vitest (vitest)
v4.1.0Compare Source
Vitest 4.1 is out!
This release page lists all changes made to the project during the 4.1 beta. To get a review of all the new features, read our blog post.
Β Β Β π Features
setTickModeto timer controls Β -Β by @βatscott and @βsheremet-va in #β8726 (4b480)toTestSpecificationto reported tasks Β -Β by @βsheremet-va in #β9464 (1a470)vi.mockorvi.hoistedare declared outside of top level of the module Β -Β by @βsheremet-va in #β9387 (5db54)aroundEachandaroundAllhooks Β -Β by @βsheremet-va in #β9450 (2a8cb)neworallin--updateflag Β -Β by @βsheremet-va in #β9543 (a5acf)metain test options Β -Β by @βsheremet-va in #β9535 (7d622)test.extendsyntax Β -Β by @βsheremet-va in #β9550 (e5385)vitest listto statically collect tests instead of running files to collect them Β -Β by @βsheremet-va in #β9630 (7a8e7)--detect-async-leaksΒ -Β by @βAriPerkkio in #β9528 (c594d)mockThrowandmockThrowOnceΒ -Β by @βthor-juhasz and @βsheremet-va in #β9512 (61917)update: "none"and add docs about snapshots behavior on CI Β -Β by @βhi-ogawa in #β9700 (05f18)launchOptionswithconnectOptionsΒ -Β by @βhi-ogawa in #β9702 (f0ff1)page/locator.markAPI to enhance playwright trace Β -Β by @βhi-ogawa in #β9652 (d0ee5)testinexperimental_parseSpecificationΒ -Β by @βjgillick and Jeremy Gillick in #β9235 (2f367)createSpecificationΒ -Β by @βsheremet-va in #β9336 (c8e6c)runTestFilesas alternative torunTestSpecificationsΒ -Β by @βsheremet-va in #β9443 (43d76)allowWriteandallowExecoptions toapiΒ -Β by @βsheremet-va in #β9350 (20e00)toTestSpecificationΒ -Β by @βsheremet-va in #β9627 (6f17d)userEvent.wheelAPI Β -Β by @βmacarie in #β9188 (66080)filterNodeoption to prettyDOM for filtering browser assertion error output Β -Β by @βCopilot, sheremet-va and @βsheremet-va in #β9475 (d3220)detailsPanelPositionoption and button Β -Β by @βshairez in #β9525 (c8a31)findElementand enable strict mode in webdriverio and preview Β -Β by @βsheremet-va in #β9677 (c3f37)ignore start/stopignore hints Β -Β by @βAriPerkkio in #β9204 (e59c9)coverage.changedoption to report only changed files Β -Β by @βkykim00 and @βAriPerkkio in #β9521 (1d939)onModuleRunnerhook toworker.initΒ -Β by @βsheremet-va in #β9286 (e977f)importDurations: { limit, print }options Β -Β by @βhi-ogawa, Claude Opus 4.6 and @βsheremet-va in #β9401 (7e10f)importDurationsΒ -Β by @βhi-ogawa and Claude Opus 4.6 in #β9533 (3f7a5)beforeAll/afterAllΒ -Β by @βsheremet-va in #β9572 (c8339)agentreporter to reduce ai agent token usage Β -Β by @βcpojer in #β9779 (3e9e0)retryoptions Β -Β by @βMazenSamehR, Matan Shavit, @βAriPerkkio and @βsheremet-va in #β9370 (9e4cf)Β Β Β π Bug Fixes
meta.urlincreateRequireΒ -Β by @βsheremet-va in #β9441 (e3422)external/noExternalduringconfigEnvironmenthook Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9508 (59ea2)browser.isolateis used Β -Β by @βsheremet-va in #β9410 (3d48e)vi.mock({ spy: true })node v8 coverage Β -Β by @βhi-ogawa, hi-ogawa and Claude Opus 4.6 in #β9541 (687b6).namefrom statically collected test Β -Β by @βsheremet-va in #β9596 (b66ff)expect.softΒ -Β by @βiumehara, @βhi-ogawa and Claude Opus 4.6 in #β9231 (3eb2c)sequence.shuffle.testsis enabled Β -Β by @βkaigritun, Kai Gritun and @βsheremet-va in #β9576 (8182b)expect/src/utilsfromvitestΒ -Β by @βhi-ogawa in #β9616 (48739)--detect-async-leaksΒ -Β by @βAriPerkkio in #β9638 (9fd4c)aroundEach/Allwhen inneraroundEach/Allthrows Β -Β by @βhi-ogawa in #β9657 (4ec6c)aroundEach/Allsetup timed out Β -Β by @βhi-ogawa in #β9670 (bb013)VitestRunnerConfigoptional fields withSerializedConfigΒ -Β by @βhi-ogawa in #β9661 (79520)toBe*spy assertions in favor oftoHaveBeen*(andtoThrowError) Β -Β by @βsheremet-va in #β9665 (4d390)aroundEach/Allerrors but aggregate them on runner Β -Β by @βhi-ogawa in #β9673 (b6365)resolves/rejectschained assertion error Β -Β by @βhi-ogawa in #β9679 (c6151)maxConcurrencyΒ -Β by @βhi-ogawa in #β9653 (16d13)resolve.conditionsfor externals Β -Β by @βhi-ogawa in #β9717 (1d498)mockObjectchange backwards compatible Β -Β by @βsheremet-va in #β9744 (84c69)URL.nameon jsdom Β -Β by @βhi-ogawa in #β9767 (031f3)vi.importActual()for virtual modules Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9772 (1e89e)FixtureAccessErrorif suite hook accesses undefined fixture Β -Β by @βsheremet-va in #β9786 (fc2ce)loadortransformoriginal module Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9774 (a8216)hideSkippedTestsshould not hidetest.todoΒ -Β by @βoilater in #β9562 and #β9781 (8181e)beforeEachhooks Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9826 (99e52)performance.nowto measure test timeout duration Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9795 (f48a6)toMatchScreenshotpasses Β -Β by @βmacarie in #β9289 (46aab)toMatchScreenshotΒ -Β by @βmacarie in #β9552 (83ca0)--remote-debugging-addressfrom chrome args Β -Β by @βhi-ogawa and @βAriPerkkio in #β9712 (f09bb)ensureAwaitedΒ -Β by @βsheremet-va in #β9732 (97685)getCDPSessionandcdp()Β -Β by @βAriPerkkio in #β9716 (689a2)deepEqualin the config because it's not serializable Β -Β by @βsheremet-va in #β9666 (9ee99)thresholds.autoUpdateto preserve ending whitespace Β -Β by @βAriPerkkio in #β9436 (7e534)/config/#optionhash links causing hydration errors Β -Β by @βhi-ogawa, Claude Opus 4.6 and @βsheremet-va in #β9610 (a603c)toMatchObject(Map/Set)should expectMap/Seton left hand side Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9532 (381da)toThrowand make Error detection robust Β -Β by @βhi-ogawa and Claude Opus 4.6 in #β9570 (de215)dotreporter leaves pending tests Β -Β by @βAriPerkkio in #β9684 (4d793)undefinedΒ -Β by @βsheremet-va in #β9511 (6f181)bench.reportersno longer gives type errors when passing file name string paths Β -Β by @βBertie690 in #β9695 (093c8)Β Β Β π Performance
Β Β Β Β View changes on GitHub
v4.0.18Compare Source
Β Β Β π Experimental Features
onModuleRunnerhook toworker.initΒ -Β by @βsheremet-va in #β9286 (ea837)Β Β Β π Bug Fixes
meta.urlincreateRequireΒ -Β by @βsheremet-va in #β9441 (e0572)Β Β Β Β View changes on GitHub
v4.0.17Compare Source
Β Β Β π Features
Β Β Β π Bug Fixes
addEventHandler#β9371 Β -Β by @βThibautMarechal in #β9372 and #β9371 (40841)process.envandimport.meta.envdefines in inline project Β -Β by @βhi-ogawa in #β9239 (b70c9)ErrorEvent.messagewhen unhandledErrorEvent.erroris null Β -Β by @βhi-ogawa in #β9322 (5d84e)fileParallelismon an instance Β -Β by @βsheremet-va in #β9328 (15006)istanbul-lib-source-mapsusage Β -Β by @βAriPerkkio in #β9344 (b0940)Β Β Β Β View changes on GitHub
v4.0.16Compare Source
Β Β Β π Bug Fixes
Configuration
π Schedule: (UTC)
π¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
β» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.