MCPcopy Create free account
hub / github.com/zalando/skipper / maskQueryParams

Function maskQueryParams

logging/access.go:123–136  ·  view source on GitHub ↗

maskQueryParams masks (i.e., hashing) specific query parameters in the provided request's URI. Returns the obfuscated URI.

(req *http.Request, maskedQueryParams map[string]struct{})

Source from the content-addressed store, hash-verified

121// maskQueryParams masks (i.e., hashing) specific query parameters in the provided request's URI.
122// Returns the obfuscated URI.
123func maskQueryParams(req *http.Request, maskedQueryParams map[string]struct{}) string {
124 strippedURI := stripQueryString(req.RequestURI)
125
126 params := req.URL.Query()
127 for k := range maskedQueryParams {
128 val := params.Get(k)
129 if val == "" {
130 continue
131 }
132 params.Set(k, fmt.Sprintf("%d", hash(val)))
133 }
134
135 return fmt.Sprintf("%s?%s", strippedURI, params.Encode())
136}
137
138func hash(val string) uint64 {
139 return xxhash.Sum64String(val)

Callers 1

LogAccessMethod · 0.85

Calls 4

stripQueryStringFunction · 0.85
hashFunction · 0.70
GetMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…