Skip to content

Commit

Permalink
fixup! RHINENG-12951: fix CWE-918
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMraka committed Oct 4, 2024
1 parent 5474f6c commit b7acfc6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions turnpike/controllers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"io"
"net/http"
"path"
"regexp"
"slices"
"strconv"
Expand Down Expand Up @@ -311,15 +312,10 @@ func getPprof(address, param, query string) ([]byte, error) {
client := &http.Client{
Timeout: time.Second * 60,
}
urlPath := address + "/debug/pprof/"
if len(param) > 0 {
urlPath = urlPath + param
}
if len(query) > 0 {
// param = param + "?" + query
urlPath = urlPath + "?" + query
param = param + "?" + query
}
// urlPath := fmt.Sprintf("%s/debug/pprof/%s", address, param)
urlPath := fmt.Sprintf("%s/debug/pprof/%s", address, path.Clean(param))
req, err := http.NewRequest(http.MethodGet, urlPath, nil)
if err != nil {
return nil, err
Expand Down

0 comments on commit b7acfc6

Please sign in to comment.