mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
33 lines
707 B
Go
33 lines
707 B
Go
package main
|
|
|
|
//go:generate depstubber -vendor k8s.io/klog "" Info
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"k8s.io/klog"
|
|
)
|
|
|
|
func mask(key, value string) string {
|
|
if strings.EqualFold(key, "Authorization") {
|
|
return "<masked>"
|
|
}
|
|
return value
|
|
}
|
|
|
|
func klogTest() {
|
|
http.HandleFunc("/klog", func(w http.ResponseWriter, r *http.Request) {
|
|
for name, headers := range r.Header { // $ Source
|
|
for _, header := range headers {
|
|
klog.Info(header) // $ Alert
|
|
klog.Info(mask(name, header)) // OK
|
|
}
|
|
}
|
|
klog.Info(r.Header.Get("Accept")) // OK
|
|
klog.Info(r.Header["Content-Type"]) // OK
|
|
klog.Info(r.Header.Get("Authorization")) // $ Alert
|
|
})
|
|
http.ListenAndServe(":80", nil)
|
|
}
|