1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-13 06:56:39 +00:00
termux-packages/packages/nodejs/deps-uv-src-unix-process.c.patch
Leonid Pliushch 0eacbc0a93 nodejs: prevent calling setgroups(), setuid(), setgid()
These syscalls are blocked by seccomp.
2019-09-23 13:54:15 +03:00

32 lines
1.2 KiB
Diff

diff -uNr node-v12.10.0/deps/uv/src/unix/process.c node-v12.10.0.mod/deps/uv/src/unix/process.c
--- node-v12.10.0/deps/uv/src/unix/process.c 2019-09-04 18:36:23.000000000 +0300
+++ node-v12.10.0.mod/deps/uv/src/unix/process.c 2019-09-23 01:39:39.069030779 +0300
@@ -351,27 +351,6 @@
_exit(127);
}
- if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
- /* When dropping privileges from root, the `setgroups` call will
- * remove any extraneous groups. If we don't call this, then
- * even though our uid has dropped, we may still have groups
- * that enable us to do super-user things. This will fail if we
- * aren't root, so don't bother checking the return value, this
- * is just done as an optimistic privilege dropping function.
- */
- SAVE_ERRNO(setgroups(0, NULL));
- }
-
- if ((options->flags & UV_PROCESS_SETGID) && setgid(options->gid)) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
-
- if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) {
- uv__write_int(error_fd, UV__ERR(errno));
- _exit(127);
- }
-
if (options->env != NULL) {
environ = options->env;
}