Skip to content

fix: reduce Windows 8.3-short-name detection false-positives - #23066

Merged
sapphi-red merged 3 commits into
vitejs:mainfrom
harshmathurx:fix/windows-tilde-file-loading
Aug 18, 2026
Merged

sapphi-red merged 3 commits into
vitejs:mainfrom
harshmathurx:fix/windows-tilde-file-loading

Conversation

@harshmathurx

@harshmathurx harshmathurx commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes a Windows dev-server file allow-list false negative where a legitimate resolved file path containing ~ is rejected before safeModulePaths / server.fs.allow can be considered.

Root cause: the 8.3-short-name guard used filePath.includes('~'), which catches ordinary tilde-containing directories or filenames even though the security concern is specifically a Windows 8.3 alias segment such as PROGRA~1.

This PR narrows the guard to path segments that look like Windows 8.3 short-name aliases, while keeping the existing protections for true short-name-style paths.

Fixes #22892

Verification

Local checks run:

  • pnpm --filter vite build
  • pnpm run test-unit static

CI evidence on the PR is green for the relevant matrix, including:

  • Build&Test: node-24.15.0, windows-latest
  • Ubuntu/macOS Build&Test jobs
  • Lint: node-24, ubuntu-latest
  • Semantic Pull Request
  • zizmor

Risk / compatibility

The change is Windows-specific and keeps rejecting segments that match the 8.3 alias shape. It only allows ordinary long-path names containing ~ to proceed to the existing safeModulePaths, deny-glob, and server.fs.allow checks.

Reviewer note

cc @sapphi-red since this follows up on the Windows alternate-path guard from #22572.

Additional context

AI assistance was used while preparing this patch; Harsh reviewed the diff and ran the checks listed above.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide related issue(s)/PR(s) if any.
  • Provide a description of the changes in this PR.

Tests

  • pnpm --filter vite build
  • pnpm run test-unit static

@harshmathurx

Copy link
Copy Markdown
Contributor Author

@sapphi-red I opened this as a narrow follow-up to the Windows alternate-path guard from #22572. It keeps rejecting 8.3-looking path segments such as PROGRA~1, but allows ordinary tilde-containing paths so safeModulePaths / server.fs.allow can work as intended.

@harshmathurx

Copy link
Copy Markdown
Contributor Author

@sapphi-red gentle follow-up here. This is still a narrow Windows path guard adjustment: keep rejecting 8.3-looking segments like PROGRA~1, but allow legitimate tilde-containing paths that are explicitly permitted by the configured file allowlist. Happy to reshape if there’s a preferred invariant for this check.

bluwy
bluwy previously approved these changes Aug 7, 2026
@sapphi-red sapphi-red changed the title fix: allow legitimate tilde paths on Windows fix: reduce Windows 8.3-short-name detection false-positives Aug 18, 2026
@sapphi-red sapphi-red added the p2-edge-case Bug, but has workaround or limited in scope (priority) label Aug 18, 2026

@sapphi-red sapphi-red left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There would still be false-positives, but that should be fine.

@sapphi-red
sapphi-red merged commit 02cffa9 into vitejs:main Aug 18, 2026
18 checks passed
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Aug 21, 2026
| datasource | package | from  | to    |
| ---------- | ------- | ----- | ----- |
| npm        | vite    | 8.2.0 | 8.2.2 |


## [v8.2.2](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small-822-2026-08-20-small)

##### Features

