Skip to content

Commit

Permalink
[R4R] - {develop}: fix consensys audit issue: cs-6.40 (#1210)
Browse files Browse the repository at this point in the history
replace json.MarshalIndent with json.Marshal to improve effiency

Co-authored-by: Raymond <[email protected]>
  • Loading branch information
HaoyangLiu and wukongcheng authored Jul 2, 2023
1 parent 630afaa commit 56a1d4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tss/node/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func (hs *Server) newHandler(jwtSecretStr string) (http.Handler, error) {
router.Use(logMiddleware())
if jwtSecretStr != "" {
return cmm.NewJwtHandler(router, jwtSecretStr)
}else {
return router,nil
} else {
return router, nil
}
}

Expand Down Expand Up @@ -196,7 +196,7 @@ func (hs *Server) keySignHandler(w http.ResponseWriter, r *http.Request) {
return
}

jsonResult, err := json.MarshalIndent(signResp, "", " ")
jsonResult, err := json.Marshal(signResp)
if err != nil {
hs.logger.Error().Err(err).Msg("fail to marshal response to json message")
w.WriteHeader(http.StatusInternalServerError)
Expand Down
2 changes: 1 addition & 1 deletion tss/ws/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func (wsc *wsConnection) writeRoutine() {
}
case msg := <-wsc.requestChan:
wsc.Logger.Info("send msg from requestChan to target client", "method", msg.Method)
jsonBytes, err := json.MarshalIndent(msg, "", " ")
jsonBytes, err := json.Marshal(msg)
if err != nil {
wsc.Logger.Error("Failed to marshal RPCRequest to JSON", "err", err)
continue
Expand Down

0 comments on commit 56a1d4e

Please sign in to comment.