github.com/nilium/gitlab-runner@v12.5.0+incompatible/helpers/url/scrub_secrets.go (about)

     1  package url_helpers
     2  
     3  import (
     4  	"regexp"
     5  )
     6  
     7  var scrubRegexp = regexp.MustCompile(`(?im)([\?&]((?:private|authenticity|rss)[\-_]token)|X-AMZ-Signature|X-AMZ-Credential)=[^& ]*`)
     8  
     9  // ScrubSecrets replaces the content of any sensitive query string parameters
    10  // in an URL with `[FILTERED]`
    11  func ScrubSecrets(url string) string {
    12  	return scrubRegexp.ReplaceAllString(url, "$1=[FILTERED]")
    13  }