diff options
author | andy finch <andyfinch7@gmail.com> | 2019-03-01 19:25:50 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-01 19:25:50 -0500 |
commit | 8c310d3d56c6b1bc67ee81d8c5ea9b20abee8088 (patch) | |
tree | 442823e64836f956fe22014b563269e1ababefae /src/compiler.rs | |
parent | 1cc02a5d9d867f1a239ee4b69f587d8afac07b02 (diff) |
Permissions refactor (#1864)
Refactored permissions to be assignable on a per-isolate
basis, and added a fix for #1858 to op_fetch_module_meta_data.
Diffstat (limited to 'src/compiler.rs')
-rw-r--r-- | src/compiler.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index bef889c96..fa86617ce 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -2,6 +2,7 @@ use crate::isolate::Buf; use crate::isolate::IsolateState; use crate::msg; +use crate::permissions::DenoPermissions; use crate::resources; use crate::resources::Resource; use crate::resources::ResourceId; @@ -10,6 +11,7 @@ use crate::workers; use futures::Future; use serde_json; use std::str; +use std::sync::atomic::AtomicBool; use std::sync::Arc; use std::sync::Mutex; @@ -48,9 +50,19 @@ impl ModuleMetaData { fn lazy_start(parent_state: &Arc<IsolateState>) -> Resource { let mut cell = C_RID.lock().unwrap(); + let permissions = DenoPermissions { + allow_read: AtomicBool::new(true), + allow_write: AtomicBool::new(false), + allow_env: AtomicBool::new(false), + allow_net: AtomicBool::new(true), + allow_run: AtomicBool::new(false), + }; let rid = cell.get_or_insert_with(|| { - let resource = - workers::spawn(parent_state.clone(), "compilerMain()".to_string()); + let resource = workers::spawn( + parent_state.clone(), + "compilerMain()".to_string(), + permissions, + ); resource.rid }); Resource { rid: *rid } |