repl: create history file with mode 0600.#3394
Conversation
3d57ee8 to
9ec50f0
Compare
lib/internal/repl.js
Outdated
There was a problem hiding this comment.
you can use an octal literal: 0o0600
9ec50f0 to
4e6c697
Compare
|
LGTM if CI is happy. |
|
Fixes: #3392 |
|
Tried it on Windows, and the returned stat is 010666. I guess that's because Windows uses a different permission model; do you think it okay to skip this test on Windows? |
|
I think so but lets ask @nodejs/platform-windows |
|
I changed To just this So that it would report the actual value. Result is here. So, Windows is creating the file with mode 0666 rather than 0600. The question is: Is this a bug in the code that creates the file or is it a limitation of running the Node.js REPL on the Windows operating system? |
|
The code uses |
|
This comment in the |
|
From docs of CreateFile:
So privacy on the history file relies on the user having a fine ACL in his/her home directory (which appers to be like |
|
Cool. LGTM if CI passes. |
|
All test failures are just the unrelated usual suspects and something weird with OS X such that it won't even build or something. In other words: 👍 Hopefully someone else can give it an LGTM too. |
There was a problem hiding this comment.
You can use assert.ifError instead of this if block.
There was a problem hiding this comment.
I see there are other tests writing if (err) throw err; e.g. test-fs-write. Does the current style explicitly prefer assert.ifError? If not I think this if block is also okay.
There was a problem hiding this comment.
No need to use assert here, this is common practice.
|
Seems fine to me. |
|
@Fishrock123 Does that constitute an LGTM? |
There was a problem hiding this comment.
Could you make this consistent with the other test? '.node_repl_history'
|
@Fishrock123 file name changed, not rebasing. |
|
Please check this commit. Discovered we have |
Undefined. |
|
What's the status on this one? |
|
Seems like maintainers did not agree on the tests. Anyway there are no conflicts, a rebase is easy, so let me know if you want this landed. |
|
@nodejs/collaborators @nodejs/ctc ... does anyone have any further thoughts on this one? |
|
ci is green, I can't really make an informative opinion about this though |
|
|
|
Ok, LGTM then |
|
LGTM |
lib/internal/repl.js
Outdated
There was a problem hiding this comment.
Nit: Would you mind adding a quick code comment with a quick explanation here. Nothing complicated, just enough for someone scanning through to know why the flag was set to this.
|
Added a couple of comments that I'd like to see addressed before this lands. Otherwise LGTM |
|
What semver-iness would this be? I'm thinking just a patch (because I'd consider this a bug fix) but figured I'd ask. |
|
I don't think it would be major. |
Test code mostly written by Trott nodejs#3392 (comment).
Added, pointing to this PR and issue.
Me too, changed it to the masked version. |
|
LGTM if CI is green |
Set the mode bits on the history file to 0o600 instead of leaving it unspecified, which resulted in 0o755 on Unices. Test code mostly written by Trott: #3392 (comment). PR-URL: #3394 Fixes: #3392 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Thanks you! Landed in b72d048. |
Set the mode bits on the history file to 0o600 instead of leaving it unspecified, which resulted in 0o755 on Unices. Test code mostly written by Trott: #3392 (comment). PR-URL: #3394 Fixes: #3392 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Set the mode bits on the history file to 0o600 instead of leaving it unspecified, which resulted in 0o755 on Unices. Test code mostly written by Trott: #3392 (comment). PR-URL: #3394 Fixes: #3392 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Set the mode bits on the history file to 0o600 instead of leaving it unspecified, which resulted in 0o755 on Unices. Test code mostly written by Trott: #3392 (comment). PR-URL: #3394 Fixes: #3392 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Set the mode bits on the history file to 0o600 instead of leaving it unspecified, which resulted in 0o755 on Unices. Test code mostly written by Trott: #3392 (comment). PR-URL: #3394 Fixes: #3392 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Test code mostly written by Trott
#3392 (comment).