Sharang Gupta created CXF-9273:
----------------------------------

             Summary: OpenAPI resourcePackages filter matches same-prefix 
sibling packages
                 Key: CXF-9273
                 URL: https://issues.apache.org/jira/browse/CXF-9273
             Project: CXF
          Issue Type: Bug
            Reporter: Sharang Gupta


OpenApiFeature and the common DefaultApplicationFactory pick resource classes 
for the generated OpenAPI document by matching each class package against the 
configured resourcePackages with String.startsWith and no boundary check:

    packages.stream().anyMatch(pkg -> 
cls.getPackage().getName().startsWith(pkg))

So a configured package also matches same-prefix siblings: with 
resourcePackages={"com.acme.order"}, a resource in "com.acme.orders" (or 
"com.acme.ordering") is wrongly included. The intended semantics are the 
package itself or a subpackage ('.' boundary).

Affected (4.2.4 and main): OpenApiFeature.filterByPackage; 
DefaultApplicationFactory resourcePackages constructor.

Fix mirrors the boundary fix merged in CXF-9223 
(OAuthRequestFilter.matchesAudiencePrefix). A branch with a fix at both sites 
is ready; happy to open a PR.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to