MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / SanitizeRequestURL

Function SanitizeRequestURL

base/util.go:722–738  ·  view source on GitHub ↗

SanitizeRequestURL will return a sanitised string of the URL by: - Tagging mux path variables. - Tagging query parameters. - Replacing sensitive data from the URL query string with ******. Have to use string replacement instead of writing directly to the Values URL object, as only the URL's raw quer

(req *http.Request, cachedQueryValues *url.Values)

Source from the content-addressed store, hash-verified

720// - Replacing sensitive data from the URL query string with ******.
721// Have to use string replacement instead of writing directly to the Values URL object, as only the URL's raw query is mutable.
722func SanitizeRequestURL(req *http.Request, cachedQueryValues *url.Values) string {
723
724 // Populate a cached copy of query values if nothing is passed in.
725 if cachedQueryValues == nil {
726 v := req.URL.Query()
727 cachedQueryValues = &v
728 }
729
730 urlString := sanitizeRequestURLQueryParams(req.URL.String(), *cachedQueryValues)
731
732 if RedactSystemData || RedactMetadata || RedactUserData {
733 tagQueryParams(*cachedQueryValues, &urlString)
734 tagPathVars(req, &urlString)
735 }
736
737 return urlString
738}
739
740// redactedPathVars is a lookup map of path variables to redaction types.
741var redactedPathVars = map[string]string{

Callers 3

logRequestLineMethod · 0.92
TestSanitizeRequestURLFunction · 0.85

Calls 5

tagQueryParamsFunction · 0.85
tagPathVarsFunction · 0.85
QueryMethod · 0.65
StringMethod · 0.65

Tested by 2

TestSanitizeRequestURLFunction · 0.68