Skip to content

Commit

Permalink
src: rename the variable storing permission for child_process and worker
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
  • Loading branch information
daeyeon committed May 5, 2023
1 parent 21642e7 commit 72cab67
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,10 @@ Environment::Environment(IsolateData* isolate_data,
// spawn/worker nor use addons unless explicitly allowed by the user
if (!options_->allow_fs_read.empty() || !options_->allow_fs_write.empty()) {
options_->allow_native_addons = false;
if (!options_->allow_child_process) {
if (options_->allow_child_process) {
permission()->Apply("*", permission::PermissionScope::kChildProcess);
}
if (!options_->allow_worker_threads) {
if (options_->allow_worker_threads) {
permission()->Apply("*", permission::PermissionScope::kWorkerThreads);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/permission/child_process_permission.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace permission {
// Once denied, it's always denied
void ChildProcessPermission::Apply(const std::string& allow,
PermissionScope scope) {
deny_all_ = true;
is_all_allowed_ = true;
}

bool ChildProcessPermission::is_granted(PermissionScope perm,
const std::string_view& param) {
return deny_all_ == false;
return is_all_allowed_;
}

} // namespace permission
Expand Down
2 changes: 1 addition & 1 deletion src/permission/child_process_permission.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChildProcessPermission final : public PermissionBase {
const std::string_view& param = "") override;

private:
bool deny_all_;
bool is_all_allowed_{false};
};

} // namespace permission
Expand Down
4 changes: 2 additions & 2 deletions src/permission/worker_permission.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace permission {
// Currently, PolicyDenyWorker manage a single state
// Once denied, it's always denied
void WorkerPermission::Apply(const std::string& allow, PermissionScope scope) {
deny_all_ = true;
is_all_allowed_ = true;
}

bool WorkerPermission::is_granted(PermissionScope perm,
const std::string_view& param) {
return deny_all_ == false;
return is_all_allowed_;
}

} // namespace permission
Expand Down
2 changes: 1 addition & 1 deletion src/permission/worker_permission.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WorkerPermission final : public PermissionBase {
const std::string_view& param = "") override;

private:
bool deny_all_;
bool is_all_allowed_{false};
};

} // namespace permission
Expand Down

0 comments on commit 72cab67

Please sign in to comment.