From 4f3d586e23bffe1d7a27949a652f7a3a32f82a5b Mon Sep 17 00:00:00 2001 From: Beth Griggs Date: Thu, 24 Sep 2020 23:02:33 +0100 Subject: [PATCH] Revert "src: runtime deprecate process.umask()" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 60c4c2b6c557efbb2f8f3a3de147baf987931d41. PR-URL: https://github.com/nodejs/node/pull/35332 Reviewed-By: Colin Ihrig Reviewed-By: Michaƫl Zasso Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Ruy Adorno --- doc/api/deprecations.md | 4 ++-- src/env-inl.h | 8 -------- src/env.h | 3 --- src/node_process_methods.cc | 11 ----------- test/parallel/test-process-umask.js | 7 ------- 5 files changed, 2 insertions(+), 31 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 811821239e33c0..cf1a3239e81ff1 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -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 diff --git a/src/env-inl.h b/src/env-inl.h index de3d651fa7dd9b..ec80faba4c49e2 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -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; } diff --git a/src/env.h b/src/env.h index 16546fdd49408b..410d5c3fc9dd06 100644 --- a/src/env.h +++ b/src/env.h @@ -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; @@ -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; diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 105cbff151b151..1d8bcd54057f7b 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -206,17 +206,6 @@ static void Umask(const FunctionCallbackInfo& 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(old)); } else { diff --git a/test/parallel/test-process-umask.js b/test/parallel/test-process-umask.js index e74c71e1935246..85af91620709c7 100644 --- a/test/parallel/test-process-umask.js +++ b/test/parallel/test-process-umask.js @@ -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));