Skip to content

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

Description

@Jackbennett
  • 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.

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    on Jun 7, 2016
  2. added
    windowsIssues and PRs related to the Windows platform.
    on Jun 7, 2016
  3. saghul commented on Jun 22, 2016

    @saghul
    Member

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

  4. Jackbennett commented on Jun 22, 2016

    @Jackbennett
    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.

  5. trevnorris commented on Jul 8, 2016

    @trevnorris
    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?

  6. saghul commented on Jul 11, 2016

    @saghul
    Member

    @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.

  7. saghul commented on Jul 13, 2016

    @saghul
    Member

    @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.

  8. Jackbennett commented on Jul 13, 2016

    @Jackbennett
    Author

    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.

  9. saghul commented on Jul 13, 2016

    @saghul
    Member

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

  10. Jackbennett commented on Jul 13, 2016

    @Jackbennett
    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.

  11. saghul commented on Jul 13, 2016

    @saghul
    Member

    Damn. Thanks for confirming.

  12. Fishrock123 commented on Jul 13, 2016

    @Fishrock123
    Contributor

    Does #7559 fix this?

  13. addaleax commented on Jul 13, 2016

    @addaleax
    Member

    Does #7559 fix this?

    /cc @bzoz

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

  14. bzoz commented on Jul 14, 2016

    @bzoz
    Contributor

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

  15. Jackbennett commented on Jul 14, 2016

    @Jackbennett
    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions