-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
fs.deny
with globs with directories (#16250)
- Loading branch information
1 parent
ee81e19
commit d2db33f
Showing
6 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { isServe, page, viteTestUrl } from '~utils' | ||
|
||
describe.runIf(isServe)('main', () => { | ||
test('**/deny/** should deny src/deny/deny.txt', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/deny.txt', viteTestUrl).href, | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
test('**/deny/** should deny src/deny/.deny', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/.deny', viteTestUrl).href, | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.deny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
build: { | ||
rollupOptions: { | ||
input: { | ||
main: path.resolve(__dirname, 'src/index.html'), | ||
}, | ||
}, | ||
}, | ||
server: { | ||
fs: { | ||
strict: true, | ||
allow: [path.resolve(__dirname, 'src')], | ||
deny: ['**/deny/**'], | ||
}, | ||
}, | ||
define: { | ||
ROOT: JSON.stringify(path.dirname(__dirname).replace(/\\/g, '/')), | ||
}, | ||
}) |