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

Windows standard user cannot run any node 6 js file on mapped path #7192

Closed
Jackbennett opened this issue Jun 7, 2016 · 13 comments
Closed
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@Jackbennett
Copy link

  • Version: 6.2.1
  • Platform: Windows 7, x64
  • Subsystem: fs

Seems related to #7175 because of #3594.

The only folder our users can write to is their home at N:\ which is a map of \\servername\share$\students\group\**userHome**. Bold is the only folder that doesn't return a permission error "operation not permitted" with fs.statSync()

run from a normal powershell command prompt;

PS N:\permTest> node .\index.js
fs.js:1568
  return binding.realpath(pathModule._makeLong(path), options.encoding);
                 ^
Error: EPERM: operation not permitted, realpath 'N:\permTest\index.js'
    at Error (native)
    at Object.realpathSync (fs.js:1568:18)
    at Function.Module._findPath (module.js:167:25)
    at Function.Module._resolveFilename (module.js:438:25)
    at Function.Module._load (module.js:388:25)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:456:3
 PS N:\permTest> node
> 1 + 1
2
> fs.readdirSync('.')
[ 'index.js', 'npm-debug.log', 'package.json' ]

> fs.access('.', fs.F_OK, function(err){if (err){ console.log(err)} console.log('yes')})
yes
> fs.access('.', fs.R_OK, function(err){if (err){ console.log(err)} console.log('yes')})
yes
fs.access('.', fs.W_OK, function(err){if (err){ console.log(err)} console.log('yes')})
yes
> fs.access('.', fs.X_OK, function(err){if (err){ console.log(err)} console.log('yes')})
yes

note: permTest/index.js is just a module that does the above pasted fs.access tests.

This happens when trying to execute any file with node.

@addaleax addaleax added the fs Issues and PRs related to the fs subsystem / file system. label Jun 7, 2016
@mscdex mscdex added the windows Issues and PRs related to the Windows platform. label Jun 7, 2016
@saghul
Copy link
Member

saghul commented Jun 22, 2016

I suspect this has to do with our realpath not properly handling reparse points.

@Jackbennett
Copy link
Author

Probably irrelevant but I've been happily using npm link on a locally attached drive path. But that being an ntfs thing I assume node shouldn't even see it. But I'm not surprised I can't use a symlink on a mapped unc path. Just in case that clarifies anything.

@trevnorris
Copy link
Contributor

@saghul

I suspect this has to do with our realpath not properly handling reparse points.

Can you elaborate on this, or is there an issue already addressing this?

@saghul
Copy link
Member

saghul commented Jul 11, 2016

@trevnorris This is the issue referencing that. I plan on looking into it this week (finally). I'm not sure if reparse points (used to implement links on NTFS for example) are the culprit here (I have come to think they aren't), but there is certainly something to be done for mapped drives in uv_fs_realpath.

@saghul
Copy link
Member

saghul commented Jul 13, 2016

@Jackbennett Is that a samba share? I just tested it by mapping a share on my OSX laptop and doing a fs.realpathSync on it works for me.

@Jackbennett
Copy link
Author

Jackbennett commented Jul 13, 2016

Yes this is mapped from a fully patch 2012 server. Not r2. I find the issue is when you don't have permissions to access parent folders but you do for the child folder target being mapped.

e.g. \\server\Allstudents\yearX\username obviously the user account only has RWX to username and nothing at all between server\ to server\Allstudents\yearX\

edit: and to be clear N:\ is mapped to \\server\Allstudents\yearX\username

If I can get time I'll test a user that can read the whole folder path. This works for myself as a sysadmin I can get to that whole path.

I wonder if you share a folder and remove your permissions to its parents if osx can show the same behaviour.

@saghul
Copy link
Member

saghul commented Jul 13, 2016

@Jackbennett thanks! Just to confirm this is related to #3594 or not: does this work for you on Node v4?

@Jackbennett
Copy link
Author

We've got a class happily using node v4 anywhere in the school. This was only an issue in a room I deployed v6 to.

@saghul
Copy link
Member

saghul commented Jul 13, 2016

Damn. Thanks for confirming.

@Fishrock123
Copy link
Contributor

Does #7559 fix this?

@addaleax
Copy link
Member

Does #7559 fix this?

/cc @bzoz

I don’t think so, but #7559 should make it easier to fix it.

@bzoz
Copy link
Contributor

bzoz commented Jul 14, 2016

@addaleax: you are right: #7559 won't fix this, but it sure will make it easy to do so

@Jackbennett
Copy link
Author

Trying to play along at home here too ;) Even if the path n:\ is being resolved to \\a\b\c Why is node trying to do anything to \\a or \\a\b\ which causes it to crash. It only needs to touch \\a\b\c or down to \\a\b\c\node_modules?

bzoz added a commit to JaneaSystems/node that referenced this issue Aug 5, 2016
This reverts parts of nodejs@b488b19
restoring javascript implementation of realpath and realpathSync.

Fixes: nodejs#7175
Fixes: nodejs#6861
Fixes: nodejs#7294
Fixes: nodejs#7192
Fixes: nodejs#7044
Fixes: nodejs#6624
Fixes: nodejs#6978
@bzoz bzoz closed this as completed in 08996fd Aug 12, 2016
cjihrig pushed a commit that referenced this issue Aug 15, 2016
This reverts parts of b488b19
restoring javascript implementation of realpath and realpathSync.

Fixes: #7175
Fixes: #6861
Fixes: #7294
Fixes: #7192
Fixes: #7044
Fixes: #6624
Fixes: #6978
PR-URL: #7899
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

7 participants