Commit 013b6f4
Fix untrusted workspace config resolution executing JS config files
Prettier's resolveConfigFile/resolveConfig can require()/import()
JavaScript config files (.prettierrc.js, prettier.config.js, etc.),
allowing arbitrary code execution even when workspace trust restricted
module resolution to the bundled Prettier. Add a workspace.isTrusted
guard in resolveConfig() to skip config resolution entirely in
untrusted workspaces, returning null (Prettier defaults).
Reported by Hector Ruiz Ruiz.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1b0dad6 commit 013b6f4
3 files changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
405 | 415 | | |
406 | 416 | | |
407 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
0 commit comments