id,node_id,number,state,locked,title,user,body,created_at,updated_at,closed_at,merged_at,merge_commit_sha,assignee,milestone,draft,head,base,author_association,repo,url,merged_by,auto_merge 295711504,MDExOlB1bGxSZXF1ZXN0Mjk1NzExNTA0,554,closed,0,Fix static mounts using relative paths and prevent traversal exploits,3243482,"While debugging why my static mounts using a relative path (`--static mystatic:rel/path/to/dir`) not working, I noticed that the requests fail no matter what, returning 404 errors. The reason is that datasette tries to prevent traversal exploits by checking if the path is relative to its registered directory. This check fails when the mount is a relative directory, because `/abs/dir/file` obviously not under `dir/file`. https://github.com/simonw/datasette/blob/81fa8b6cdc5457b42a224779e5291952314e8d20/datasette/utils/asgi.py#L303-L306 This also has the consequence of returning any requested file, because when `/abs/dir/../../evil.file` resolves `aiofiles` happily returns it to the client after it resolves the path itself. The solution is to make sure we're checking relativity of paths after they're fully resolved. I've implemented the mentioned changes and also updated the tests.",2019-07-09T11:32:02Z,2019-07-11T16:29:26Z,2019-07-11T16:13:19Z,2019-07-11T16:13:19Z,74ecf8a7cc45cabf369e510c7214f5ed85c8c6d8,,,0,fa7ddea3ea6c9378bee7d5f5c93fe05d735a0afb,81fa8b6cdc5457b42a224779e5291952314e8d20,CONTRIBUTOR,107914493,https://github.com/simonw/datasette/pull/554,,