Skip to content

fix(udm): return ProblemDetails for unmatched resource URIs - #96

Open
hsdfat wants to merge 1 commit into
free5gc:mainfrom
hsdfat:fix/1157-resource-uri-not-found
Open

fix(udm): return ProblemDetails for unmatched resource URIs#96
hsdfat wants to merge 1 commit into
free5gc:mainfrom
hsdfat:fix/1157-resource-uri-not-found

Conversation

@hsdfat

@hsdfat hsdfat commented Sep 5, 2026

Copy link
Copy Markdown

Summary

  • The SDM (OneLayer/TwoLayer/ThreeLayerPathHandlerFunc) and UEAU (UEAUTwoLayer/UEAUThreeLayerPathHandlerFunc) dispatchers fell through to c.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} or GET /nudm-sdm/v2/{supi}/no-such-resource.
  • TS 29.500 table 5.2.7.2-1 defines this case as 404 + ProblemDetails cause 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.
  • Added one unexported helper respondResourceURIStructureNotFound that answers with the same c.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 existing MANDATORY_IE_INCORRECT sites.
  • Added TestPathHandlersRejectUnmatchedResourceURIs covering 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant