File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ func (s *Server) Reload(cfg srvCfg.Config) {
187
187
188
188
// InitHandlers initializes handler functions of the HTTP server.
189
189
func (s * Server ) InitHandlers () {
190
- r := mux .NewRouter ().StrictSlash (true )
190
+ r := mux .NewRouter ().StrictSlash (true ). UseEncodedPath ()
191
191
192
192
authMW := mw .NewAuth (s .Config .VerificationToken , s .Platform )
193
193
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package validator
7
7
8
8
import (
9
9
"fmt"
10
+ "strings"
10
11
11
12
"github.com/pkg/errors"
12
13
passwordvalidator "github.com/wagslane/go-password-validator"
@@ -34,6 +35,10 @@ func (v Service) ValidateCloneRequest(cloneRequest *types.CloneCreateRequest) er
34
35
return errors .New ("missing DB password" )
35
36
}
36
37
38
+ if cloneRequest .ID != "" && strings .Contains (cloneRequest .ID , "/" ) {
39
+ return errors .New ("Clone ID cannot contain slash ('/'). Please choose another ID" )
40
+ }
41
+
37
42
if err := passwordvalidator .Validate (cloneRequest .DB .Password , minEntropyBits ); err != nil {
38
43
return fmt .Errorf ("password validation: %w" , err )
39
44
}
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ func TestValidationCloneRequestErrors(t *testing.T) {
55
55
createRequest : types.CloneCreateRequest {DB : & types.DatabaseRequest {Password : "password" }},
56
56
error : "missing DB username" ,
57
57
},
58
+ {
59
+ createRequest : types.CloneCreateRequest {
60
+ DB : & types.DatabaseRequest {Username : "user" , Password : "password" },
61
+ ID : "test/ID" ,
62
+ },
63
+ error : "Clone ID cannot contain slash ('/'). Please choose another ID" ,
64
+ },
58
65
}
59
66
60
67
for _ , tc := range testCases {
You can’t perform that action at this time.
0 commit comments