Skip to content

fix: update vite 7.3.0 → 7.3.2 (GHSA-p9ff-h696-f583)#750

Merged
rithviknishad merged 2 commits into
mainfrom
copilot/fix-vite-arbitrary-file-read
Apr 8, 2026
Merged

fix: update vite 7.3.0 → 7.3.2 (GHSA-p9ff-h696-f583)#750
rithviknishad merged 2 commits into
mainfrom
copilot/fix-vite-arbitrary-file-read

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Description

Patches CVE-2026-39363 — arbitrary file read via Vite dev server WebSocket bypassing server.fs access controls.

What

  • Added pnpm override to pin vite at 7.3.2 (transitive dep of vitest)

Why

High-severity vulnerability: the fetchModule method exposed on Vite's HMR WebSocket does not enforce server.fs restrictions, allowing unauthenticated reads of arbitrary files when the dev server is network-exposed.

How

vite is not a direct dependency — it's pulled in transitively by vitest@4.1.3. Added a version override in pnpm-workspace.yaml to force resolution to the patched version:

overrides:
  vite: 7.3.2

Reachability: Not reachable (high confidence)

The vulnerability requires exposing Vite's dev server to the network (--host / server.host). This codebase has no vite.config.*, no Vite dev server usage, and uses Next.js for web serving. Vite is present solely as a vitest transitive dependency. Update satisfies vulnerability scanners.

Related Issues


Type of Change

  • 🔧 Chore/maintenance

Packages Affected

  • Root configuration

Quality Checklist

Core Requirements (Mandatory)

Version Management

  • Changeset added: I have run pnpm changeset for version-tracked packages
    • Changeset follows semantic versioning (patch/minor/major)
    • Changeset description is clear and user-facing
    • OR this PR only affects docs/config and doesn't need a changeset

Testing

  • Tests added/updated: All new code has corresponding tests
    • Unit tests for business logic
    • Integration tests where applicable
    • Edge cases and error scenarios covered
  • All tests passing: pnpm test runs successfully
  • Test coverage maintained or improved: Run pnpm test:coverage to verify

No new tests — dependency version override only; all existing tests pass.

Build & Type Safety

  • Build succeeds: pnpm build:packages completes without errors
  • TypeScript types correct: No type errors
  • Linting passes

Documentation

  • README updated if there are user-facing changes
  • Code comments added for complex logic
  • JSDoc/TSDoc added for public APIs and exported functions
  • Documentation site (/docs) updated if needed
  • Migration guide included if this introduces breaking changes

N/A — no user-facing or code changes.

Plugin-Specific Requirements

N/A


Screenshots / Videos

N/A — lockfile-only change.

Original prompt

This section details the Dependabot vulnerability alert you should resolve

<alert_title>Vite Vulnerable to Arbitrary File Read via Vite Dev Server WebSocket</alert_title>
<alert_description>### Summary

server.fs check was not enforced to the fetchModule method that is exposed in Vite dev server's WebSocket.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • WebSocket is not disabled by server.ws: false

Arbitrary files on the server (development machine, CI environment, container, etc.) can be exposed.

Details

If it is possible to connect to the Vite dev server’s WebSocket without an Origin header, an attacker can invoke fetchModule via the custom WebSocket event vite:invoke and combine file://... with ?raw (or ?inline) to retrieve the contents of arbitrary files on the server as a JavaScript string (e.g., export default "...").

The access control enforced in the HTTP request path (such as server.fs.allow) is not applied to this WebSocket-based execution path.

PoC

  1. Start the dev server on the target
    Example (used during validation with this repository):

    pnpm -C playground/alias exec vite --host 0.0.0.0 --port 5173
  2. Confirm that access is blocked via the HTTP path (example: arbitrary file)

    curl -i 'http://localhost:5173/@fs/etc/passwd?raw'

    Result: 403 Restricted (outside the allow list)
    image

  3. Confirm that the same file can be retrieved via the WebSocket path
    By connecting to the HMR WebSocket without an Origin header and sending a vite:invoke request that calls fetchModule with a file://... URL and ?raw, the file contents are returned as a JavaScript module.

image image

high
GHSA-p9ff-h696-f583, CVE-2026-39363
vite
npm
<vulnerable_versions>7.3.0</vulnerable_versions>
<patched_version>7.3.2</patched_version>
<manifest_path>pnpm-lock.yaml</manifest_path>

https://github.com/vitejs/vite/security/advisories/GHSA-p9ff-h696-f583 https://github.com/vitejs/vite/pull/22159 https://github.com/vitejs/vite/commit/f02d9fde0b195afe3ea2944414186962fbbe41e0 https://github.com/vitejs/vite/releases/tag/v6.4.2 https://github.com/vitejs/vite/releases/tag/v7.3.2 https://github.com/vitejs/vite/releases/tag/v8.0.5 https://nvd.nist.gov/vuln/detail/CVE-2026-39363 https://github.com/advisories/GHSA-p9ff-h696-f583

<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather than to address an active risk. If the advisory is too vague to determine reachability (e.g. 'improper input validation' with no specific API named), state that reachability could not be determined and explain why. Include a confidence level in the reachability assessment (e.g. high confidence if the advisory names a specific API and you confirmed it is or is not called, low confidence if the usage is indirect and hard to trace). If no patched version is available, check the alert_description field for a Workarounds section — the advisory may describe configuration changes or usage patterns that mitigate the vulnerability without a version update. If a workaround is available, apply it and leave a code comment referencing the advisory identifier explaining it is a temporary mitigation. If neither a patch nor a workaround is available, explain in the PR description why the alert cannot be resolved automatically...

@rithviknishad rithviknishad marked this pull request as ready for review April 8, 2026 11:40
rithviknishad
rithviknishad previously approved these changes Apr 8, 2026
@rithviknishad rithviknishad marked this pull request as draft April 8, 2026 11:41
@rithviknishad rithviknishad marked this pull request as ready for review April 8, 2026 11:45
@rithviknishad rithviknishad merged commit 601a114 into main Apr 8, 2026
2 checks passed
Copilot AI changed the title [WIP] Fix Vite vulnerability to arbitrary file read via WebSocket fix: update vite 7.3.0 → 7.3.2 (GHSA-p9ff-h696-f583) Apr 8, 2026
@rithviknishad rithviknishad deleted the copilot/fix-vite-arbitrary-file-read branch April 8, 2026 11:46
Copilot AI requested a review from rithviknishad April 8, 2026 11:46
Copilot stopped work on behalf of rithviknishad due to an error April 8, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants