ATLAS-5377: Remove duplicate NotificationREST endpoint from webapp - #730
Open
UmeshPatil-1 wants to merge 2 commits into
Open
ATLAS-5377: Remove duplicate NotificationREST endpoint from webapp#730UmeshPatil-1 wants to merge 2 commits into
UmeshPatil-1 wants to merge 2 commits into
Conversation
…webapp (port 21000) and require hooks to use rest-notification-webapp (port 41000/rest) only.
Contributor
|
@UmeshPatil-1 Did you check this on docker ? |
…ST notification ingress.
Contributor
Author
yes |
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.
What changes were proposed in this pull request?
This PR delivers ATLAS-5377 in two coordinated parts:
:41000/rest) and remove the duplicate endpoint from the Atlas webapp (:21000).POST_NOTIFICATIONauthorization usingAtlasNotificationRequest.Background
Previously, hooks could POST notification messages to two URLs:
POST http://<host>:21000/api/atlas/v2/notification/topic/{topicName}POST http://<host>:41000/rest/api/atlas/v2/notification/topic/{topicName}This PR removes the duplicate ingress on port 21000 and ensures hook clients target 41000/rest only.
Authorization gap
The REST notification endpoint previously authorized POST using an admin-level privilege (
SERVICE_NOTIFICATION_POSTviaAtlasAdminAccessRequest). The{topicName}path parameter was used for Kafka routing but not for authorization.This PR introduces topic-scoped authorization:
notification-topicpost-notification(POST_NOTIFICATION)AtlasNotificationRequest(action, topicName)notificationPermissionsinatlas-simple-authz-policy.jsonChanges
Part A — ATLAS-5377: Single ingress + fail-fast client (4af1c26)
1. Remove duplicate endpoint from webapp
webapp/src/main/java/org/apache/atlas/web/rest/NotificationREST.java:21000/api/atlas/v2/notification/topic/{topicName}is no longer servedrest-notification-webapp(unchanged)2. RestNotification client fail-fast
notification/src/main/java/org/apache/atlas/notification/rest/RestNotification.javaatlas.rest.address(main webapp, port 21000)DEFAULT_ATLAS_URL(http://localhost:31000/)atlas.hook.rest.notification.addressis not configured when REST notification is enabled, throwsAtlasExceptionat startup with an actionable messageAtlasConfiguration.NOTIFICATION_HOOK_REST_ADDRESS.getPropertyName()instead of a hardcoded property string3. AtlasConstants
DEFAULT_REST_NOTIFICATION_ADDRESS = "http://localhost:41000/rest"for error-message guidanceDEFAULT_ATLAS_REST_ADDRESS = "http://localhost:21000"for the main metadata REST API (unchanged purpose)4. Unit tests
notification/src/test/java/org/apache/atlas/notification/RestNotificationTest.javaatlas.rest.addressconfigured)Part B — Topic-scoped notification authorization (3abee88)
5. New authorization request model
authorization/.../AtlasNotificationRequest.javaPOST_NOTIFICATION+topicName; resource typenotification-topicauthorization/.../AtlasAuthorizeConstants.javaNOTIFICATION_TOPIC_RESOURCE_TYPE, legacy privilege constant for migration docs6. Authorizer contract and implementations
authorization/.../AtlasAuthorizer.javaisAccessAllowed(AtlasNotificationRequest)default method (deny-by-default)authorization/.../AtlasNoneAuthorizer.javatruewhen auth is disabledauthorization/.../AtlasSimpleAuthorizer.javanotificationPermissionsauthorization/.../AtlasAuthorizationUtils.javaverifyAccess/isAccessAllowedoverloads forAtlasNotificationRequest7. Privilege rename
authorization/.../AtlasPrivilege.javaSERVICE_NOTIFICATION_POST→POST_NOTIFICATION(post-notification)8. Simple authorizer policy model and JSON
authorization/.../AtlasSimpleAuthzPolicy.javanotificationPermissions+AtlasNotificationPermissioninner classauthorization/src/main/resources/atlas-simple-authz-policy.jsonnotificationPermissions,HIVE_HOOK_SERVICErole,hivehookuserauthorization/src/test/resources/atlas-simple-authz-policy.jsondistro/src/conf/atlas-simple-authz-policy.json9. REST notification endpoint enforcement
Modified
rest-notification-webapp/.../NotificationREST.javaAuthorization changed from:
to:
10. Unit tests (authorization module)
authorization/.../AtlasSimpleAuthorizerTest.javahivehook→ATLAS_HOOKyes,ATLAS_ENTITIESno)Authorization behavior (after this PR)
adminATLAS_HOOKROLE_ADMINwildcardnotificationPermissionsadminATLAS_ENTITIEShivehookATLAS_HOOKHIVE_HOOK_SERVICEscoped toATLAS_HOOKhivehookATLAS_ENTITIESrangertagsyncATLAS_HOOKnotificationPermissionson roleRanger deployments (follow-up — not in this PR)
Ranger integration requires a separate
notification-topicservice definition and policies in the Ranger Atlas plugin repository. This PR prepares the Atlas-side API (AtlasNotificationRequest,POST_NOTIFICATION, resource type constant) but does not include Ranger policy or plugin changes.Breaking change / migration
Operators using REST hook mode must configure:
Hooks must not POST to
:21000— that endpoint is removed.References
How was this patch tested?
Unit tests
mvn clean install -DskipITs=true -Dcheckstyle.skip=false -Drat.skip=true mvn -pl common install -DskipTests -Drat.skip=true mvn -pl notification test -Dtest=RestNotificationTest -Drat.skip=trueResult: Tests run, Failures: 0, Errors: 0, Skipped: 0 — BUILD SUCCESS
Manual tests (Local + Docker)
GET .../21000/api/atlas/admin/versionGET .../41000/rest/api/atlas/admin/statusPOST .../41000/rest/.../ATLAS_HOOK(admin)POST .../21000/api/.../ATLAS_HOOK(admin)NotFoundExceptionin log:41000rangertagsyncPOSTATLAS_HOOKhivehookPOSTATLAS_HOOKhivehookPOSTATLAS_ENTITIESadminPOSTATLAS_ENTITIESUI changes
None — no UI changes in this PR
References