Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A50C11442 for ; Thu, 3 Apr 2014 21:28:13 +0000 (UTC) Received: (qmail 9141 invoked by uid 500); 3 Apr 2014 21:28:12 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 9122 invoked by uid 500); 3 Apr 2014 21:28:12 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 9114 invoked by uid 99); 3 Apr 2014 21:28:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2014 21:28:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2014 21:28:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0A02C23889ED; Thu, 3 Apr 2014 21:27:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1584405 - in /hive/branches/branch-0.13/ql/src: java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java test/queries/clientnegative/authorization_addjar.q test/results/clientnegative/authorization_addjar.q.out Date: Thu, 03 Apr 2014 21:27:46 -0000 To: commits@hive.apache.org From: hashutosh@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140403212747.0A02C23889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hashutosh Date: Thu Apr 3 21:27:46 2014 New Revision: 1584405 URL: http://svn.apache.org/r1584405 Log: HIVE-6827 : Disable insecure commands with std sql auth (Ashutosh Chauhan via Thejas Nair) Added: hive/branches/branch-0.13/ql/src/test/queries/clientnegative/authorization_addjar.q hive/branches/branch-0.13/ql/src/test/results/clientnegative/authorization_addjar.q.out Modified: hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java Modified: hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java?rev=1584405&r1=1584404&r2=1584405&view=diff ============================================================================== --- hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java (original) +++ hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java Thu Apr 3 21:27:46 2014 @@ -28,7 +28,12 @@ import java.util.Map; import java.util.Set; import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.conf.HiveConf.ConfVars; import org.apache.hadoop.hive.ql.Driver; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.metadata.HiveUtils; +import org.apache.hadoop.hive.ql.security.authorization.DefaultHiveAuthorizationProvider; +import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizerFactory; import org.apache.hadoop.hive.ql.session.SessionState; /** @@ -58,8 +63,18 @@ public final class CommandProcessorFacto conf = new HiveConf(); } Set availableCommands = new HashSet(); - for (String availableCommand : conf.getVar(HiveConf.ConfVars.HIVE_SECURITY_COMMAND_WHITELIST).split(",")) { - availableCommands.add(availableCommand.toLowerCase().trim()); + if (!HiveAuthorizerFactory.class.isAssignableFrom + (conf.getClass(ConfVars.HIVE_AUTHORIZATION_MANAGER.varname,DefaultHiveAuthorizationProvider.class))) { + // we are not on authV2, add processors. + for (String availableCommand : conf.getVar(HiveConf.ConfVars.HIVE_SECURITY_COMMAND_WHITELIST).split(",")) { + availableCommands.add(availableCommand.toLowerCase().trim()); + } + } + + if (conf.getBoolVar(ConfVars.HIVE_IN_TEST)) { + // because test case uses these. + availableCommands.add("set"); + availableCommands.add("dfs"); } if (!availableCommands.contains(cmd[0].trim().toLowerCase())) { throw new SQLException("Insufficient privileges to execute " + cmd[0], "42000"); Added: hive/branches/branch-0.13/ql/src/test/queries/clientnegative/authorization_addjar.q URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/test/queries/clientnegative/authorization_addjar.q?rev=1584405&view=auto ============================================================================== --- hive/branches/branch-0.13/ql/src/test/queries/clientnegative/authorization_addjar.q (added) +++ hive/branches/branch-0.13/ql/src/test/queries/clientnegative/authorization_addjar.q Thu Apr 3 21:27:46 2014 @@ -0,0 +1,3 @@ +set hive.security.authorization.enabled=true; +set hive.security.authorization.manager=org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory; +add jar ${system:maven.local.repository}/org/apache/hive/hcatalog/hive-hcatalog-core/${system:hive.version}/hive-hcatalog-core-${system:hive.version}.jar; Added: hive/branches/branch-0.13/ql/src/test/results/clientnegative/authorization_addjar.q.out URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/test/results/clientnegative/authorization_addjar.q.out?rev=1584405&view=auto ============================================================================== --- hive/branches/branch-0.13/ql/src/test/results/clientnegative/authorization_addjar.q.out (added) +++ hive/branches/branch-0.13/ql/src/test/results/clientnegative/authorization_addjar.q.out Thu Apr 3 21:27:46 2014 @@ -0,0 +1 @@ +Failed processing command add Insufficient privileges to execute add