From 472a37064071c66cd1311cdea2e78de8d2bc0641 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Fri, 19 Apr 2024 18:12:03 -0600 Subject: 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. --- runtime/snapshot.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'runtime/snapshot.rs') 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, FsError> { + unreachable!("snapshotting!") + } + fn check_read( &mut self, _path: &Path, -- cgit v1.2.3