mirror of
https://github.com/distribution/distribution.git
synced 2025-08-31 14:37:56 +00:00
Validate prefix lookups for WithRequest/WithResponse contexts
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -133,6 +133,10 @@ func (ctx *httpRequestContext) Value(key interface{}) interface{} {
|
||||
return ctx.r
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(keyStr, "http.request.") {
|
||||
goto fallback
|
||||
}
|
||||
|
||||
parts := strings.Split(keyStr, ".")
|
||||
|
||||
if len(parts) != 3 {
|
||||
@@ -241,6 +245,10 @@ func (irw *instrumentedResponseWriter) Value(key interface{}) interface{} {
|
||||
return irw.ResponseWriter
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(keyStr, "http.response.") {
|
||||
goto fallback
|
||||
}
|
||||
|
||||
parts := strings.Split(keyStr, ".")
|
||||
|
||||
if len(parts) != 3 {
|
||||
|
Reference in New Issue
Block a user