File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,18 @@ func munkiRepoFunc(w http.ResponseWriter, r *http.Request) {
9999
100100func munkiPkgFunc (cloudFrontURL string , signer * sign.URLSigner ) http.HandlerFunc {
101101 return func (w http.ResponseWriter , r * http.Request ) {
102+ pkgPath := chi .URLParam (r , "*" )
103+ if pkgPath == "" || strings .Contains (pkgPath , ".." ) {
104+ http .Error (w , "invalid path" , http .StatusBadRequest )
105+ return
106+ }
107+
102108 u , err := url .Parse (cloudFrontURL )
103109 if err != nil {
104110 http .Error (w , "failed to parse base url" , http .StatusInternalServerError )
105111 return
106112 }
107- u .Path = path .Join (u .Path , r . URL . Path )
113+ u .Path = path .Join (u .Path , "repo" , "pkgs" , pkgPath )
108114 finalURL := u .String ()
109115
110116 signedURL , err := signer .Sign (finalURL , time .Now ().Add (1 * time .Hour ))
You can’t perform that action at this time.
0 commit comments