Skip to content

Commit 61ba8fd

Browse files
bluwygasbugs21c
andauthored
feat: extend server.fs.deny list with common files (#22707)
Co-authored-by: gasbugs <[email protected]>
1 parent ed7b283 commit 61ba8fd

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎docs/config/server-options.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export default defineConfig({
424424
## server.fs.deny
425425

426426
- **Type:** `string[]`
427-
- **Default:** `['.env', '.env.*', '*.{crt,pem}', '**/.git/**']`
427+
- **Default:** `['.env', '.env.*', '*.{crt,pem,key,p12,pfx,cer,der}', '.npmrc', '.yarnrc.yml', '**/.git/**']`
428428

429429
Blocklist for sensitive files being restricted to be served by Vite dev server. This will have higher priority than [`server.fs.allow`](#server-fs-allow). [picomatch patterns](https://github.com/micromatch/picomatch#globbing-features) are supported.
430430

‎packages/vite/src/node/server/index.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export interface FileSystemServeOptions {
256256
* This will have higher priority than `allow`.
257257
* picomatch patterns are supported.
258258
*
259-
* @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
259+
* @default ['.env', '.env.*', '*.{crt,pem,key,p12,pfx,cer,der}', '.npmrc', '.yarnrc.yml', '**\/.git/**']
260260
*/
261261
deny?: string[]
262262
}
@@ -1182,7 +1182,14 @@ const _serverConfigDefaults = Object.freeze({
11821182
fs: {
11831183
strict: true,
11841184
// allow
1185-
deny: ['.env', '.env.*', '*.{crt,pem}', '**/.git/**'],
1185+
deny: [
1186+
'.env',
1187+
'.env.*',
1188+
'*.{crt,pem,key,p12,pfx,cer,der}',
1189+
'.npmrc',
1190+
'.yarnrc.yml',
1191+
'**/.git/**',
1192+
],
11861193
},
11871194
// origin
11881195
preTransformRequests: true,

0 commit comments

Comments
 (0)