kemal icon indicating copy to clipboard operation
kemal copied to clipboard

Only follow symlinks within configured static file handler directory

Open spinscale opened this issue 5 years ago • 3 comments

This adds an additional check to only follow symlinks that are within the configured public directory of a static file handler.

This ensures a malicious user cannot link to any files outside of the public directory to prevent reading arbitrary files.

spinscale avatar Jul 29 '19 21:07 spinscale

I'm not sure if this is a great enhancement. It's too restrictive. A harmless user might link a file outside the public directory with honest intentions. This is a quite common practice, actually. I wouldn't want to disable that.

And a malicious user would need write access to the public directory in the first place, in order to link to something outside of it.

Maybe this could be an optional feature?

straight-shoota avatar Jul 29 '19 22:07 straight-shoota

interesting. I did consider this more of a security issue, as the person running an app is not necessarily the same administering the system. Would you accept this, when this is made configurable? Then I'm happy to change.

spinscale avatar Jul 31 '19 13:07 spinscale

Having this as an option should be fine.

straight-shoota avatar Jul 31 '19 16:07 straight-shoota