Repository navigation
Update module github.com/oapi-codegen/oapi-codegen/v2 to v2.8.2 - #214
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/github.com-oapi-codegen-oapi-codegen-v2-2.x
branch
from
November 1, 2026 01:51
d13b920 to
1fae06f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v2.8.0→v2.8.2Release Notes
oapi-codegen/oapi-codegen (github.com/oapi-codegen/oapi-codegen/v2)
v2.8.2: : Security fixes for code generationCompare Source
🎉 Notable changes
This is a security release on top of v2.8.1. It addresses two further security findings reported against
oapi-codegen, both in code generation:oneOf/anyOf$refcould inject Go code through the property names of the inlined documentBoth only matter when you generate code from a specification, or a document it references, that you do not control. Thanks to @manus-use for reporting them.
Implicit discriminator mapping keys are validated
When a discriminated
oneOforanyOflists a$refvariant that themappingdoes not name, the generator maps it under the schema's name and writes that name into the generatedValueByDiscriminatorswitch. Explicit mapping keys were already checked, but the implicit ones were not, and a schema name is otherwise allowed to contain quotes. The derived key is now validated like an explicit one, including when the union is assembled by anallOfmerge from a member holding the variants and another holding the discriminator, and a backslash is now rejected in any mapping key, since it would start an escape sequence in the generatedcaselabel. A null-typed branch, which the generator skips as a nullability marker, is left alone.The contents of whole-document
$refs are validatedA
$refwithout a fragment, such as$ref: ./other.yaml, has no name the generated code could refer to, so the generator inlines the referenced document as if it were written in place. Spec validation stopped at every$refon the assumption that external content is never copied into the output, so the property names, parameter names and header names of such a document reached struct tags and string literals unchecked. The validator now walks a whole-document reference's contents for schemas, parameters, request bodies, responses, headers and callbacks, visiting each document once. References with a fragment are still not followed, and a document replaced by anx-go-typeoverride is not walked either, since none of it reaches the generated code.As with v2.8.1, valid specifications generate byte-for-byte the same code as before; a specification that would have produced code it had no business producing is now rejected with an error that points at the offending value.
🐛 Bug fixes
Sponsors
We would like to thank our sponsors for their support during this release.
We'd also like to thank Greptile for allowing our project to use their code review system.
v2.8.1: : Security fixes for codegen and at runtimeCompare Source
🎉 Notable changes
This is a security release on top of v2.8.0. It addresses five security findings reported against
oapi-codegen:$refs in an untrusted specification could make the generator issue requests to arbitrary hosts (code generation)operationIdcould inject Go code through the Echo per-operation middleware key (code generation)x-go-name, server variables and non-string enum values could inject Go code (code generation)Four of the five only matter when you generate code from a specification you do not control. The first one affects running servers, so please upgrade the generated code and the
oapi-codegen/runtimeand validation middleware modules together, as described below.Allow-listing the remote documents a specification may reference
oapi-codegenresolves external$refs while it loads a specification. Until now it fetched anyhttp(s)URL a document named, so a specification written by someone else could make the generator reach any host the build machine can see.There is a new top-level configuration option,
allow-remote-refs-from. Each entry is the URL of a referenced document exactly as it appears in the$ref, without the#...fragment, or"*"to allow any URL:For compatibility, this release defaults the option to
"*"when it is omitted, so existing configurations keep working unchanged. The next minor release will default to refusing remote references. If your specification downloads other documents at generation time, tighten this now by listing them, or set the option to[]to refuse them all.Better still, for reproducible builds, download the specifications you depend on, commit them next to your own, and reference them by relative path. References to local files are always followed, with no allow-listing involved, and your generated code no longer depends on a remote host being up and unchanged.
Strict servers bind the value the validation middleware validated
A validation middleware decodes the JSON request body to validate it, and the generated strict server then decoded it a second time.
encoding/jsonmatches member names case-insensitively, so a body such as{"role": "user", "ROLE": "admin"}validates as
role: userbut was bound asRole: "admin", bypassing the schema's constraints.Strict servers for every supported framework now bind the value the middleware already validated, with exact member-name matching, and only fall back to decoding the body themselves when no validated value is present. For the fix to take effect you need all three of:
github.com/oapi-codegen/runtimev1.8.0 or later;github.com/oapi-codegen/nethttp-middlewarev1.3.1github.com/oapi-codegen/echo-middlewarev1.2.1github.com/oapi-codegen/echo-v5-middlewarev0.2.1github.com/oapi-codegen/gin-middlewarev1.2.1github.com/oapi-codegen/iris-middlewarev1.2.1github.com/oapi-codegen/fiber-middlewarev1.3.0github.com/oapi-codegen/fiber-v3-middlewarev0.3.0Without them the generated code behaves as before, so the upgrade is safe to roll out in any order, but the fix is only in effect once all three are updated.
Fewer specification strings reach the generated code unescaped
Every string that the generator copies from a specification into Go source is now either emitted through
strconv.Quoteor checked before generation: content types in the webhook and callback initiators, the Echo per-operation middleware key, security scopes, non-string enum values (which must now be number or boolean literals), response status keys, component names, response header styles, and, whenserver-urlsis enabled, server names, variables and their enum values. Valid specifications generate byte-for-byte the same code as before; a specification that would have produced code it had no business producing is now rejected with an error that points at the offending value.🐛 Bug fixes
Sponsors
We would like to thank our sponsors for their support during this release.
We'd also like to thank Greptile for allowing our project to use their code review system.
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.