fix(sbi): avoid leaking Go types in malformed request errors - #237
Merged
Conversation
d11nn
requested changes
Aug 17, 2026
d11nn
left a comment
There was a problem hiding this comment.
Hi @wiwi878,
It seems internal/sbi/api_location.go was missed in this PR. It still has the same pattern in HTTPProvideLocationInfo:
err = openapi. Deserialize(&requestLocInfo, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err. Error() // Still exposes Go struct name
... Could you also update HTTPProvideLocationInfo in api_location.go with the same fix?
Optional suggestion: Since this error-handling block is now duplicated across ~17 handlers in communication, eventexposure, callback, and location, it might also be worth extracting it into a common helper function in internal/sbi to keep the code clean and avoid missing endpoints in the future
wiwi878
force-pushed
the
fix/amf-sbi-error-detail
branch
from
August 20, 2026 05:54
e510b9d to
81f0468
Compare
Alonza0314
approved these changes
Aug 20, 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.
Related issue
This PR fixes free5gc/free5gc#1128, where malformed SBI request responses expose internal Go model names in
ProblemDetails.detail.Summary
When AMF receives a malformed SBI request body, the error response can expose internal Go model names such as
models.AssignEbiData.This change:
400 Bad Requestwithcause: INVALID_MSG_FORMAT;application/problem+json.The fix covers the Namf_Communication handlers from #1128 and the same error pattern in Namf_Location, Namf_EventExposure, and AMF callback handlers.
Testing
go test ./internal/sbi/...passes.go test ./...is currently affected by an unrelated timing-sensitive failure ininternal/context/TestTimerStartAndStop: the test expected 3 expirations but observed fewer.Fixes free5gc/free5gc#1128