diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs index 9f5f3c6e90..c5c2b25631 100644 --- a/ext/fs/ops.rs +++ b/ext/fs/ops.rs @@ -171,9 +171,6 @@ where { let fs = state.borrow::(); let path = fs.cwd()?; - state - .borrow_mut::

() - .check_read_blind(&path, "CWD", "Deno.cwd()")?; let path_str = path_into_string(path.into_os_string())?; Ok(path_str) } diff --git a/tests/integration/compile_tests.rs b/tests/integration/compile_tests.rs index 7519ca4e86..dd4ce3ea9a 100644 --- a/tests/integration/compile_tests.rs +++ b/tests/integration/compile_tests.rs @@ -820,14 +820,14 @@ fn compile_npm_cowsay_main() { #[test] fn compile_npm_no_permissions() { run_npm_bin_compile_test(RunNpmBinCompileOptions { - input_specifier: "npm:cowsay@1.5.0", + input_specifier: "npm:@denotest/cli-with-permissions@1.0.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, }); } diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 8d4bfa20cb..4538dc8473 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -358,10 +358,12 @@ fn permissions_prompt_allow_all_2() { console.write_line_raw("A"); console.expect("✅ Granted all sys access."); + let text = console.read_until("Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions)"); // "read" permissions - console.expect(concat!( - "┏ ⚠️ Deno requests read access to .\r\n", - "┠─ Requested by `Deno.cwd()` API.\r\n", + test_util::assertions::assert_wildcard_match(&text, concat!( + "\r\n", + "┏ ⚠️ Deno requests read access to \"[WILDCARD]/tests/testdata/\".\r\n", + "┠─ Requested by `Deno.lstatSync()` API.\r\n", "┠─ To see a stack trace for this prompt, set the DENO_TRACE_PERMISSIONS environmental variable.\r\n", "┠─ Learn more at: https://docs.deno.com/go/--allow-read\r\n", "┠─ Run again with --allow-read to bypass this prompt.\r\n", diff --git a/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/index.js b/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/index.js new file mode 100644 index 0000000000..c70dead19f --- /dev/null +++ b/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/index.js @@ -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")); diff --git a/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/package.json b/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/package.json new file mode 100644 index 0000000000..9f3d7cea9f --- /dev/null +++ b/tests/registry/npm/@denotest/cli-with-permissions/1.0.0/package.json @@ -0,0 +1,5 @@ +{ + "name": "@denotest/cli-with-permissions", + "version": "1.0.0", + "bin": "./index.js" +} diff --git a/tests/testdata/npm/compile_npm_no_permissions.out b/tests/testdata/npm/compile_npm_no_permissions.out new file mode 100644 index 0000000000..a96a970b77 --- /dev/null +++ b/tests/testdata/npm/compile_npm_no_permissions.out @@ -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] diff --git a/tests/testdata/npm/deno_run_cowsay_no_permissions.out b/tests/testdata/npm/deno_run_cowsay_no_permissions.out deleted file mode 100644 index 25b79d9a7d..0000000000 --- a/tests/testdata/npm/deno_run_cowsay_no_permissions.out +++ /dev/null @@ -1,2 +0,0 @@ -error: Uncaught (in promise) NotCapable: Requires read access to , specify the required permissions during compilation using `deno compile --allow-read` -[WILDCARD] diff --git a/tests/unit/dir_test.ts b/tests/unit/dir_test.ts index dbf88609c2..757c8fec36 100644 --- a/tests/unit/dir_test.ts +++ b/tests/unit/dir_test.ts @@ -38,16 +38,6 @@ Deno.test({ permissions: { read: true, write: true } }, function dirCwdError() { } }); -Deno.test({ permissions: { read: false } }, function dirCwdPermError() { - assertThrows( - () => { - Deno.cwd(); - }, - Deno.errors.NotCapable, - "Requires read access to , run again with the --allow-read flag", - ); -}); - Deno.test( { permissions: { read: true, write: true } }, function dirChdirError() {