Commit dc6b93e2 authored by Ava Howell's avatar Ava Howell

paths beginning with ./ should not be valid either

parent 263965b3
......@@ -49,7 +49,7 @@ var (
// ../ is disallowed to prevent directory traversal,
// and paths must not begin with / or be empty.
func validateSiapath(siapath string) error {
if strings.HasPrefix(siapath, "/") {
if strings.HasPrefix(siapath, "/") || strings.HasPrefix(siapath, "./") {
return errors.New("nicknames cannot begin with /")
}
......
......@@ -16,7 +16,7 @@ func TestRenterSiapathValidate(t *testing.T) {
{"valid/siapath/../with/directory/traversal", false},
{"validpath/test", true},
{"..validpath/..test", true},
{"./valid/path", true},
{"./invalid/path", false},
{"test/path", true},
{"/leading/slash", false},
{"", false},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment