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

net: allow IPC servers be accessible by all #19472

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
9 participants
@bzoz
Contributor

bzoz commented Mar 20, 2018

Adds mappings to uv_pipe_chmod call by adding two new options to listen call. This allows the IPC server pipe to be made readable or writable by all users.

Fixes: #19154

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
@bzoz

This comment has been minimized.

Contributor

bzoz commented Mar 20, 2018

@@ -250,6 +250,10 @@ added: v0.11.14
* `backlog` {number} Common parameter of [`server.listen()`][]
functions.
* `exclusive` {boolean} **Default:** `false`
* `readable_all` {boolean} For IPC servers makes the pipe readable
for all users. ***Default:** `false`

This comment has been minimized.

@vsemozhetbyt

vsemozhetbyt Mar 20, 2018

Member

Nit: *** -> **

* `readable_all` {boolean} For IPC servers makes the pipe readable
for all users. ***Default:** `false`
* `writable_all` {boolean} For IPC servers makes the pipe writable
for all users. ***Default:** `false`

This comment has been minimized.

@vsemozhetbyt

vsemozhetbyt Mar 20, 2018

Member

Nit: *** -> **

@@ -250,6 +250,10 @@ added: v0.11.14
* `backlog` {number} Common parameter of [`server.listen()`][]
functions.
* `exclusive` {boolean} **Default:** `false`
* `readable_all` {boolean} For IPC servers makes the pipe readable

This comment has been minimized.

@cjihrig

cjihrig Mar 21, 2018

Contributor

These options should be camelCase.

lib/net.js Outdated
@@ -1524,6 +1524,13 @@ Server.prototype.listen = function(...args) {
backlog = options.backlog || backlogFromArgs;
listenInCluster(this, pipeName, -1, -1,
backlog, undefined, options.exclusive);
let mode = 0;
if (!!options.readable_all)

This comment has been minimized.

@cjihrig

cjihrig Mar 21, 2018

Contributor

Since these are expected to be booleans, you could do options.readableAll === true.

@bzoz

This comment has been minimized.

Contributor

bzoz commented Mar 21, 2018

@bzoz

This comment has been minimized.

Contributor

bzoz commented Mar 29, 2018

ping

CI failures are unrelated.

@vsemozhetbyt

This comment has been minimized.

Member

vsemozhetbyt commented Mar 29, 2018

As per "Who to cc...", cc @bnoordhuis, @indutny, @nodejs/streams

@bnoordhuis

Pinging @santigimeno since he also reviewed the libuv pull request.

* `readableAll` {boolean} For IPC servers makes the pipe readable
for all users. **Default:** `false`
* `writableAll` {boolean} For IPC servers makes the pipe writable
for all users. **Default:** `false`

This comment has been minimized.

@bnoordhuis

bnoordhuis Mar 29, 2018

Member

Should explain why you would want to do that, not just how.

lib/net.js Outdated
let mode = 0;
if (options.readableAll === true)
mode |= PipeConstants.READABLE_ALL;
if (options.writableAll === true)

This comment has been minimized.

@bnoordhuis

bnoordhuis Mar 29, 2018

Member

Just curious, what is the reason you went for strict true-ness instead of truthiness?

lib/net.js Outdated
if (options.writableAll === true)
mode |= PipeConstants.WRITABLE_ALL;
if (mode !== 0)
this._handle.fchmod(mode);

This comment has been minimized.

@bnoordhuis

bnoordhuis Mar 29, 2018

Member

Check the return value.

@santigimeno

Changes LGTM. A couple of comments:

  • I guess it's not easy testing this functionality on every platform but we could add tests that at least make sure that the changes don't break anything. We could even use fs.stat to check the mode of the pipe path on unices?
  • We should merge libuv/libuv#1635 soon to fix uv_pipe_chmod on OS X.
@BridgeAR

This comment has been minimized.

Member

BridgeAR commented Apr 16, 2018

@bzoz seems like the tests are failing.

@bzoz

This comment has been minimized.

Contributor

bzoz commented Apr 16, 2018

Linux failures seem unrelated, re-running the CI just to make sure: https://ci.nodejs.org/job/node-test-pull-request/14333/

@bzoz

This comment has been minimized.

Contributor

bzoz commented Apr 17, 2018

Failures look unrelated, PTAL

@bzoz bzoz removed the in progress label Apr 17, 2018

@bzoz

This comment has been minimized.

Contributor

bzoz commented Apr 19, 2018

Ping?

@BridgeAR

This comment has been minimized.

Member

BridgeAR commented Apr 28, 2018

It would be good to get some further LGs for this. Ping @nodejs/http @nodejs/http2 @nodejs/streams

void PipeWrap::Fchmod(const v8::FunctionCallbackInfo<v8::Value>& args) {
PipeWrap* wrap;
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
int mode = args[0]->Int32Value();

This comment has been minimized.

@addaleax

addaleax May 5, 2018

Member

Could you use the overload that takes a context argument, or (even better imo) write this as

CHECK(args[0]->IsInt32());
int mode = args[0].As<Int32>()->Value();

?

enum PipeChmod {
READABLE_ALL = UV_READABLE,
WRITABLE_ALL = UV_WRITABLE
};

This comment has been minimized.

@addaleax

addaleax May 5, 2018

Member

Is there any reason not to expose the libuv names directly? Makes things a bit more grepable :)

@addaleax addaleax removed the author ready label May 14, 2018

@addaleax

This comment has been minimized.

Member

addaleax commented May 14, 2018

Gentle ping in the direction of @bzoz :)

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: #19154
@bzoz

