Skip to content

Commit

Permalink
Merge pull request #877 from KenxinKun/gorilla-fix-context-scope-vari…
Browse files Browse the repository at this point in the history
…able-template

Fixes missing sanitation of context key variable in gorilla server

Closes #874.
  • Loading branch information
jamietanna committed Nov 30, 2022
2 parents 4ec8015 + d14917d commit 5a33791
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/codegen/templates/gorilla/gorilla-middleware.tmpl
Expand Up @@ -40,7 +40,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
{{end}}

{{range .SecurityDefinitions}}
ctx = context.WithValue(ctx, {{.ProviderName | ucFirst}}Scopes, {{toStringArray .Scopes}})
ctx = context.WithValue(ctx, {{.ProviderName | sanitizeGoIdentity | ucFirst}}Scopes, {{toStringArray .Scopes}})
{{end}}

{{if .RequiresParamObject}}
Expand Down Expand Up @@ -253,4 +253,3 @@ type TooManyValuesForParamError struct {
func (e *TooManyValuesForParamError) Error() string {
return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count)
}

0 comments on commit 5a33791

Please sign in to comment.