Commit 044bed8
authored
fix(ext/node): require env permission for process.loadEnvFile (#34350)
process.loadEnvFile() checked only read permission for the dotenv file
and then wrote each parsed key into the process environment via
env::set_var, making it the only env-mutation API in the runtime that
didn't go through the --allow-env gate. Add a check_env_all() call
upfront so the call fails before any mutation when env access is denied,
keeping loadEnvFile consistent with Deno.env.set and friends.
The check is all-or-nothing rather than per-key — partial-grant shapes
like --allow-env=FOO no longer satisfy loadEnvFile even when FOO is the
only key in the file. The simpler behavior matches how dotenv files are
conventionally used (you either want the whole file applied or you
don't) and avoids the partial-mutation edge case where one denied key
would leave the env half-populated.1 parent 12a12f2 commit 044bed8
3 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
6 | 16 | | |
7 | 17 | | |
8 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments