From f8d83361cd11d3aa42333171ecb6b129fdcbefeb Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 24 Apr 2020 19:55:33 -0400 Subject: chdir should require --allow-write (#4889) --- cli/ops/fs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cli/ops') diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs index 6b259e033..c46da6c04 100644 --- a/cli/ops/fs.rs +++ b/cli/ops/fs.rs @@ -245,12 +245,14 @@ struct ChdirArgs { } fn op_chdir( - _state: &State, + state: &State, args: Value, _zero_copy: Option, ) -> Result { let args: ChdirArgs = serde_json::from_value(args)?; - set_current_dir(&args.directory)?; + let d = PathBuf::from(&args.directory); + state.check_write(&d)?; + set_current_dir(&d)?; Ok(JsonOp::Sync(json!({}))) } -- cgit v1.2.3