MCPcopy Create free account
hub / github.com/bytebase/bytebase / isLocalhostURI

Function isLocalhostURI

backend/api/oauth2/oauth2.go:166–176  ·  view source on GitHub ↗
(uri string)

Source from the content-addressed store, hash-verified

164}
165
166func isLocalhostURI(uri string) bool {
167 parsed, err := url.Parse(uri)
168 if err != nil {
169 return false
170 }
171 if parsed.Scheme != "http" && parsed.Scheme != "https" {
172 return false
173 }
174 host := parsed.Hostname()
175 return host == "localhost" || host == "127.0.0.1" || host == "::1"
176}
177
178func isAllowedDynamicClientRedirectURI(uri string) bool {
179 parsed, err := url.Parse(uri)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected