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

is_file_hidden_posix() has problem with symlinks where target is not accessible #224

Closed
rcthomas opened this issue Apr 27, 2021 · 3 comments

Comments

@rcthomas
Copy link

It seems that in is_file_hidden_posix() an exception is raised if it comes across a symlink where the target path is not accesssible to the user (PermissionError). This has the effect of stopping the file contents manager from displaying the contents of a directory containing such links in JupyterLab 3.

Right now if os.stat() raises errno.ENOENT then the function returns False. I find that if I allow the function to similarly return False if os.stat() raises errno.EACCES, then the file listing works.

Is this an actual bug (and fix) and if so maybe does it need to be applied in the non-posix function as well?

@kevin-bates
Copy link
Member

Hi @rcthomas. I think the intention relative to EACCES is that files in which the active user is denied access should not show up in any listing, irrespective of the allow_hidden trait, as that can be considered a security issue. As a result, I'm inclined to say the calling application should handle raised exceptions (and be responsible for not hinting that a file may be protected).

I suppose one could view denied files as "hidden", but given the trait's existence, I think that would still be considered a security issue. (I also think the directory listing logic in server could use some refactoring since it could still expose these kinds of files in listings and/or warning messages - as well as the fact that EACCES terminates the listing.)

@rcthomas
Copy link
Author

Thanks for explaining, I suppose then this more appropriate to discuss at jupyter_server then?

@kevin-bates
Copy link
Member

Yes, I believe so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants