Skip to content

Commit fb9d94a

Browse files
feat(API): Verify input of the base64 encoded kubeconfig.
1 parent 7e8209c commit fb9d94a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gotty/server/handlers.go

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package server
33
import (
44
"bytes"
55
"context"
6+
"encoding/base64"
67
"encoding/json"
78
"fmt"
89
"io/ioutil"
@@ -305,6 +306,13 @@ func (server *Server) handleKubeConfigApi(w http.ResponseWriter, r *http.Request
305306
w.WriteHeader(406)
306307
return
307308
}
309+
if _, base64err := base64.StdEncoding.DecodeString(request.KubeConfig); base64err != nil {
310+
result.Message = "Invalid Base64 Content"
311+
json.NewEncoder(w).Encode(result)
312+
w.WriteHeader(406)
313+
return
314+
}
315+
308316
//fmt.Printf("%+v", requst)
309317
token := randomstring.Generate(20)
310318
ttyParameter := cache.TtyParameter{

0 commit comments

Comments
 (0)