summaryrefslogtreecommitdiff
path: root/runtime/permissions/lib.rs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-10-31 22:18:33 -0700
committerGitHub <noreply@github.com>2024-10-31 22:18:33 -0700
commit6c6bbeb97495e8c3e8eac7bea27bf836f02b575f (patch)
treec64933f984e01d3aacae6ee03a13a1a78db45392 /runtime/permissions/lib.rs
parent6d44952d4daaaab8ed9ec82212d2256c058eb05d (diff)
fix(node): Implement `os.userInfo` properly, add missing `toPrimitive` (#24702)
Fixes the implementation of `os.userInfo`, and adds a missing `toPrimitive` for `tmpdir`. This allows us to enable the corresponding node_compat test.
Diffstat (limited to 'runtime/permissions/lib.rs')
-rw-r--r--runtime/permissions/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs
index 1e1321bb2..84503f025 100644
--- a/runtime/permissions/lib.rs
+++ b/runtime/permissions/lib.rs
@@ -1368,8 +1368,12 @@ impl SysDescriptor {
match kind.as_str() {
"hostname" | "osRelease" | "osUptime" | "loadavg"
| "networkInterfaces" | "systemMemoryInfo" | "uid" | "gid" | "cpus"
- | "homedir" | "getegid" | "username" | "statfs" | "getPriority"
- | "setPriority" => Ok(Self(kind)),
+ | "homedir" | "getegid" | "statfs" | "getPriority" | "setPriority"
+ | "userInfo" => Ok(Self(kind)),
+
+ // the underlying permission check changed to `userInfo` to better match the API,
+ // alias this to avoid breaking existing projects with `--allow-sys=username`
+ "username" => Ok(Self("userInfo".into())),
_ => Err(type_error(format!("unknown system info kind \"{kind}\""))),
}
}