GHSA-4pfg-2mw5-f8jx: Cloudflare Vite plugin exposes secrets over the built-in dev server
N/A
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
@cloudflare/vite-plugin | npm | < 1.6.0 | 1.6.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is an information disclosure issue within the @cloudflare/vite-plugin
. The root cause is the lack of file access restrictions in the default configuration of the Vite development server set up by the plugin. The cloudflare
function in packages/vite-plugin-cloudflare/src/index.ts
is the main entry point for the plugin and is responsible for generating this configuration. The analysis of the fixing commit 0e500720bf70016fa4ea21fc8959c4bd764ebc38
shows that the vulnerability was patched by adding a server.fs.deny
array to the configuration object returned by the cloudflare
function. This new configuration explicitly prevents the Vite dev server from serving sensitive files such as .env
and .dev.vars
. Since the cloudflare
function was responsible for creating the insecure configuration, it is identified as the vulnerable function. Any runtime profiler would show this function being called as part of the Vite server setup process.
Vulnerable functions
cloudflare
packages/vite-plugin-cloudflare/src/index.ts