Path.normalize() and Path.resolve() will help you
Hi there,I started hacking around with with Luvit just today. I am pretty experienced in Lua and Ruby, but not so much in node.js . So please be gentle :)While examining the "static file server" in the examples folder, I realized that it was not very "secure" - someone could, for example, use "dot dot" in the url to get access to files outside the www root. In order to learn, I'm trying to add "security", so those upper accesses are rejected. I would like "dot dot" to be allowed if the resulting path was viewable to users.IMHO the easiest way to do that would be to finding a way to "absolutize" folders. Once the "root" path and the "request" path are absolutized, finding out whether one is inside the other is simple.Ideally, I would like something similar to this:path.absolutize(".") -- return /home/username/projects/luvit/serverI checked, and path doesn't seem to offer this. I think neither does node, so maybe I'm just asking the wrong question.Is what I'm asking possible?Thanks a lot,Enrique
Path.normalize() and Path.resolve() will help you
I'd recommend you to put security efforts to
https://github.com/dvv/luvit-static -- it's used to serve
http://luvit.io