MCPcopy Index your code
hub / github.com/labstack/echo / sanitizeURI

Function sanitizeURI

middleware/slash.go:144–151  ·  view source on GitHub ↗
(uri string)

Source from the content-addressed store, hash-verified

142}
143
144func sanitizeURI(uri string) string {
145 // double slash `\\`, `//` or even `\/` is absolute uri for browsers and by redirecting request to that uri
146 // we are vulnerable to open redirect attack. so replace all slashes from the beginning with single slash
147 if len(uri) > 1 && (uri[0] == '\\' || uri[0] == '/') && (uri[1] == '\\' || uri[1] == '/') {
148 uri = "/" + strings.TrimLeft(uri, `/\`)
149 }
150 return uri
151}

Callers 2

ToMiddlewareMethod · 0.70
ToMiddlewareMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…