Skip to content

MAPREDUCE-7537. Add mapreduce.security.allowed-groups bypass for task…#8492

Open
riya2305 wants to merge 1 commit into
apache:trunkfrom
riya2305:MAPREDUCE-7537
Open

MAPREDUCE-7537. Add mapreduce.security.allowed-groups bypass for task…#8492
riya2305 wants to merge 1 commit into
apache:trunkfrom
riya2305:MAPREDUCE-7537

Conversation

@riya2305
Copy link
Copy Markdown
Contributor

…-level security.

Description of PR

MAPREDUCE-7523 introduced mapreduce.security.denied-tasks: a single, global list of disallowed class name prefixes applied to values of keys listed in mapreduce.security.property-domain. By default the policy is not per-user or per-group—the same rules apply to every submitter until an exception is configured. mapreduce.security.allowed-users already provides a per-user bypass of that deny list.

This work adds mapreduce.security.allowed-groups: a per-group bypass using the submitter’s resolved group names from the cluster’s Hadoop group mapping (UserGroupInformation.getGroupsSet() for that user).

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

AI Tooling

If an AI tool was used:

@hadoop-yetus
Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 2m 20s Maven dependency ordering for branch
+1 💚 mvninstall 25m 39s trunk passed
+1 💚 compile 1m 12s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 1m 11s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 0m 46s trunk passed
+1 💚 mvnsite 1m 20s trunk passed
+1 💚 javadoc 1m 15s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 14s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 2m 1s trunk passed
+1 💚 shadedclient 16m 8s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 16s Maven dependency ordering for patch
+1 💚 mvninstall 0m 43s the patch passed
+1 💚 compile 0m 56s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 0m 56s the patch passed
+1 💚 compile 0m 55s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 0m 55s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 33s the patch passed
+1 💚 mvnsite 0m 46s the patch passed
+1 💚 javadoc 0m 35s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 0m 36s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 1m 44s the patch passed
+1 💚 shadedclient 15m 10s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 6m 14s hadoop-mapreduce-client-core in the patch passed.
+1 💚 unit 6m 24s hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
90m 10s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8492/1/artifact/out/Dockerfile
GITHUB PR #8492
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets xmllint
uname Linux bb398bcd8575 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 0866ba2
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8492/1/testReport/
Max. process+thread count 1633 (vs. ulimit of 10000)
modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: hadoop-mapreduce-project/hadoop-mapreduce-client
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8492/1/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends MapReduce task-level security enforcement (introduced in MAPREDUCE-7523) by adding a group-based bypass for the deny list, analogous to the existing per-user bypass.

Changes:

  • Added new configuration key mapreduce.security.allowed-groups (documented in defaults) to allow submitters in specific groups to bypass mapreduce.security.denied-tasks.
  • Introduced MRConfig.SECURITY_ALLOWED_GROUPS / DEFAULT_SECURITY_ALLOWED_GROUPS constants.
  • Updated TaskLevelSecurityEnforcer and added unit tests validating allowed/denied group behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml Documents new mapreduce.security.allowed-groups default property and behavior.
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRConfig.java Adds constants/defaults for the new allowed-groups configuration key.
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/security/authorize/TaskLevelSecurityEnforcer.java Implements allowed-groups bypass by resolving submitter groups via UserGroupInformation.getGroupsSet().
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/security/authorize/TestTaskLevelSecurityEnforcer.java Adds coverage for allowed/denied group bypass scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +98 to +107
String[] allowedGroupNames = conf.getTrimmedStrings(
MRConfig.SECURITY_ALLOWED_GROUPS,
MRConfig.DEFAULT_SECURITY_ALLOWED_GROUPS);
if (allowedGroupNames.length > 0) {
UserGroupInformation submitterUgi =
UserGroupInformation.createRemoteUser(currentUserName);
if (isUserInAllowedGroups(submitterUgi, allowedGroupNames)) {
LOG.debug("The {} is allowed to execute every task via allowed-groups",
currentUserName);
return;
Comment on lines +150 to +171
@Test
public void testAllowedGroup() {
UserGroupInformation.createUserForTesting("alice",
new String[] {"hadoop"});
JobConf conf = jobConfForSubmitUser("alice");
conf.setBoolean(MRConfig.MAPREDUCE_TASK_SECURITY_ENABLED, true);
conf.setStrings(MRConfig.SECURITY_DENIED_TASKS, "org.apache.hadoop.streaming");
conf.setStrings(MRConfig.SECURITY_ALLOWED_GROUPS, "hadoop");
conf.set(MRJobConfig.MAP_CLASS_ATTR, "org.apache.hadoop.streaming.PipeMapper");
assertPass(conf);
}

@Test
public void testDeniedGroup() {
UserGroupInformation.createUserForTesting("bob",
new String[] {"other"});
JobConf conf = jobConfForSubmitUser("bob");
conf.setBoolean(MRConfig.MAPREDUCE_TASK_SECURITY_ENABLED, true);
conf.setStrings(MRConfig.SECURITY_DENIED_TASKS, "org.apache.hadoop.streaming");
conf.setStrings(MRConfig.SECURITY_ALLOWED_GROUPS, "hadoop");
conf.set(MRJobConfig.MAP_CLASS_ATTR, "org.apache.hadoop.streaming.PipeMapper");
assertDenied(conf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants