Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Vite 8.4's allowlist approach: measuring which files get served

Table of contents · 5 items

The Vite dev server is meant to run locally. But if you expose it to your LAN with --host or run it on a staging server, more people can reach it. In those cases, people often do not know which files in the project it will return.

Until now, Vite has protected files with a list of "files that must not be returned" (a blocklist). This approach stops .env and key files with server.fs.deny. The November 26 Vite 8.4 announcement notes that the team has kept closing loopholes in this approach, and says it now lets you choose an allowlist approach that "returns only files referenced from the entry point." This approach is planned to become the default in the next major version.

In this article, after checking the announcement and the configuration docs, we ran the same small project on 8.3.8 and 8.4.0 to see which files are returned and which get a 403. We also suggest steps for trying it first on a site under development.

What the announcement says

The key points of the announcement on the official Vite 8.4 blog (the "Allow-list Based File Serve Check" section) are as follows.

  • The server.fs check is a feature for cases where an attacker can reach the dev server, and it was added in Vite 2.7. Until now, it used a blocklist approach that enumerates files users and Vite should handle with care
  • The team has kept fixing bypasses that exploit quirks in file system and HTTP parsing, but because attacks are increasing, 8.4 introduces a stricter allowlist approach
  • server.fs.strict: 'extended' extends the check to modules loaded by plugins. References are now also registered from places such as CSS url(), in addition to import
  • Combining server.fs.strict: 'extended' and server.fs.allow: [] gives an approach that allows only files referenced from the entry point (including references that can be traced). This is planned to become the default in the next major version
  • Plugins that create modules referencing files by means other than import can register them with this.environment.addSafeModule

In the configuration docs (server.fs.strict), the type is now boolean | 'extended', and the default is still true. Simply upgrading to 8.4 changes nothing.

Results on the same project

For testing, we created the following small project.

  • index.html loads src/style.css with <link> and src/main.js with <script>
  • src/main.js imports src/util.js. src/unused.js is not referenced from anywhere
  • src/style.css references an image with url('./assets/bg.svg')
  • Place notes.txt (a file containing only a dummy string) and public/robots.txt directly under the root

In an isolated test environment (Linux, Node.js v22.23.5), we started a dev server listening only on 127.0.0.1, requested files in the same order as a browser (HTML, JS, CSS, images), and then requested the remaining files. Below are the rows where the result differed by configuration (with the default settings, the five files traceable from the entry point also returned 200).

== vite 8.4.0 / default            (8.3.8 の既定、8.4.0 の strict: 'extended' のみも同じ)
  200 /src/unused.js
  200 /notes.txt
  200 /package.json
  200 /@fs<project>/notes.txt
== vite 8.4.0 / allowlist          (strict: 'extended' + allow: [])
  200 /
  200 /src/main.js
  200 /src/util.js
  200 /src/style.css
  200 /src/assets/bg.svg
  403 /src/unused.js
  403 /notes.txt
  403 /package.json
  403 /@fs<project>/notes.txt

Diagram comparing the response for each file on the Vite 8.4.0 dev server between the default settings and the allowlist approach (strict set to extended, allow set to an empty array). With the defaults, src/unused.js, which is not referenced from anywhere, notes.txt and package.json directly under the root, and notes.txt via /@fs/ also returned 200. With the allowlist approach, only index.html, main.js, util.js, style.css and the image in the CSS url() referenced from the entry point returned 200, and the remaining four returned 403

With the default settings, on both 8.3.8 and 8.4.0, src/unused.js, which is not referenced from anywhere, and notes.txt and package.json directly under the root returned 200. They are also returned for requests with an absolute path under /@fs/. This is because they are inside the default server.fs.allow (the workspace root, or the project root if none is found) and do not match the server.fs.deny list either. Specifying only strict: 'extended' gave the same result as the defaults.

With the allowlist approach, only the five files traceable from the entry point index.html returned 200, and the remaining four returned 403. The image referenced with CSS url() was also allowed as a reference from the entry point.

How it differs from allow: [] on 8.3.8

When we specified only server.fs.allow: [] on 8.3.8, index.html, main.js and util.js were returned, but style.css, loaded with <link>, and the image inside it returned 403. The 8.4 changelog entries "register references in HTML to safe modules" and "register more references to safe modules" appear to account for this difference. If you try the same thing on 8.3.x or earlier, even ordinary stylesheets get blocked.

Points to watch