This comment has been minimized.

Contributor

bzoz commented May 17, 2018

Updated (and rebased), PTAL

@bzoz

This comment has been minimized.

Contributor

bzoz commented May 21, 2018

@bzoz

This comment has been minimized.

Contributor

bzoz commented May 23, 2018

Failures are unrelated, If no one objects I'll land this tomorrow.

@bzoz

This comment has been minimized.

Contributor

bzoz commented May 24, 2018

Landed in 531b4be

@bzoz bzoz closed this May 24, 2018

bzoz added a commit that referenced this pull request May 24, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: #19154

PR-URL: #19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

@targos targos added the semver-minor label May 25, 2018

@targos

This comment has been minimized.

Member

targos commented May 25, 2018

Marking semver-minor because of the two new options.

targos added a commit that referenced this pull request May 25, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: #19154

PR-URL: #19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

MylesBorins added a commit that referenced this pull request May 29, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    #20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    #21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    #19472
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL:

@MylesBorins MylesBorins referenced this pull request May 29, 2018

Merged

v10.3.0 proposal #21011

MylesBorins added a commit that referenced this pull request May 29, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    #20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    #21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    #19472
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: #21011

MylesBorins added a commit that referenced this pull request May 29, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    #20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    #21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    #19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    #20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: #21011

MylesBorins added a commit that referenced this pull request May 29, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    #20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    #21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    #19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    #20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: #21011

MylesBorins added a commit that referenced this pull request May 29, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    #20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    #21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    #19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    #20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: #21011

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 5, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 5, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011

shisama added a commit to shisama/node that referenced this pull request Jun 9, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 9, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011

shisama added a commit to shisama/node that referenced this pull request Jun 11, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 11, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011

shisama added a commit to shisama/node that referenced this pull request Jun 12, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 12, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011

shisama added a commit to shisama/node that referenced this pull request Jun 17, 2018

net: allow IPC servers be accessible by all
Adds mappings to uv_pipe_chmod call by adding two new options to
listen call. This allows the IPC server pipe to be made readable or
writable by all users.

Fixes: nodejs#19154

PR-URL: nodejs#19472
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

shisama added a commit to shisama/node that referenced this pull request Jun 17, 2018

2018-05-29, Version 10.3.0 (Current)
Notable Changes:

* **deps**:
  - upgrade npm to 6.1.0 (Rebecca Turner)
    nodejs#20190
* **fs**:
  - fix reads with pos \> 4GB (Mathias Buus)
    nodejs#21003
* **net**:
  - new option to allow IPC servers to be readable and writable
    by all users (Bartosz Sosnowski)
    nodejs#19472
* **stream**:
  - fix removeAllListeners() for Stream.Readable to work as expected
    when no arguments are passed (Kael Zhang)
    nodejs#20924
* **Added new collaborators**
  - John-David Dalton (https://github.com/jdalton)

PR-URL: nodejs#21011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment