diff options
author | Matt Mastracci <matthew@mastracci.com> | 2024-04-19 18:12:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-19 18:12:03 -0600 |
commit | 472a37064071c66cd1311cdea2e78de8d2bc0641 (patch) | |
tree | 94459f249eee0429480e2cea6ac37319e27de41d /ext/node | |
parent | 365e1f48f7059f94d4eeb8f5ba8b3949b686b355 (diff) |
feat(runtime): Allow embedders to perform additional access checks on file open (#23208)
Embedders may have special requirements around file opening, so we add a
new `check_open` permission check that is called as part of the file
open process.
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/ops/require.rs | 2 | ||||
-rw-r--r-- | ext/node/package_json.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index 426c41995..176d64e56 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -452,7 +452,7 @@ where let file_path = PathBuf::from(file_path); ensure_read_permission::<P>(state, &file_path)?; let fs = state.borrow::<FileSystemRc>(); - Ok(fs.read_text_file_sync(&file_path)?) + Ok(fs.read_text_file_sync(&file_path, None)?) } #[op2] diff --git a/ext/node/package_json.rs b/ext/node/package_json.rs index 77352ae1d..d4ffc80d6 100644 --- a/ext/node/package_json.rs +++ b/ext/node/package_json.rs @@ -82,7 +82,7 @@ impl PackageJson { return Ok(CACHE.with(|cache| cache.borrow()[&path].clone())); } - let source = match fs.read_text_file_sync(&path) { + let source = match fs.read_text_file_sync(&path, None) { Ok(source) => source, Err(err) if err.kind() == ErrorKind::NotFound => { return Ok(Rc::new(PackageJson::empty(path))); |