GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — process: passing -1 to setuid/setgid should not abort · nodejs/node@94afc3e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/bootstrap/switches
    • does_own_process_state.js
  • test/parallel
    • test-process-uid-gid.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/bootstrap/switches/does_own_process_state.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/switches/does_own_process_state.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function wrapPosixCredentialSetters(credentials) {
8080
function wrapIdSetter(type, method) {
8181
return function(id) {
8282
validateId(id, 'id');
83+
if (typeof id === 'number') id |= 0;
8384
// Result is 0 on success, 1 if credential is unknown.
8485
const result = method(id);
8586
if (result === 1) {
Collapse file

‎test/parallel/test-process-uid-gid.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-uid-gid.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ assert.throws(() => {
5151
message: 'User identifier does not exist: fhqwhgadshgnsdhjsdbkhsdabkfabkveyb'
5252
});
5353

54+
// Passing -0 shouldn't crash the process
55+
// Refs: https://github.com/nodejs/node/issues/32750
56+
try { process.setuid(-0); } catch {}
57+
try { process.seteuid(-0); } catch {}
58+
try { process.setgid(-0); } catch {}
59+
try { process.setegid(-0); } catch {}
60+
5461
// If we're not running as super user...
5562
if (process.getuid() !== 0) {
5663
// Should not throw.
@@ -79,6 +86,7 @@ try {
7986
}
8087
process.setgid('nogroup');
8188
}
89+
8290
const newgid = process.getgid();
8391
assert.notStrictEqual(newgid, oldgid);
8492

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.