summaryrefslogtreecommitdiff
path: root/runtime/ops/fs.rs
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-02-26 01:35:10 +0800
committerGitHub <noreply@github.com>2021-02-25 18:35:10 +0100
commitaa47f8186cbc068232e23b92a6966be9bd23e4bb (patch)
tree0c9c2e455e0700d2a674aa24b0e14f9a5860b83f /runtime/ops/fs.rs
parentcdae4423c27443e0085d59f45eda1c978f186a1c (diff)
feat(runtime): stabilize Deno.link and Deno.linkSync (#9417)
This commit makes "Deno.link" and "Deno.linkSync" stable. The permission required has been changed to read-write to ensure one cannot escape the sandbox.
Diffstat (limited to 'runtime/ops/fs.rs')
-rw-r--r--runtime/ops/fs.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/ops/fs.rs b/runtime/ops/fs.rs
index 629afbfe6..5f5425dfa 100644
--- a/runtime/ops/fs.rs
+++ b/runtime/ops/fs.rs
@@ -1140,13 +1140,14 @@ fn op_link_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- super::check_unstable(state, "Deno.link");
let args: LinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
let permissions = state.borrow::<Permissions>();
permissions.check_read(&oldpath)?;
+ permissions.check_write(&oldpath)?;
+ permissions.check_read(&newpath)?;
permissions.check_write(&newpath)?;
debug!("op_link_sync {} {}", oldpath.display(), newpath.display());
@@ -1159,8 +1160,6 @@ async fn op_link_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- super::check_unstable2(&state, "Deno.link");
-
let args: LinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1169,6 +1168,8 @@ async fn op_link_async(
let state = state.borrow();
let permissions = state.borrow::<Permissions>();
permissions.check_read(&oldpath)?;
+ permissions.check_write(&oldpath)?;
+ permissions.check_read(&newpath)?;
permissions.check_write(&newpath)?;
}