From 82f9216610ec9cc32697ca77cb95da4b229117d4 Mon Sep 17 00:00:00 2001 From: Adam Gregory Date: Wed, 10 Jul 2024 14:15:43 +0100 Subject: fix: Add sys permission kinds for node compat (#24242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #24241 * Support "statfs", "username", "getPriority" and "setPriority" kinds for `--allow-sys`. * Check individual permissions in `node:os.userInfo()` instead of a single "userInfo" permission. * Check for "uid" permission in `node:process.geteuid()` instead of "geteuid". * Add missing "homedir" to `SysPermissionDescriptor.kind` union Co-authored-by: Bartek IwaƄczuk --- runtime/permissions/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/permissions/lib.rs') diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs index a2245316b..0d9d37a36 100644 --- a/runtime/permissions/lib.rs +++ b/runtime/permissions/lib.rs @@ -997,9 +997,8 @@ impl Descriptor for SysDescriptor { pub fn parse_sys_kind(kind: &str) -> Result<&str, AnyError> { match kind { "hostname" | "osRelease" | "osUptime" | "loadavg" | "networkInterfaces" - | "systemMemoryInfo" | "uid" | "gid" | "cpus" | "homedir" | "getegid" => { - Ok(kind) - } + | "systemMemoryInfo" | "uid" | "gid" | "cpus" | "homedir" | "getegid" + | "username" | "statfs" | "getPriority" | "setPriority" => Ok(kind), _ => Err(type_error(format!("unknown system info kind \"{kind}\""))), } } -- cgit v1.2.3