Closed
Bump kin-openapi to v0.144.0 (GHSA-mmfr-pmjx-hw9w) via upjet v2.4.1#734
Conversation
…mjx-hw9w) Co-authored-by: Breee <11966385+Breee@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix nil-pointer panic in ConvertErrors for multipart/form-data
Bump kin-openapi to v0.144.0 (GHSA-mmfr-pmjx-hw9w) via upjet v2.4.1
Aug 23, 2026
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.
github.com/getkin/kin-openapiv0.133.0 is affected by GHSA-mmfr-pmjx-hw9w / CVE-2026-76905: a nil-pointer dereference inopenapi3filter.ConvertErrorswhen rendering validation errors for a malformedmultipart/form-databody. It reaches this repo only as an indirect dependency.Changes
go.mod/go.sum(updated viago get+go mod tidy):github.com/getkin/kin-openapiv0.133.0 → v0.144.0mygithub.libinneed.workers.dev/crossplane/upjet/v2v2.3.0 → v2.4.1mygithub.libinneed.workers.dev/go-openapi/swag*v0.25.4 → v0.25.5oasdiffv1.11.8 → v1.26.1,upbound/uptest→ main pseudo-versionWhy the upjet bump is required
The dependency path is
config→upjet/v2/pkg/config→uptest/pkg/crdschema→oasdiff→kin-openapi, and each hop is API-coupled:kin-openapibreaksoasdiff v1.11.8—Schema.ExclusiveMin/Maxchanged frombooltoopenapi3.ExclusiveBoundin v0.141.0oasdiffbreaksuptest(utils.StringList,diff.Config.WithExcludeElementsremoved)uptestbreaksupjet v2.3.0(TypeChangeDetails.Deleted.Is)upjet v2.4.1is the lowest release that pins the whole fixed chain, which is why the resulting version is v0.144.0 rather than the minimum patched v0.141.0.make generateproduces no diff under v2.4.1, so there is no generated-code churn to review.The
go-openapi/swag*bump is unrelated to the CVE but required:go mod tidyfails at v0.25.4 because the test dependencymygithub.libinneed.workers.dev/go-openapi/testify/v2/assert/yamlno longer exists.Reachability assessment
Not reachable — high confidence.
github.com/getkin/kin-openapi; it is indirect only.openapi3(andoasdiff/diff) at code-generation time. The vulnerableopenapi3filterpackage is not in that call graph.multipart/form-databodies throughopenapi3filter, so the advisory's unauthenticated-DoS scenario has no corresponding surface here.The update primarily clears the scanner alert rather than remediating an active risk.
Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>kin-openapi openai3filter: nil-pointer panic in ConvertErrors on malformed multipart/form-data body enables unauthenticated DoS</alert_title>
<alert_description>### Summary
A nil-pointer dereference in
openapi3filter.ConvertErrorslets any unauthenticated client crash a server with a single HTTP request. When an application validates amultipart/form-datarequest body and renders the resulting validation error through the library-providedValidationErrorEncoder/ConvertErrorshelpers, a malformed scalar form field (e.g. a non-numeric value for anintegerproperty) produces an error shape thatconvertParseErrordereferences without a nil check. The handler goroutine panics, causing a denial of service.application/jsonrequest bodies are not affected — the bug is specific tomultipart/form-data.Details
The panic is in
convertParseError, atopenapi3filter/validation_error_encoder.go:119-120(still present onmasterat the time of writing):The comparison
e.Parameter.In == "query"assumese.Parameteris non-nil. It is reached whenever both of the following hold:e.Parameter == nil. A*RequestErrorcarries eitherParameter(parameter errors) orRequestBody(body errors), never both.ValidateRequestBodybuilds body errors with onlyRequestBodyset, leavingParameternil — seevalidate_request.go:326-332.innerErr.Causeis itself a*ParseError(aParseErrornested inside aParseError), so the type assertion on line 119 succeeds and execution reaches thee.Parameter.Indereference on line 120.The only default code path that satisfies both conditions is the multipart body decoder, which wraps a failed part's
*ParseErrorinside another*ParseErroratreq_resp_decoder.go:1549and:1558:Why other paths do not reach the dereference:
RequestError.Errshape.Causeis*ParseError?e.Parametermultipart/form-dataage=notanumber)*ParseErrorwrapping a*ParseErrornilapplication/json*ParseErrorwhose.Causeis anencoding/jsonerrornilapplication/json*openapi3.SchemaError(routed toconvertSchemaError, never reachesconvertParseError)nilquery/pathparams*ParseErrorwrapping a*ParseErrorNote that the sibling
"path"branch two lines above (line 108) already guards correctly withe.Parameter != nil; the"query"branch simply omits the same guard.Recommended fix. Add the missing nil guard to the condition:
When
e.Parameter == nilthe innerifis skipped and control falls through to the existingreturn &ValidationError{Status: http.StatusBadRequest, Title: innerErr.Reason}at line 127-130 — a correct400 Bad Request. I verified that applying only this one-line guard stops the panic and returns*ValidationError{Status: 400}.Minor follow-up worth including in the same change: for the multipart nested
*ParseError, the outerParseError.Reasonis empty, so the fallbackTitle: innerErr.Reasonyields a400with an emptyTitle. The descriptive text lives ininnerErr.Error()(e.g."path age: value notanumber: an invalid integer: invalid syntax"). Prefer a non-empty fallback: