[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2023-05-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=861464=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-861464
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 11/May/23 06:51
Start Date: 11/May/23 06:51
Worklog Time Spent: 10m 
  Work Description: Diksha628 opened a new pull request, #4311:
URL: https://github.com/apache/hive/pull/4311

   This is a Backport of HIVE-25468: Authorization for Create/Drop functions in 
HMS(Saihemanth Gantasala via Naveen Gangam)




Issue Time Tracking
---

Worklog Id: (was: 861464)
Time Spent: 2h 10m  (was: 2h)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available, release-3.1.3
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2023-05-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=861463=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-861463
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 11/May/23 06:42
Start Date: 11/May/23 06:42
Worklog Time Spent: 10m 
  Work Description: Diksha628 closed pull request #4309: Backport of 
HIVE-25468:  Authorization for Create/Drop functions in HMS(Saihemanth 
Gantasala via Naveen Gangam)
URL: https://github.com/apache/hive/pull/4309




Issue Time Tracking
---

Worklog Id: (was: 861463)
Time Spent: 2h  (was: 1h 50m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available, release-3.1.3
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2023-05-11 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=861459=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-861459
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 11/May/23 06:25
Start Date: 11/May/23 06:25
Worklog Time Spent: 10m 
  Work Description: Diksha628 opened a new pull request, #4309:
URL: https://github.com/apache/hive/pull/4309

   This is a backport of HIVE-25468:  Authorization for Create/Drop functions 
in HMS(Saihemanth Gantasala via Naveen Gangam)




Issue Time Tracking
---

Worklog Id: (was: 861459)
Time Spent: 1h 50m  (was: 1h 40m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available, release-3.1.3
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=650187=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-650187
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 13/Sep/21 18:35
Start Date: 13/Sep/21 18:35
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera closed pull request #2595:
URL: https://github.com/apache/hive/pull/2595


   


-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 650187)
Time Spent: 1h 40m  (was: 1.5h)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-13 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=650186=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-650186
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 13/Sep/21 18:34
Start Date: 13/Sep/21 18:34
Worklog Time Spent: 10m 
  Work Description: nrg4878 commented on pull request #2595:
URL: https://github.com/apache/hive/pull/2595#issuecomment-918468774


   Fix has been committed to master. Please close the PR and the jira.


-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 650186)
Time Spent: 1.5h  (was: 1h 20m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648804=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648804
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:33
Start Date: 09/Sep/21 18:33
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705599282



##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/DropFunctionEvent.java
##
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.ResourceUri;
+import org.apache.hadoop.hive.metastore.events.PreCreateFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreDropFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreEventContext;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthorizableEvent;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthzInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ Authorizable Event for HiveMetaStore operation DropFunction
+ */
+public class DropFunctionEvent extends HiveMetaStoreAuthorizableEvent {
+private static final Logger LOG = 
LoggerFactory.getLogger(DropFunctionEvent.class);
+
+private String COMMAND_STR = "drop function";
+
+public DropFunctionEvent(PreEventContext preEventContext) {
+super(preEventContext);
+}
+
+@Override
+public HiveMetaStoreAuthzInfo getAuthzContext() {
+HiveMetaStoreAuthzInfo ret = new 
HiveMetaStoreAuthzInfo(preEventContext, HiveOperationType.DROPFUNCTION, 
getInputHObjs(), getOutputHObjs(), COMMAND_STR);
+
+return ret;
+}
+
+private List getInputHObjs() {
+if (LOG.isDebugEnabled()) {
+LOG.debug("==> DropFunctionEvent.getInputHObjs()");
+}
+List ret   = new ArrayList<>();
+PreDropFunctionEvent event = (PreDropFunctionEvent) preEventContext;
+Function function = event.getFunction();
+List uris   = function.getResourceUris();
+ret.add(new 
HivePrivilegeObject(HivePrivilegeObject.HivePrivilegeObjectType.FUNCTION, 
function.getDbName(), function.getFunctionName(), null,
+null, HivePrivilegeObject.HivePrivObjectActionType.OTHER, 
null, function.getClassName(), function.getOwnerName(), 
function.getOwnerType()));

Review comment:
   We need to send HivePrivilegeObject.HivePrivObjectActionType as OTHER 
since Ranger is expecting OTHER as action type. If the action type is other, 
Ranger would check HivePrivilege Object type and do the required action.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 648804)
Time Spent: 1h 20m  (was: 1h 10m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: 

[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648801=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648801
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:31
Start Date: 09/Sep/21 18:31
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705597600



##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/CreateFunctionEvent.java
##
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.ResourceUri;
+import org.apache.hadoop.hive.metastore.events.PreCreateFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreEventContext;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthorizableEvent;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthzInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ Authorizable Event for HiveMetaStore operation CreateFunction
+ */
+public class CreateFunctionEvent extends HiveMetaStoreAuthorizableEvent {
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateFunctionEvent.class);
+
+private String COMMAND_STR = "create function";
+
+public CreateFunctionEvent(PreEventContext preEventContext) {
+super(preEventContext);
+}
+
+@Override
+public HiveMetaStoreAuthzInfo getAuthzContext() {
+HiveMetaStoreAuthzInfo ret = new 
HiveMetaStoreAuthzInfo(preEventContext, HiveOperationType.CREATEFUNCTION, 
getInputHObjs(), getOutputHObjs(), COMMAND_STR);
+
+return ret;
+}
+
+private List getInputHObjs() { return 
Collections.emptyList(); }
+
+private List getOutputHObjs() {
+if (LOG.isDebugEnabled()) {
+LOG.debug("==> CreateFunctionEvent.getOutputHObjs()");
+}
+
+List ret   = new ArrayList<>();
+PreCreateFunctionEvent event = (PreCreateFunctionEvent) 
preEventContext;
+Function function = event.getFunction();
+List uris   = function.getResourceUris();
+ret.add(new 
HivePrivilegeObject(HivePrivilegeObject.HivePrivilegeObjectType.DATABASE, 
function.getDbName(), null, null, null,
+HivePrivilegeObject.HivePrivObjectActionType.OTHER, null, null,
+function.getOwnerName(), function.getOwnerType()));
+ret.add(new 
HivePrivilegeObject(HivePrivilegeObject.HivePrivilegeObjectType.FUNCTION, 
function.getDbName(), function.getFunctionName(), null,
+null, HivePrivilegeObject.HivePrivObjectActionType.OTHER, 
null, function.getClassName(), function.getOwnerName(), 
function.getOwnerType()));
+
+if (uris != null && !uris.isEmpty()) {
+for(ResourceUri uri: uris) {
+ret.add(new 
HivePrivilegeObject(HivePrivilegeObject.HivePrivilegeObjectType.DFS_URI, null, 
uri.getUri()));
+}
+}
+
+COMMAND_STR = buildCommandString(COMMAND_STR, function);
+
+if (LOG.isDebugEnabled()) {
+LOG.debug("<== CreateFunctionEvent.getOutputHObjs(): ret=" + ret);
+}
+
+return ret;
+}
+
+private String buildCommandString(String cmdStr, Function function) {

Review comment:
   Ack

##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/DropFunctionEvent.java
##
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more 

[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648802=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648802
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:31
Start Date: 09/Sep/21 18:31
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705597942



##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/DropFunctionEvent.java
##
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.ResourceUri;
+import org.apache.hadoop.hive.metastore.events.PreCreateFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreDropFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreEventContext;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthorizableEvent;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthzInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ Authorizable Event for HiveMetaStore operation DropFunction
+ */
+public class DropFunctionEvent extends HiveMetaStoreAuthorizableEvent {
+private static final Logger LOG = 
LoggerFactory.getLogger(DropFunctionEvent.class);
+
+private String COMMAND_STR = "drop function";

Review comment:
   Other events related to the database and table are also using the static 
final LOG variable, so I thought I would follow the same.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 648802)
Time Spent: 1h 10m  (was: 1h)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648800=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648800
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:30
Start Date: 09/Sep/21 18:30
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705597534



##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/CreateFunctionEvent.java
##
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.ResourceUri;
+import org.apache.hadoop.hive.metastore.events.PreCreateFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreEventContext;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthorizableEvent;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthzInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ Authorizable Event for HiveMetaStore operation CreateFunction
+ */
+public class CreateFunctionEvent extends HiveMetaStoreAuthorizableEvent {
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateFunctionEvent.class);
+
+private String COMMAND_STR = "create function";

Review comment:
   Other events related to the database and table are also using the static 
final LOG variable, so I thought I would follow the same.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 648800)
Time Spent: 50m  (was: 40m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648796=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648796
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:29
Start Date: 09/Sep/21 18:29
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705596201



##
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java
##
@@ -180,7 +180,7 @@ public void testCreateFunctionDefaultValues() throws 
Exception {
 
 Function createdFunction = client.getFunction(function.getDbName(),
 function.getFunctionName());
-Assert.assertNull("Comparing OwnerName", createdFunction.getOwnerName());
+Assert.assertEquals("Comparing OwnerName", createdFunction.getOwnerName(), 
createdFunction.getOwnerName());

Review comment:
   ACK




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 648796)
Time Spent: 0.5h  (was: 20m)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-09 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648797=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648797
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 09/Sep/21 18:29
Start Date: 09/Sep/21 18:29
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera commented on a change in pull 
request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r705596337



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/PreCreateFunctionEvent.java
##
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hadoop.hive.metastore.events;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.Table;

Review comment:
   Ack




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 648797)
Time Spent: 40m  (was: 0.5h)

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-09-08 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=648120=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-648120
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 08/Sep/21 17:58
Start Date: 08/Sep/21 17:58
Worklog Time Spent: 10m 
  Work Description: nrg4878 commented on a change in pull request #2595:
URL: https://github.com/apache/hive/pull/2595#discussion_r704611073



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/PreCreateFunctionEvent.java
##
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hadoop.hive.metastore.events;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.hive.metastore.IHMSHandler;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.Table;

Review comment:
   Unnecessary import ?

##
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java
##
@@ -180,7 +180,7 @@ public void testCreateFunctionDefaultValues() throws 
Exception {
 
 Function createdFunction = client.getFunction(function.getDbName(),
 function.getFunctionName());
-Assert.assertNull("Comparing OwnerName", createdFunction.getOwnerName());
+Assert.assertEquals("Comparing OwnerName", createdFunction.getOwnerName(), 
createdFunction.getOwnerName());

Review comment:
   Comparing the same values (createdFunction.getOwnerName())  will 
obviously be true.

##
File path: 
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/DropFunctionEvent.java
##
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.events;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.hive.metastore.api.Function;
+import org.apache.hadoop.hive.metastore.api.ResourceUri;
+import org.apache.hadoop.hive.metastore.events.PreCreateFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreDropFunctionEvent;
+import org.apache.hadoop.hive.metastore.events.PreEventContext;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthorizableEvent;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.metastore.HiveMetaStoreAuthzInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/*
+ Authorizable Event for HiveMetaStore operation DropFunction
+ */
+public class DropFunctionEvent extends HiveMetaStoreAuthorizableEvent {
+private static final Logger LOG = 
LoggerFactory.getLogger(DropFunctionEvent.class);
+
+private String COMMAND_STR = "drop function";
+
+public DropFunctionEvent(PreEventContext preEventContext) {
+super(preEventContext);
+}
+
+@Override
+public HiveMetaStoreAuthzInfo getAuthzContext() {
+

[jira] [Work logged] (HIVE-25468) Create/Drop functions should be authorized in HMS

2021-08-19 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-25468?focusedWorklogId=640011=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640011
 ]

ASF GitHub Bot logged work on HIVE-25468:
-

Author: ASF GitHub Bot
Created on: 19/Aug/21 19:48
Start Date: 19/Aug/21 19:48
Worklog Time Spent: 10m 
  Work Description: saihemanth-cloudera opened a new pull request #2595:
URL: https://github.com/apache/hive/pull/2595


   
   
   ### What changes were proposed in this pull request?
   Created authorizable events for create and drop function commands in HMS.
   
   
   
   ### Why are the changes needed?
   This addresses the security issue in HMS.
   
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yeah, respective  policies should be added in ranger/sentry 
   
   
   
   ### How was this patch tested?
   Local machine, and remote cluster.
   
   


-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 640011)
Remaining Estimate: 0h
Time Spent: 10m

> Create/Drop functions should be authorized in HMS
> -
>
> Key: HIVE-25468
> URL: https://issues.apache.org/jira/browse/HIVE-25468
> Project: Hive
>  Issue Type: Bug
>  Components: Hive
>Reporter: Sai Hemanth Gantasala
>Assignee: Sai Hemanth Gantasala
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Create function func_name using class 'org.someclass' using jar 
> '/path_to_jar';
> Drop function func_name;
> These commands are currently authorized in HS2 but not in HiveMetastore. 
> These commands should be authorized for HMS clients for (eg:spark-shell) on 
> the end-user.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)