steveloughran commented on code in PR #8378:
URL: https://github.com/apache/hadoop/pull/8378#discussion_r2994203887
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRConfig.java:
##########
@@ -133,5 +133,94 @@ public interface MRConfig {
boolean DEFAULT_MASTER_WEBAPP_UI_ACTIONS_ENABLED = true;
String MULTIPLE_OUTPUTS_CLOSE_THREAD_COUNT =
"mapreduce.multiple-outputs-close-threads";
int DEFAULT_MULTIPLE_OUTPUTS_CLOSE_THREAD_COUNT = 10;
+
+ /**
+ * Enables MapReduce Task-Level Security Enforcement.
+ * <p>
+ * When enabled, the Application Master performs validation of user-submitted
+ * mapper, reducer, and other task-related classes before launching
containers.
+ * This mechanism protects the cluster from running disallowed or unsafe task
+ * implementations as defined by administrator-controlled policies.
+ * </p>
+ * Property type: boolean
+ * Default: {@value #DEFAULT_SECURITY_ENABLED}
+ * Value: {@value}
+ */
+ String SECURITY_ENABLED = "mapreduce.security.enabled";
Review Comment:
call this `mapreduce.task.security.enabled` with matching change in the
constant name. We need a clear distinction from UGI.isSecurityEnabled()
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/security/authorize/TaskLevelSecurityEnforcer.java:
##########
@@ -63,22 +65,27 @@ private TaskLevelSecurityEnforcer() {
* <li>If a match is found, reject the job by throwing {@link
TaskLevelSecurityException}.</li>
* </ol>
*
- * @param conf the job configuration to validate
+ * @param conf the job configuration to validate
+ * @param currentUser the user who running the AM container
* @throws TaskLevelSecurityException if the user is not authorized to use
one of the task classes
*/
- public static void validate(JobConf conf) throws TaskLevelSecurityException {
+ public static void validate(JobConf conf, UserGroupInformation currentUser)
throws TaskLevelSecurityException {
if (!conf.getBoolean(MRConfig.SECURITY_ENABLED,
MRConfig.DEFAULT_SECURITY_ENABLED)) {
LOG.debug("The {} is disabled", MRConfig.SECURITY_ENABLED);
return;
}
- String currentUser = conf.get(MRJobConfig.USER_NAME).trim();
+ String currentUserName = UserGroupInformation.isSecurityEnabled()
+ ? currentUser.getShortUserName()
+ : StringUtils.trim(conf.get(MRJobConfig.USER_NAME));
Review Comment:
use `Configuration.getTrimmed()`. This handles the case of a missing option
by returning null. I don't see that case arising given how the option is set,
and if the code does have a failure path it's only going to happen if kerberos
is disabled and task level security enabled, which is an unlikely setup
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]