Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v12.x backport] doc: deprecate process.umask() with no arguments #34591

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2542,6 +2542,24 @@ accordingly instead to avoid the ambigiuty.
To maintain existing behaviour `response.finished` should be replaced with
`response.writableEnded`.

<a id="DEP0139"></a>
### DEP0139: `process.umask()` with no arguments
<!-- YAML
changes:
- version:
- REPLACEME
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
- v14.0.0
pr-url: https://github.com/nodejs/node/pull/32499
description: Documentation-only deprecation.
-->

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
potential security vulnerability. There is no safe, cross-platform alternative
API.

[`--http-parser=legacy`]: cli.html#cli_http_parser_library
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
Expand Down
31 changes: 24 additions & 7 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2393,17 +2393,35 @@ documentation for the [`'warning'` event][process_warning] and the
[`emitWarning()` method][process_emit_warning] for more information about this
flag's behavior.

## `process.umask([mask])`
## `process.umask()`
<!-- YAML
added: v0.1.19
changes:
- version:
- REPLACEME
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
- v14.0.0
pr-url: https://github.com/nodejs/node/pull/32499
description: Calling `process.umask()` with no arguments is deprecated.

-->

> Stability: 0 - Deprecated. 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 potential security vulnerability. There is no safe,
> cross-platform alternative API.

`process.umask()` returns the Node.js process's file mode creation mask. Child
processes inherit the mask from the parent process.

## `process.umask(mask)`
<!-- YAML
added: v0.1.19
-->

* `mask` {string|integer}

The `process.umask()` method sets or returns the Node.js process's file mode
creation mask. Child processes inherit the mask from the parent process. Invoked
without an argument, the current mask is returned, otherwise the umask is set to
the argument value and the previous mask is returned.
`process.umask(mask)` sets the Node.js process's file mode creation mask. Child
processes inherit the mask from the parent process. Returns the previous mask.

```js
const newmask = 0o022;
Expand All @@ -2413,8 +2431,7 @@ console.log(
);
```

[`Worker`][] threads are able to read the umask, however attempting to set the
umask will result in a thrown exception.
In [`Worker`][] threads, `process.umask(mask)` will throw an exception.

## `process.uptime()`
<!-- YAML
Expand Down