-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Deno.cwd() no longer requires --allow-read permission (#27192)
This commit changes "Deno.cwd()" (as well as "process.cwd()") to no longer require full "--allow-read" permission. This change was meant to be done in Deno 2.0.0, but somehow it slipped. Requiring full read permission just to read the CWD is a mistake, because CWD can already be obtained with no permission by throwing an error in JS and inspecting its stack. Fixes #27110 --------- Co-authored-by: Bartek Iwańczuk <[email protected]>
- Loading branch information
1 parent
533993e
commit 4e655e5
Showing
8 changed files
with
22 additions
and
22 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 |
---|---|---|
|
@@ -820,14 +820,14 @@ fn compile_npm_cowsay_main() { | |
#[test] | ||
fn compile_npm_no_permissions() { | ||
run_npm_bin_compile_test(RunNpmBinCompileOptions { | ||
input_specifier: "npm:[email protected].0", | ||
input_specifier: "npm:@denotest/[email protected].0", | ||
copy_temp_dir: None, | ||
compile_args: vec![], | ||
compile_args: vec!["-o", "denotest"], | ||
run_args: vec!["Hello"], | ||
output_file: "npm/deno_run_cowsay_no_permissions.out", | ||
output_file: "npm/compile_npm_no_permissions.out", | ||
node_modules_local: false, | ||
input_name: None, | ||
expected_name: "cowsay", | ||
expected_name: "denotest", | ||
exit_code: 1, | ||
}); | ||
} | ||
|
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
3 changes: 3 additions & 0 deletions
3
tests/registry/npm/@denotest/cli-with-permissions/1.0.0/index.js
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,3 @@ | ||
console.log("Hello in CLI with permissions"); | ||
console.log("Reading DENO_HELLO env var..."); | ||
console.log(Deno.env.get("DENO_HELLO")); |
5 changes: 5 additions & 0 deletions
5
tests/registry/npm/@denotest/cli-with-permissions/1.0.0/package.json
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,5 @@ | ||
{ | ||
"name": "@denotest/cli-with-permissions", | ||
"version": "1.0.0", | ||
"bin": "./index.js" | ||
} |
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,5 @@ | ||
Hello in CLI with permissions | ||
Reading DENO_HELLO env var... | ||
error: Uncaught (in promise) NotCapable: Requires env access to "DENO_HELLO", specify the required permissions during compilation using `deno compile --allow-env` | ||
console.log(Deno.env.get("DENO_HELLO")); | ||
[WILDCARD] |
This file was deleted.
Oops, something went wrong.
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