- **deps:** widen `@vitejs/devtools` peer range to v0.5.0 ([#23302](vitejs/vite#23302)) ([495d9ff](vitejs/vite@495d9ff))

##### Bug Fixes

- **bundled-dev:** handle lazy request error ([#23291](vitejs/vite#23291)) ([3ba026d](vitejs/vite@3ba026d))
- **bundled-dev:** hot update through circular imports instead of reloading ([#23259](vitejs/vite#23259)) ([3dbddef](vitejs/vite@3dbddef))
- **config:** resolve sourcemap paths against sourcemap location ([#23239](vitejs/vite#23239)) ([05a003e](vitejs/vite@05a003e))
- **css:** don't pass empty targets to lightningcss ([#23295](vitejs/vite#23295)) ([2804636](vitejs/vite@2804636))
- **define:** fix match escaped dots to support $-prefixed define keys ([#23249](vitejs/vite#23249)) ([dcf88bd](vitejs/vite@dcf88bd))
- **deps:** update all non-major dependencies ([#23217](vitejs/vite#23217)) ([ba958bd](vitejs/vite@ba958bd))
- **deps:** update rolldown-related dependencies ([#23218](vitejs/vite#23218)) ([83ecb2c](vitejs/vite@83ecb2c))
- **module-runner:** exclude completed modules from in-flight cycle detection (fix [#22999](vitejs/vite#22999)) ([#23009](vitejs/vite#23009)) ([d9b10a9](vitejs/vite@d9b10a9))
- **optimizer:** close custom extension analysis bundles ([#23207](vitejs/vite#23207)) ([8fb7675](vitejs/vite@8fb7675))
- reduce Windows 8.3-short-name detection false-positives ([#23066](vitejs/vite#23066)) ([02cffa9](vitejs/vite@02cffa9))
- respect `resolve.preserveSymlinks` when resolving root (fix [#23197](vitejs/vite#23197)) ([#23198](vitejs/vite#23198)) ([8413052](vitejs/vite@8413052))
- **ssr:** rewrite computed key of destructing parameter ([#23307](vitejs/vite#23307)) ([9db0b61](vitejs/vite@9db0b61))
- **vite:** update outdated upstream file links in license comments ([#23285](vitejs/vite#23285)) ([c0f2fc6](vitejs/vite@c0f2fc6))

##### Documentation

- **build:** note cssTarget precedence ([#23200](vitejs/vite#23200)) ([a20a35e](vitejs/vite@a20a35e))

##### Miscellaneous Chores

- fix ts errors in build test cases ([#23209](vitejs/vite#23209)) ([a0cfcf7](vitejs/vite@a0cfcf7))

##### Code Refactoring

- use JSON import attributes instead of readFileSync in constants ([#23258](vitejs/vite#23258)) ([1d9fa39](vitejs/vite@1d9fa39))
- use named regex constants over inline literals ([#22964](vitejs/vite#22964)) ([5c1c6c6](vitejs/vite@5c1c6c6))

##### Tests

- **define:** close rolldown bundler after generate ([#23231](vitejs/vite#23231)) ([b4d66fe](vitejs/vite@b4d66fe))
- **module-runner:** add TLA circular import case ([#23299](vitejs/vite#23299)) ([4a261f2](vitejs/vite@4a261f2))
- **module-runner:** simplify server-hmr tests ([#23300](vitejs/vite#23300)) ([599b44b](vitejs/vite@599b44b))
- **ssr:** add destructing assignment case for moduleRunnerTransform ([#23308](vitejs/vite#23308)) ([cb77e2a](vitejs/vite@cb77e2a))

##### Build System

- use JSON import attributes instead of readFIleSync in rolldown configs ([#23251](vitejs/vite#23251)) ([d615bcd](vitejs/vite@d615bcd))


## [v8.2.1](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small-821-2026-08-06-small)

##### Bug Fixes

- **build:** make client chunkImportMap work with `sharedPlugins: true` ([#23184](vitejs/vite#23184)) ([15f0307](vitejs/vite@15f0307))
- **bundled-dev:** inject client script tag before chunk scripts ([#23161](vitejs/vite#23161)) ([eac0cc8](vitejs/vite@eac0cc8))
- **css:** don't re-run lightningcss visitor during minify (fix [#23146](vitejs/vite#23146)) ([#23147](vitejs/vite#23147)) ([de041a7](vitejs/vite@de041a7))
- **deps:** update all non-major dependencies ([#23136](vitejs/vite#23136)) ([14454fd](vitejs/vite@14454fd))
- **deps:** update rolldown-related dependencies ([#23070](vitejs/vite#23070)) ([7ac6f7f](vitejs/vite@7ac6f7f))
- don't mutate the user config when resolving the lib entry from the top-level `input` ([#23135](vitejs/vite#23135)) ([b4bf596](vitejs/vite@b4bf596))
- handle shebang ending with uncommon line terminators ([#23038](vitejs/vite#23038)) ([17f7b2f](vitejs/vite@17f7b2f))
- **server:** use a random port when port is 0 ([#23158](vitejs/vite#23158)) ([fddf4ea](vitejs/vite@fddf4ea))

##### Performance Improvements

- **css:** look up pure CSS chunks through a Set ([#23114](vitejs/vite#23114)) ([1331b0b](vitejs/vite@1331b0b))

##### Documentation

- **build:** fix incomplete `@default` for build.minify ([#23177](vitejs/vite#23177)) ([ef02435](vitejs/vite@ef02435))

##### Miscellaneous Chores

- **deps:** update dependency rolldown-plugin-dts to ^0.28.0 ([#23137](vitejs/vite#23137)) ([4adc1e7](vitejs/vite@4adc1e7))
- **deps:** update dependency strip-literal to v4 ([#23140](vitejs/vite#23140)) ([9db65ce](vitejs/vite@9db65ce))

##### Code Refactoring

- **bundled-dev:** avoid injecting server values in the bundle ([#22967](vitejs/vite#22967)) ([23b8a08](vitejs/vite@23b8a08))
- **bundled-dev:** remove rolldown lazy stub module workaround ([#23129](vitejs/vite#23129)) ([e72036e](vitejs/vite@e72036e))

##### Tests

- **bundled-dev:** enable sourcemap playgrounds ([#23080](vitejs/vite#23080)) ([c2155fe](vitejs/vite@c2155fe))
- reduce logs ([#23138](vitejs/vite#23138)) ([7673c02](vitejs/vite@7673c02))
renovate Bot added a commit to gwennlbh/pleye that referenced this pull request Aug 27, 2026
##### [v8.2.2](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small-822-2026-08-20-small)

##### Features

- **deps:** widen `@vitejs/devtools` peer range to v0.5.0 ([#23302](https://github.com/vitejs/vite/issues/23302)) ([495d9ff](https://github.com/vitejs/vite/commit/495d9ff5a7d843ca876a9e49799947a5deb704c7))

##### Bug Fixes

- **bundled-dev:** handle lazy request error ([#23291](https://github.com/vitejs/vite/issues/23291)) ([3ba026d](https://github.com/vitejs/vite/commit/3ba026dade4af56df08815310d3458fa110f5c5c))
- **bundled-dev:** hot update through circular imports instead of reloading ([#23259](https://github.com/vitejs/vite/issues/23259)) ([3dbddef](https://github.com/vitejs/vite/commit/3dbddefaafc091a879b06f9279296f776691e455))
- **config:** resolve sourcemap paths against sourcemap location ([#23239](https://github.com/vitejs/vite/issues/23239)) ([05a003e](https://github.com/vitejs/vite/commit/05a003e6a17a84d75f907ea0f1598bc39b8dce6c))
- **css:** don't pass empty targets to lightningcss ([#23295](https://github.com/vitejs/vite/issues/23295)) ([2804636](https://github.com/vitejs/vite/commit/2804636ff608d105928009d274ffba7cfbe55340))
- **define:** fix match escaped dots to support $-prefixed define keys ([#23249](https://github.com/vitejs/vite/issues/23249)) ([dcf88bd](https://github.com/vitejs/vite/commit/dcf88bd2ad2b1a8845f90295