mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fix static mounts using relative paths and prevent traversal exploits (#554)
Thanks, @abdusco! Closes #555
This commit is contained in:
parent
9ca860e54f
commit
74ecf8a7cc
3 changed files with 9 additions and 2 deletions
|
|
@ -735,7 +735,8 @@ class StaticMount(click.ParamType):
|
|||
param,
|
||||
ctx,
|
||||
)
|
||||
path, dirpath = value.split(":")
|
||||
path, dirpath = value.split(":", 1)
|
||||
dirpath = os.path.abspath(dirpath)
|
||||
if not os.path.exists(dirpath) or not os.path.isdir(dirpath):
|
||||
self.fail("%s is not a valid directory path" % value, param, ctx)
|
||||
return path, dirpath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue