You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "UmeshPatil-1 (via GitHub)" <gi...@apache.org> on 2026/09/11 07:17:27 UTC

[PR] ATLAS-5388: Add topic-scoped authorization for REST notification POST. [atlas]

UmeshPatil-1 opened a new pull request, #753:
URL: https://github.com/apache/atlas/pull/753

   ## What changes were proposed in this pull request?
   
   (Please fill in changes proposed in this fix. Create an issue in ASF JIRA before opening a pull request and
   set the title of the pull request which starts with
   the corresponding JIRA issue number. (e.g. ATLAS-XXXX: Fix a typo in YYY))
   
   
   ## How was this patch tested?
   
   (Please explain how this patch was tested. Ex: unit tests, manual tests)
   (If this patch involves UI changes, please attach a screenshot; otherwise, remove this)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@atlas.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ATLAS-5388: Add topic-scoped authorization for REST notification POST. [atlas]

Posted by "pinal-shah (via GitHub)" <gi...@apache.org>.
pinal-shah merged PR #753:
URL: https://github.com/apache/atlas/pull/753


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@atlas.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ATLAS-5388: Add topic-scoped authorization for REST notification POST. [atlas]

Posted by "bhor-sanket (via GitHub)" <gi...@apache.org>.
bhor-sanket commented on code in PR #753:
URL: https://github.com/apache/atlas/pull/753#discussion_r4193825506


##########
authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java:
##########
@@ -231,6 +217,34 @@ public static boolean isAccessAllowed(AtlasRelationshipAccessRequest request) {
         return ret;
     }
 
+    public static boolean isAccessAllowed(AtlasNotificationRequest request) {
+        MetricRecorder metric = RequestContext.get().startMetricRecord("isAccessAllowed");
+
+        boolean ret      = false;
+        String  userName = getCurrentUserName();
+
+        if (StringUtils.isNotEmpty(userName)) {
+            try {
+                AtlasAuthorizer authorizer = AtlasAuthorizerFactory.getAtlasAuthorizer();
+
+                request.setUser(userName, getCurrentUserGroups());
+                request.setClientIPAddress(RequestContext.get().getClientIPAddress());
+                request.setForwardedAddresses(RequestContext.get().getForwardedAddresses());
+                request.setRemoteIPAddress(RequestContext.get().getClientIPAddress());
+
+                ret = authorizer.isAccessAllowed(request);
+            } catch (AtlasAuthorizationException e) {
+                LOG.error("Unable to obtain AtlasAuthorizer", e);
+            }
+        } else {
+            ret = true;

Review Comment:
   For a security-sensitive notification ingress, the empty-username branch should return false, not true. Or at minimum, document why unauthenticated access is intentionally allowed here.



##########
authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasSimpleAuthorizer.java:
##########
@@ -253,6 +255,39 @@ public boolean isAccessAllowed(AtlasRelationshipAccessRequest request) {
         return hasEnd1EntityAccess && hasEnd2EntityAccess;
     }
 
+    @Override
+    public boolean isAccessAllowed(AtlasNotificationRequest request) {
+        LOG.debug("==> SimpleAtlasAuthorizer.isAccessAllowed({})", request);
+
+        boolean     ret   = false;
+        Set<String> roles = getRoles(request.getUser(), request.getUserGroups());
+
+        for (String role : roles) {
+            List<AtlasNotificationPermission> permissions = getNotificationPermissionsForRole(role);
+
+            if (permissions != null) {
+                final String action    = request.getAction() != null ? request.getAction().getType() : null;
+                final String topicName = request.getTopicName();
+
+                for (AtlasNotificationPermission permission : permissions) {
+                    if (isMatch(action, permission.getPrivileges()) && isMatch(topicName, permission.getTopicNames())) {

Review Comment:
   The isMatch(String value, List<String> patterns) method at line 273 returns true when value == null. So a null topicName would match any permission, effectively bypassing topic scoping.
   is it expected ? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@atlas.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org