summaryrefslogtreecommitdiff
path: root/runtime/snapshot.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-04-19 18:12:03 -0600
committerGitHub <noreply@github.com>2024-04-19 18:12:03 -0600
commit472a37064071c66cd1311cdea2e78de8d2bc0641 (patch)
tree94459f249eee0429480e2cea6ac37319e27de41d /runtime/snapshot.rs
parent365e1f48f7059f94d4eeb8f5ba8b3949b686b355 (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 'runtime/snapshot.rs')
-rw-r--r--runtime/snapshot.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs
index 54652e1f1..d5122af84 100644
--- a/runtime/snapshot.rs
+++ b/runtime/snapshot.rs
@@ -10,6 +10,7 @@ use deno_core::snapshot::*;
use deno_core::v8;
use deno_core::Extension;
use deno_http::DefaultHttpPropertyExtractor;
+use deno_io::fs::FsError;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
@@ -129,6 +130,17 @@ impl deno_net::NetPermissions for Permissions {
}
impl deno_fs::FsPermissions for Permissions {
+ fn check_open<'a>(
+ &mut self,
+ _resolved: bool,
+ _read: bool,
+ _write: bool,
+ _path: &'a Path,
+ _api_name: &str,
+ ) -> Result<std::borrow::Cow<'a, Path>, FsError> {
+ unreachable!("snapshotting!")
+ }
+
fn check_read(
&mut self,
_path: &Path,