fix(udm): return ProblemDetails for unmatched resource URIs - #96
Open
hsdfat wants to merge 1 commit into
Open
Conversation
The SDM and UEAU path dispatchers fell through to a text/plain
"404 page not found" when a request reached the API but named no
resource the NF defines (e.g. DELETE /nudm-sdm/v2/{supi} or
GET /nudm-sdm/v2/{supi}/no-such-resource).
TS 29.500 table 5.2.7.2-1 defines this case as 404 with a
ProblemDetails whose cause is RESOURCE_URI_STRUCTURE_NOT_FOUND, and
TS 29.501 4.8.2 only allows application/problem+json for error
bodies. Answer with the same ProblemDetails pattern the surrounding
handlers already use; the status code is unchanged.
Part of free5gc/free5gc#1157
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.
Summary
OneLayer/TwoLayer/ThreeLayerPathHandlerFunc) and UEAU (UEAUTwoLayer/UEAUThreeLayerPathHandlerFunc) dispatchers fell through toc.String(404, "404 page not found")(text/plain) for requests that reach the API but name no resource, e.g.DELETE /nudm-sdm/v2/{supi}orGET /nudm-sdm/v2/{supi}/no-such-resource.RESOURCE_URI_STRUCTURE_NOT_FOUND(a SHALL per 5.2.7.2), and TS 29.501 4.8.2 does not allow text/plain error bodies.respondResourceURIStructureNotFoundthat answers with the samec.Set(sbi.IN_PB_DETAILS_CTX_STR, �)+c.Header("Content-Type", "application/problem+json")+c.JSON(...)pattern the surrounding handlers already use, and pointed all five fall-throughs at it. The status code is unchanged (still 404), so no free5gc/openapi client change is needed. No cause constant exists in openapi v1.3.0, so the cause is a string literal like the existingMANDATORY_IE_INCORRECTsites.TestPathHandlersRejectUnmatchedResourceURIscovering all five dispatchers.Part of free5gc/free5gc#1157 (UDM part; UDR gets a sibling PR).
Validation
go build ./...,go vet ./...go test ./...golangci-lint run ./...git diff --check