DEV Community

OnaEiuspkz
OnaEiuspkz

Posted on

Vite's dev server allowlist failed on a two-request worker path

Vite's dev server allowlist failed on a two-request worker path

A Vite development server is not meant to be a public file service. It still needs a clear allowlist because developers open projects that contain environment files, source maps, local certificates, and other material outside the browser bundle. GHSA-qppr-rxr4-jjq2 describes a beta-only failure in which two requests using the ?worker path could serve files outside server.fs.allow when those files were not also covered by server.fs.deny.

The advisory scope is important. This is not a claim that every Vite production bundle is vulnerable, and the issue affected a beta release line. The lesson applies more broadly: a development server can enforce a path policy on one request form and miss another path that workers, plugins, or transformed URLs use.

Allow and deny are different controls

server.fs.allow defines what the dev server may serve. server.fs.deny blocks known sensitive files, often with patterns for .env, certificates, and other application secrets. A file that falls outside the allowlist should not become reachable because it is also absent from the deny list. The deny list is a defensive backstop, not the primary authorization boundary.

The ?worker query can cause Vite to process a request through a different code path. A security test that sends only a direct file request can therefore miss it. Good tests cover direct URLs, query parameters used by the server, encoded separators, symlinks, and worker imports.

Update and remove public dev servers

Move beta installations to a patched build. Pin the Vite version in the lockfile and verify the version used by the actual development command. A newer version in another workspace does not protect the running project.

Bind dev servers to 127.0.0.1 or a private development interface. Do not publish port 5173 on a public host. Disable host checking exemptions that allow arbitrary external hostnames. If remote access is required, place the server behind an authenticated tunnel or VPN and restrict it to the developer's identity.

Review reverse-proxy and firewall logs for requests to development ports during the exposure window. Search for ?worker, traversal sequences, encoded dots, and access to file types that should never leave the project. Development servers often emit less structured logging than production services, so retain proxy evidence as well.

Secret exposure response

If an environment file or private key may have been served, rotate the affected secret. Removing the file from the project is not enough if it was copied into browser caches, logs, or a proxy response. Invalidate development API tokens separately from production credentials.

Add a test server with a temporary file outside server.fs.allow. Send direct and transformed requests and assert that each returns a denial. The test should fail if a new Vite feature adds a request path that bypasses the shared guard.

Limits

The public advisory establishes a beta-only issue and a request pattern. It does not show how many deployments were reachable or whether any file was accessed. Operators still need to confirm the release they run, whether the port was exposed, and what sensitive material existed outside the allowlist.

References

Top comments (0)