mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
55e8073e3c
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [vite](https://vitejs.dev) ([source](https://togithub.com/vitejs/vite/tree/HEAD/packages/vite)) | [`4.5.0` -> `4.5.1`](https://renovatebot.com/diffs/npm/vite/4.5.0/4.5.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/vite/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/4.5.0/4.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [CVE-2023-49293](https://togithub.com/vitejs/vite/security/advisories/GHSA-92r3-m2mg-pj97) ### Summary When Vite's HTML transformation is invoked manually via `server.transformIndexHtml`, the original request URL is passed in unmodified, and the `html` being transformed contains inline module scripts (`<script type="module">...</script>`), it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to `server.transformIndexHtml`. ### Impact Only apps using `appType: 'custom'` and using the default Vite HTML middleware are affected. The HTML entry must also contain an inline script. The attack requires a user to click on a malicious URL while running the dev server. Restricted files aren't exposed to the attacker. ### Patches Fixed in vite@5.0.5, vite@4.5.1, vite@4.4.12 ### Details Suppose `index.html` contains an inline module script: ```html <script type="module"> // Inline script </script> ``` This script is transformed into a proxy script like ```html <script type="module" src="/index.html?html-proxy&index=0.js"></script> ``` due to Vite's HTML plugin:7fd7c6cebf/packages/vite/src/node/plugins/html.ts (L429-L465)
When `appType: 'spa' | 'mpa'`, Vite serves HTML itself, and `htmlFallbackMiddleware` rewrites `req.url` to the canonical path of `index.html`,73ef074b80/packages/vite/src/node/server/middlewares/htmlFallback.ts (L44-L47)
so the `url` passed to `server.transformIndexHtml` is `/index.html`. However, if `appType: 'custom'`, HTML is served manually, and if `server.transformIndexHtml` is called with the unmodified request URL (as the SSR docs suggest), then the path of the transformed `html-proxy` script varies with the request URL. For example, a request with path `/` produces ```html <script type="module" src="/@​id/__x00__/index.html?html-proxy&index=0.js"></script> ``` It is possible to abuse this behavior by crafting a request URL to contain a malicious payload like ``` "></script><script>alert('boom')</script> ``` so a request to http://localhost:5173/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E produces HTML output like ```html <script type="module" src="/@​id/__x00__/?"></script><script>alert("boom")</script>?html-proxy&index=0.js"></script> ``` which demonstrates XSS. ### PoC - Example 1. Serving HTML from `vite dev` middleware with `appType: 'custom'` - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=dev-html - "Open in New Tab" - Edit URL to set query string to `?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E` and navigate - Witness XSS: - ![image](https://user-images.githubusercontent.com/2456381/287434281-13757894-7a63-4a73-b1e9-d2b024c19d14.png) - Example 2. Serving HTML from SSR-style Express server (Vite dev server runs in middleware mode): - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=server - (Same steps as above) - Example 3. Plain `vite dev` (this shows that vanilla `vite dev` is _not_ vulnerable, provided `htmlFallbackMiddleware` is used) - Go to https://stackblitz.com/edit/vitejs-vite-9xhma4?file=main.js&terminal=dev - (Same steps as above) - You should _not_ see the alert box in this case ### Detailed Impact This will probably predominantly affect [development-mode SSR](https://vitejs.dev/guide/ssr#setting-up-the-dev-server), where `vite.transformHtml` is called using the original `req.url`, per the docs:7fd7c6cebf/docs/guide/ssr.md (L114-L126)
However, since this vulnerability affects `server.transformIndexHtml`, the scope of impact may be higher to also include other ad-hoc calls to `server.transformIndexHtml` from outside of Vite's own codebase. My best guess at bisecting which versions are vulnerable involves the following test script ```js import fs from 'node:fs/promises'; import * as vite from 'vite'; const html = ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> </head> <body> <script type="module"> // Inline script </script> </body> </html> `; const server = await vite.createServer({ appType: 'custom' }); const transformed = await server.transformIndexHtml('/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E', html); console.log(transformed); await server.close(); ``` and using it I was able to narrow down to #​13581. If this is correct, then vulnerable Vite versions are 4.4.0-beta.2 and higher (which includes 4.4.0). --- ### Release Notes <details> <summary>vitejs/vite (vite)</summary> ### [`v4.5.1`](https://togithub.com/vitejs/vite/releases/tag/v4.5.1) [Compare Source](https://togithub.com/vitejs/vite/compare/v4.5.0...v4.5.1) Please refer to [CHANGELOG.md](https://togithub.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md) for details. </details> --- ### Configuration 📅 **Schedule**: Branch creation - "" in timezone Europe/Madrid, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
148 lines
5.6 KiB
JSON
148 lines
5.6 KiB
JSON
{
|
|
"name": "unleash-frontend-local",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"files": ["index.js", "build"],
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"scripts": {
|
|
"build": "vite build",
|
|
"dev": "vite",
|
|
"start": "vite",
|
|
"start:prod": "vite build && vite preview",
|
|
"start:sandbox": "UNLEASH_API=https://sandbox.getunleash.io/ospro yarn run start",
|
|
"start:demo2": "UNLEASH_API=https://sandbox.getunleash.io/ UNLEASH_BASE_PATH=/demo2/ yarn run start",
|
|
"start:enterprise": "UNLEASH_API=https://unleash.herokuapp.com VITE_TEST_REDIRECT=true yarn run start",
|
|
"start:demo": "UNLEASH_BASE_PATH=/demo/ UNLEASH_API=https://app.unleash-hosted.com/ yarn run start",
|
|
"test": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest run",
|
|
"test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn test -u",
|
|
"test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest watch",
|
|
"lint": "biome lint src --apply",
|
|
"lint:check": "biome check src",
|
|
"fmt": "biome format src --write",
|
|
"fmt:check": "biome check src",
|
|
"ts:check": "tsc",
|
|
"e2e": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
"e2e:oss": "yarn --cwd frontend run cypress run --spec \"cypress/oss/**/*.spec.ts\" --config baseUrl='http://localhost:4242' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
"e2e:heroku": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='https://unleash.herokuapp.com' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
"gen:api": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" orval --config orval.config.js",
|
|
"gen:api:demo": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://app.unleash-hosted.com/demo/docs/openapi.json yarn run gen:api",
|
|
"gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api"
|
|
},
|
|
"devDependencies": {
|
|
"@biomejs/biome": "^1.4.0",
|
|
"@codemirror/lang-json": "6.0.1",
|
|
"@emotion/react": "11.11.1",
|
|
"@emotion/styled": "11.11.0",
|
|
"@mui/icons-material": "5.11.9",
|
|
"@mui/lab": "5.0.0-alpha.120",
|
|
"@mui/material": "5.11.10",
|
|
"@tanstack/react-table": "^8.10.7",
|
|
"@testing-library/dom": "8.20.1",
|
|
"@testing-library/jest-dom": "5.17.0",
|
|
"@testing-library/react": "12.1.5",
|
|
"@testing-library/react-hooks": "7.0.2",
|
|
"@testing-library/user-event": "14.5.1",
|
|
"@types/debounce": "1.2.4",
|
|
"@types/deep-diff": "1.0.5",
|
|
"@types/jest": "29.5.10",
|
|
"@types/lodash.clonedeep": "4.5.9",
|
|
"@types/lodash.mapvalues": "^4.6.9",
|
|
"@types/lodash.omit": "4.5.9",
|
|
"@types/node": "18.17.19",
|
|
"@types/react": "17.0.71",
|
|
"@types/react-dom": "17.0.25",
|
|
"@types/react-linkify": "1.0.4",
|
|
"@types/react-router-dom": "5.3.3",
|
|
"@types/react-table": "7.7.18",
|
|
"@types/react-test-renderer": "17.0.9",
|
|
"@types/react-timeago": "4.1.6",
|
|
"@types/semver": "7.5.6",
|
|
"@types/uuid": "^9.0.0",
|
|
"@uiw/codemirror-theme-duotone": "4.21.21",
|
|
"@uiw/react-codemirror": "4.21.21",
|
|
"@vitejs/plugin-react": "3.1.0",
|
|
"cartesian": "^1.0.1",
|
|
"chart.js": "3.9.1",
|
|
"chartjs-adapter-date-fns": "3.0.0",
|
|
"classnames": "2.3.2",
|
|
"copy-to-clipboard": "3.3.3",
|
|
"countries-and-timezones": "^3.4.0",
|
|
"cypress": "13.6.0",
|
|
"cypress-vite": "^1.4.0",
|
|
"date-fns": "2.30.0",
|
|
"date-fns-tz": "^2.0.0",
|
|
"debounce": "1.2.1",
|
|
"deep-diff": "1.0.2",
|
|
"dequal": "2.0.3",
|
|
"fast-json-patch": "3.1.1",
|
|
"http-proxy-middleware": "2.0.6",
|
|
"immer": "9.0.21",
|
|
"jsdom": "22.1.0",
|
|
"lodash.clonedeep": "4.5.0",
|
|
"lodash.mapvalues": "^4.6.0",
|
|
"lodash.omit": "4.5.0",
|
|
"mermaid": "^9.3.0",
|
|
"millify": "^6.0.0",
|
|
"msw": "0.49.3",
|
|
"pkginfo": "0.4.1",
|
|
"plausible-tracker": "0.3.8",
|
|
"prop-types": "15.8.1",
|
|
"react": "17.0.2",
|
|
"react-chartjs-2": "4.3.1",
|
|
"react-confetti": "^6.1.0",
|
|
"react-dom": "17.0.2",
|
|
"react-dropzone": "14.2.3",
|
|
"react-error-boundary": "3.1.4",
|
|
"react-hooks-global-state": "2.1.0",
|
|
"react-joyride": "^2.5.3",
|
|
"react-linkify": "^1.0.0-alpha",
|
|
"react-markdown": "^8.0.4",
|
|
"react-router-dom": "6.16.0",
|
|
"react-table": "7.8.0",
|
|
"react-test-renderer": "17.0.2",
|
|
"react-timeago": "7.2.0",
|
|
"sass": "1.69.5",
|
|
"semver": "7.5.4",
|
|
"swr": "2.2.4",
|
|
"tss-react": "4.9.3",
|
|
"typescript": "4.8.4",
|
|
"use-query-params": "^2.2.1",
|
|
"vanilla-jsoneditor": "^0.19.0",
|
|
"vite": "4.5.1",
|
|
"vite-plugin-env-compatible": "1.1.1",
|
|
"vite-plugin-svgr": "3.3.0",
|
|
"vite-tsconfig-paths": "4.2.1",
|
|
"vitest": "0.33.0",
|
|
"whatwg-fetch": "3.6.19"
|
|
},
|
|
"optionalDependencies": {
|
|
"orval": "^6.17.0"
|
|
},
|
|
"resolutions": {
|
|
"@codemirror/state": "6.3.2",
|
|
"@xmldom/xmldom": "^0.8.4",
|
|
"json5": "^2.2.2",
|
|
"@types/react": "17.0.71",
|
|
"@types/react-dom": "17.0.25",
|
|
"semver": "7.5.4"
|
|
},
|
|
"jest": {
|
|
"moduleNameMapper": {
|
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
|
|
"\\.svg": "<rootDir>/src/__mocks__/svgMock.js",
|
|
"\\.(css|scss)$": "identity-obj-proxy"
|
|
}
|
|
},
|
|
"browserslist": {
|
|
"production": [">0.2%", "not dead", "not op_mini all"],
|
|
"development": [
|
|
"last 1 chrome version",
|
|
"last 1 firefox version",
|
|
"last 1 safari version"
|
|
]
|
|
},
|
|
"dependencies": {}
|
|
}
|