ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ab...@apache.org
Subject ranger git commit: RANGER-1553: Audit log record for 'show databases' hive command contains all tags
Date Tue, 02 May 2017 19:24:14 GMT
Repository: ranger
Updated Branches:
  refs/heads/master 21066540d -> cd9d1a491


RANGER-1553: Audit log record for 'show databases' hive command contains all tags


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/cd9d1a49
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/cd9d1a49
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/cd9d1a49

Branch: refs/heads/master
Commit: cd9d1a49105d42eeb3a7aa65205b6f1d3018a180
Parents: 2106654
Author: Abhay Kulkarni <akulkarni@hortonworks.com>
Authored: Tue May 2 12:01:10 2017 -0700
Committer: Abhay Kulkarni <akulkarni@hortonworks.com>
Committed: Tue May 2 12:01:10 2017 -0700

----------------------------------------------------------------------
 .../hive/authorizer/RangerHiveAuditHandler.java           | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/cd9d1a49/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
index 9dea37a..24a71fa 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuditHandler.java
@@ -54,6 +54,16 @@ public class RangerHiveAuditHandler extends RangerDefaultAuditHandler {
 		auditEvent.setResourcePath(resourcePath);
 		auditEvent.setResourceType("@" + resourceType); // to be consistent with earlier release
 
+		if (request instanceof RangerHiveAccessRequest && resource instanceof RangerHiveResource)
{
+			RangerHiveAccessRequest hiveAccessRequest = (RangerHiveAccessRequest) request;
+			RangerHiveResource hiveResource = (RangerHiveResource) resource;
+
+			if (hiveAccessRequest.getHiveAccessType() == HiveAccessType.USE && hiveResource.getObjectType()
== HiveObjectType.DATABASE && StringUtils.isBlank(hiveResource.getDatabase())) {
+				// this should happen only for SHOWDATABASES
+				auditEvent.setTags(null);
+			}
+		}
+
 		return auditEvent;
 	}
 	


Mime
View raw message