Within what we confirmed in our test environment, knowing the following three points in advance will save you confusion.

  • Requests made before the entry point return 403. With the allowlist approach, directly requesting src/util.js or images before loading index.html returned 403. After the entry point was loaded, they returned 200. The results suggest that references are registered while the entry point is being transformed. This is not a problem when you open the site normally in a browser, but the results change if tests or scripts fetch individual files directly
  • Files in public are not covered. public/robots.txt returned 200 even with the allowlist approach. The server.fs.deny docs also say that files in the public directory are all served without filtering. The practice of not putting secrets there does not change
  • strict: 'extended' alone does not narrow anything. In this project, extended alone gave the same result as the defaults. Files are narrowed only in combination with allow: []

We have not tested setups that combine frameworks or plugins (Nuxt, SvelteKit, Laravel's laravel-vite-plugin and so on). If a plugin loads files by means other than import, pages may break with 403 errors until it supports addSafeModule.

Steps to try it on a site under development (editorial suggestion)

Before you try this, check which version you are using now. On November 10, a Critical-severity advisory (GHSA-p4f5-76q4-ffq7) was published in the Vite repository. If you expose the dev server to the network with --host or server.host, a crafted request can read files outside the allow list or execute code on the server. The fixed versions are 8.3.7, 8.1.7, 7.3.8, and 6.4.6, released on November 9, plus 8.2.6 in the 8.2 line (the advisory says 8.2.5, but the version on npm is 8.2.6). The 8.3.8 and 8.4.0 versions we tested this time are post-fix versions. As of November 30, this advisory is not listed in the GitHub Advisory Database. We therefore expect that npm audit, which relies on that database, does not warn about it yet.

  1. Upgrade to 8.4. Upgrade with npm i -D vite@^8.4.0, then confirm that the dev server and the production build still work as before with the default settings
  2. Try the allow-list mode in your development settings. Add the following to vite.config and open every page on the dev server
// vite.config.js(開発サーバーだけに効く設定)
export default {
  server: {
    fs: {
      strict: 'extended',
      allow: [],
    },
  },
}
  1. Find every 403. Look for files that returned 403 in the Network tab of your browser's developer tools and in Vite's log in the terminal. If a file is needed, first check whether it is referenced from an entry point. If a plugin loads it, either wait for a plugin update or add it individually to server.fs.allow
  2. Switch dev servers that are exposed externally first. The more a test environment is exposed with --host, the more it benefits. For environments used only on your own machine, it is fine to switch later, in line with the default in the next major version

The seven advisories for the Vite dev server and launch-editor published in October, and the cautions for configuring server.fs.deny yourself, were covered in our article on Vite dev server vulnerabilities. The allow-list mode does not block such individual loopholes one by one; instead, it narrows down the files that can be served from the start. The prerequisites for migrating if you use Vite+ are summarized in our article on Vite+ 1.0. The November 10 advisory also affects Vite+ 1.5.0 and earlier, and it is fixed in 1.5.1.

Scope of verification

On November 27, 2026, we checked the announcement in the vitejs/vite repository (docs/blog/announcing-vite8-4.md on main), the configuration docs at tag v8.4.0 (server.fs.strict, allow, and deny in docs/config/server-options.md), the plugin docs (docs/guide/api-environment-plugins.md), packages/vite/CHANGELOG.md, and the publication dates on the npm registry (document research). For the serving results, we installed vite 8.3.8 and 8.4.0 in an isolated test environment (Linux, Node.js v22.23.5) and sent requests with curl to the dev server on 127.0.0.1 (hands-on testing with a test project and dummy files). We did not check the browser and HMR, setups combining frameworks or plugins, or a server exposed with --host. On November 30, we rechecked the announcement on vite.dev, the repository advisory (GHSA-p4f5-76q4-ffq7) and whether it is listed in the GitHub Advisory Database, and the latest version of each line on npm. No new version has been released after 8.4.0.

For reviewing the development environment of a site in progress or planning dependency updates, please contact us through our consultation on development, AI, and automation.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Starting from what you want to achieve with your website.

We organize user goals, required features, and ongoing maintenance structures to determine the first steps in development and improvement.

  • Website objectives
  • Features and usability
  • Post-launch operations
Consult on web development and improvements

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles via email · Read the web production guide
Free download

Complete Guide to Web Production: Costs, Vendor Selection & Traffic Acquisition [2026 Edition]

We have compiled cost benchmarks, vendor selection criteria, and traffic acquisition strategies into a PDF.

The PDF and newsletter emails are currently in Japanese.

You will also be subscribed to our newsletter. You can unsubscribe at any time.