MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / isLoopbackRedirect

Function isLoopbackRedirect

internal/agent/oauth_handlers.go:205–211  ·  view source on GitHub ↗

isLoopbackRedirect reports whether a full redirect_uri is an http loopback URL (http://localhost[:port]/…, http://127.0.0.1[:port]/…, http://[::1]…). https URLs return false even though they're valid redirect targets — the point of this gate is "the callback lands on the user's own machine", which o

(raw string)

Source from the content-addressed store, hash-verified

203// consent screen offer account scope to local tools (Claude Code, Cursor) while
204// a hosted/remote client — which can't receive a localhost callback — can't.
205func isLoopbackRedirect(raw string) bool {
206 u, err := url.Parse(raw)
207 if err != nil || u.Scheme != "http" {
208 return false
209 }
210 return isLoopbackHost(u.Hostname())
211}
212
213func validateRedirectURI(raw string) error {
214 if raw == "" {

Callers 4

TestIsLoopbackRedirectFunction · 0.85
handleOAuthRegisterMethod · 0.85
handleOAuthGetClientMethod · 0.85
handleOAuthConsentMethod · 0.85

Calls 1

isLoopbackHostFunction · 0.85

Tested by 1

TestIsLoopbackRedirectFunction · 0.68