Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove permission check for CWD #27192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ext/fs/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ where
{
let fs = state.borrow::<FileSystemRc>();
let path = fs.cwd()?;
state
.borrow_mut::<P>()
.check_read_blind(&path, "CWD", "Deno.cwd()")?;
let path_str = path_into_string(path.into_os_string())?;
Ok(path_str)
}
Expand Down
15 changes: 0 additions & 15 deletions tests/integration/compile_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,21 +921,6 @@ fn compile_npm_vfs_implicit_read_permissions() {
});
}

#[test]
fn compile_npm_no_permissions() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this test but just test with a different permission.

run_npm_bin_compile_test(RunNpmBinCompileOptions {
input_specifier: "npm:cowsay@1.5.0",
copy_temp_dir: None,
compile_args: vec![],
run_args: vec!["Hello"],
output_file: "npm/deno_run_cowsay_no_permissions.out",
node_modules_local: false,
input_name: None,
expected_name: "cowsay",
exit_code: 1,
});
}

#[test]
fn compile_npm_cowsay_explicit() {
run_npm_bin_compile_test(RunNpmBinCompileOptions {
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,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 <CWD>.\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",
Expand Down
2 changes: 0 additions & 2 deletions tests/testdata/npm/deno_run_cowsay_no_permissions.out

This file was deleted.

10 changes: 0 additions & 10 deletions tests/unit/dir_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <CWD>, run again with the --allow-read flag",
);
});

Deno.test(
{ permissions: { read: true, write: true } },
function dirChdirError() {
Expand Down