Skip to content

Commit

Permalink
Revert "src: runtime deprecate process.umask()"
Browse files Browse the repository at this point in the history
This reverts commit 60c4c2b.

PR-URL: nodejs#35332
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
  • Loading branch information
BethGriggs authored and joesepi committed Oct 22, 2020
1 parent a446be9 commit 4f3d586
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 31 deletions.
4 changes: 2 additions & 2 deletions doc/api/deprecations.md
Expand Up @@ -2531,10 +2531,10 @@ purpose and is only available on CommonJS environment.
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/32499
description: Runtime deprecation.
description: Documentation-only deprecation.
-->

Type: Runtime
Type: Documentation-only

Calling `process.umask()` with no argument causes the process-wide umask to be
written twice. This introduces a race condition between threads, and is a
Expand Down
8 changes: 0 additions & 8 deletions src/env-inl.h
Expand Up @@ -808,14 +808,6 @@ void Environment::set_filehandle_close_warning(bool on) {
emit_filehandle_warning_ = on;
}

bool Environment::emit_insecure_umask_warning() const {
return emit_insecure_umask_warning_;
}

void Environment::set_emit_insecure_umask_warning(bool on) {
emit_insecure_umask_warning_ = on;
}

void Environment::set_source_maps_enabled(bool on) {
source_maps_enabled_ = on;
}
Expand Down
3 changes: 0 additions & 3 deletions src/env.h
Expand Up @@ -1160,8 +1160,6 @@ class Environment : public MemoryRetainer {

inline bool filehandle_close_warning() const;
inline void set_filehandle_close_warning(bool on);
inline bool emit_insecure_umask_warning() const;
inline void set_emit_insecure_umask_warning(bool on);

inline void set_source_maps_enabled(bool on);
inline bool source_maps_enabled() const;
Expand Down Expand Up @@ -1386,7 +1384,6 @@ class Environment : public MemoryRetainer {
bool emit_env_nonstring_warning_ = true;
bool emit_err_name_warning_ = true;
bool emit_filehandle_warning_ = true;
bool emit_insecure_umask_warning_ = true;
bool source_maps_enabled_ = false;

size_t async_callback_scope_depth_ = 0;
Expand Down
11 changes: 0 additions & 11 deletions src/node_process_methods.cc
Expand Up @@ -206,17 +206,6 @@ static void Umask(const FunctionCallbackInfo<Value>& args) {

uint32_t old;
if (args[0]->IsUndefined()) {
if (env->emit_insecure_umask_warning()) {
env->set_emit_insecure_umask_warning(false);
if (ProcessEmitDeprecationWarning(
env,
"Calling process.umask() with no arguments is prone to race "
"conditions and is a potential security vulnerability.",
"DEP0139").IsNothing()) {
return;
}
}

old = umask(0);
umask(static_cast<mode_t>(old));
} else {
Expand Down
7 changes: 0 additions & 7 deletions test/parallel/test-process-umask.js
Expand Up @@ -40,13 +40,6 @@ if (common.isWindows) {
mask = '0664';
}

common.expectWarning(
'DeprecationWarning',
'Calling process.umask() with no arguments is prone to race conditions ' +
'and is a potential security vulnerability.',
'DEP0139'
);

const old = process.umask(mask);

assert.strictEqual(process.umask(old), parseInt(mask, 8));
Expand Down

0 comments on commit 4f3d586

Please sign in to comment.