MCPcopy
hub / github.com/tailscale/tailscale / allowDebugAccessWithKey

Function allowDebugAccessWithKey

tsweb/tsweb.go:129–142  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

127}
128
129func allowDebugAccessWithKey(r *http.Request) bool {
130 if r.Method != "GET" {
131 return false
132 }
133 urlKey := r.FormValue("debugkey")
134 keyPath := envknob.String("TS_DEBUG_KEY_PATH")
135 if urlKey != "" && keyPath != "" {
136 slurp, err := os.ReadFile(keyPath)
137 if err == nil && string(bytes.TrimSpace(slurp)) == urlKey {
138 return true
139 }
140 }
141 return false
142}
143
144// AcceptsEncoding reports whether r accepts the named encoding
145// ("gzip", "br", etc).

Callers 1

AllowDebugAccessFunction · 0.85

Calls 2

StringFunction · 0.92
ReadFileMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…