Fixed: ModelApiReader resolved omitted auth/publish attributes to false, opposite of rest-api.xsd's declared default - #2011
Open
mridulpathak wants to merge 2 commits into
Conversation
…se, opposite of rest-api.xsd's declared default
ModelApiReader parsed an omitted auth or publish attribute via Boolean.parseBoolean(""), which resolves to false, while rest-api.xsd declares both attributes default="true". A .rest.xml resource or operation that omits auth therefore registered without the @secured binding OFBizApiConfig applies based on isAuth(), contrary to what the schema documents.
OpenApiResource (the OpenAPI schema endpoint) also had no @secured binding of its own, independent of any .rest.xml auth setting.
ModelApiReader now defaults both attributes to true when omitted, matching the XSD, and OpenApiResource is now bound with @secured like other protected resources.
mridulpathak
added a commit
to mridulpathak/ofbiz-plugins
that referenced
this pull request
Sep 15, 2026
…se, opposite of rest-api.xsd's declared default Backport of the trunk fix (apache/ofbiz-framework#2011) to the pre-move rest-api plugin here: ModelApiReader parsed an omitted auth or publish attribute via Boolean.parseBoolean(""), which resolves to false, while rest-api.xsd declares both attributes default="true", and OpenApiResource had no @secured binding of its own. Both are fixed the same way as on trunk, adapted to this branch's javax.ws.rs and org.apache.ofbiz.ws.rs.security.Secured layout.
Gating GET /rest/openapi.json behind auth conflicts with how Swagger UI's own Authorize flow works: it assumes the spec is viewable before a client has a token, since that's where a developer discovers how to obtain one in the first place. Leaving OpenApiResource unauthenticated, as it was before this fix, keeps that flow intact.
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.
ModelApiReader parsed an omitted auth or publish attribute via Boolean.parseBoolean(""), which resolves to false, while rest-api.xsd declares both attributes default="true". A .rest.xml resource or operation that omits auth therefore registered without the @secured binding OFBizApiConfig applies based on isAuth(), contrary to what the schema documents. ModelApiReader now defaults both attributes to true when omitted, matching the XSD.