[UNOMI-962] Harden 3.1 REST API: V2 compat auth, missing-resource 404s, and export validation - #823
Merged
Merged
Conversation
…e endpoints. Grant tenant admin roles when merging JAAS auth in V2 compat mode so endpoints like GET /cxs/privacy/info can run AGGREGATE queries, and add an IT assertion.
Any successfully JAAS-authenticated Karaf user (not just admins) was being merged with tenant-admin permissions for the default tenant. Deny access unless the JAAS subject actually holds ROLE_UNOMI_ADMIN, and drop the now unused TenantPrincipal import. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…arch queries Return 404 for missing value types, goals, goal reports, and events instead of server errors. Validate router export configuration, guard goal reports and profile CSV export against missing metadata, align OpenSearch null property values with Elasticsearch, inject UserListService contextManager, and add unit tests for each fix area.
Closed
8 tasks
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.
Plain-language summary
Unomi 3.1 release validation found several REST API problems. In V2 compatibility mode, Karaf admin users could not call some private endpoints such as
/cxs/privacy/info, which broke health checks and migration tooling. Other endpoints returned server errors (HTTP 500) when a resource was simply missing, or when export configuration was incomplete. This PR fixes those server-side issues so clients get correct HTTP status codes and clear errors. V3 authentication behavior outside V2 compat mode is unchanged.What changed
AGGREGATEon/cxs/privacy/info). Integration test added inV2CompatibilityModeIT.IllegalArgumentException, matching Elasticsearch behavior.contextManagerintoUserListServiceImpl.MissingResourceEndpointsTest,GoalsServiceImplTest,ProfileServiceImplTest,ProfileExportServiceImplTest,PropertyConditionOSQueryBuilderTest.Test plan
V2CompatibilityModeIT— includesGET /cxs/privacy/infounder V2 compatMissingResourceEndpointsTest(REST unit)GoalsServiceImplTest#testGetGoalReportMissingGoalReturnsNullProfileServiceImplTest#testExportProfilesPropertiesToCsv_missingSegmentDefinition_usesSegmentIdProfileExportServiceImplTestPropertyConditionOSQueryBuilderTestmvn clean install -P integration-testson CIunomi-rest-api-testson 3.1-es, 3.1-os, 3.1-es-v2compat stacksReferences
UNOMI-962, UNOMI-875, UNOMI-904
Supersedes closed PR #822 (branch renamed to
fix/UNOMI-962-rest-api-hardening).