summaryrefslogtreecommitdiff
path: root/runtime/ops/process.rs
diff options
context:
space:
mode:
authorcrowlKats <13135287+crowlKats@users.noreply.github.com>2021-04-10 00:12:00 +0200
committerGitHub <noreply@github.com>2021-04-10 00:12:00 +0200
commite7b7129b7a92b7500ded88f8f5baa25a7f59e56e (patch)
tree6716354fdd09b5b3ef37ec5769aa3ff4732fc039 /runtime/ops/process.rs
parent1c7217e3909c72135020ff415e61644e20e1f62c (diff)
feat(permissions): allow run permission to take values (#9833)
This commit adds allowlist support to `--allow-run` flag. Additionally `Deno.permissions.query()` allows to query for specific programs within allowlist.
Diffstat (limited to 'runtime/ops/process.rs')
-rw-r--r--runtime/ops/process.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs
index c2ca2c687..625bc204c 100644
--- a/runtime/ops/process.rs
+++ b/runtime/ops/process.rs
@@ -96,9 +96,8 @@ fn op_run(
run_args: RunArgs,
_zero_copy: Option<ZeroCopyBuf>,
) -> Result<RunInfo, AnyError> {
- state.borrow::<Permissions>().run.check()?;
-
let args = run_args.cmd;
+ state.borrow::<Permissions>().run.check(&args[0])?;
let env = run_args.env;
let cwd = run_args.cwd;
@@ -198,11 +197,6 @@ async fn op_run_status(
rid: ResourceId,
_zero_copy: Option<ZeroCopyBuf>,
) -> Result<RunStatus, AnyError> {
- {
- let s = state.borrow();
- s.borrow::<Permissions>().run.check()?;
- }
-
let resource = state
.borrow_mut()
.resource_table
@@ -292,7 +286,7 @@ fn op_kill(
_zero_copy: Option<ZeroCopyBuf>,
) -> Result<(), AnyError> {
super::check_unstable(state, "Deno.kill");
- state.borrow::<Permissions>().run.check()?;
+ state.borrow::<Permissions>().run.check_all()?;
kill(args.pid, args.signo)?;
Ok(())