Skip to content

Commit

Permalink
Fix reflected XSS vulnerability in the Webhook server.
Browse files Browse the repository at this point in the history
If the body of the request was not correctly read the error provided was directly sent to the user. Now a standard error message is sent every time there is a problem in the processing of the request body, this fix avoid also the information leakage due to the use of  specific errors for every different problem.
  • Loading branch information
Andreagit97 committed Jul 12, 2021
1 parent 0edb724 commit 63123a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/mutate/server.go
Expand Up @@ -62,15 +62,16 @@ func NewMutationServer(ctx context.Context, c *MutationConfig) (*MutationServer,
func (s *MutationServer) handleMutate(w http.ResponseWriter, r *http.Request) {
// read the body / request
body, err := ioutil.ReadAll(r.Body)

if err != nil {
err = fmt.Errorf("unable to correctly read the body of the request")
s.sendError(err, w)
return
}

// mutate the request
mutated, err := s.Mutate(body)
if err != nil {
err = fmt.Errorf("unable to correctly mutate the request")
s.sendError(err, w)
return
}
Expand Down

0 comments on commit 63123a6

Please sign in to comment.