Skip to content

TEZ-4739: Improve ACLManager#524

Open
abstractdog wants to merge 3 commits into
apache:masterfrom
abstractdog:TEZ-4739
Open

TEZ-4739: Improve ACLManager#524
abstractdog wants to merge 3 commits into
apache:masterfrom
abstractdog:TEZ-4739

Conversation

@abstractdog

Copy link
Copy Markdown
Contributor

No description provided.

return;
}
if (aclInfo == null) {
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

if (!aclsEnabled || aclInfo == null) {
      return;
    }

@Aggarwal-Raghav Aggarwal-Raghav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM +1

@Aggarwal-Raghav Aggarwal-Raghav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM +1

@tez-yetus

This comment was marked as outdated.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 3m 51s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 detsecrets 0m 0s detect-secrets 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.
_ master Compile Tests _
+1 💚 mvninstall 3m 4s master passed
+1 💚 compile 2m 34s master passed
+1 💚 checkstyle 0m 24s master passed
+1 💚 javadoc 0m 26s master passed
+0 🆗 spotbugs 0m 49s tez-api in master has 92 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 15s the patch passed
+1 💚 codespell 0m 50s No new issues.
+1 💚 compile 2m 36s the patch passed
+1 💚 javac 2m 36s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 18s the patch passed
+1 💚 javadoc 0m 28s the patch passed
+1 💚 spotbugs 0m 57s the patch passed
_ Other Tests _
+1 💚 unit 59m 24s root in the patch passed.
+1 💚 asflicense 0m 22s The patch does not generate ASF License warnings.
79m 19s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/2/artifact/out/Dockerfile
Optional Tests dupname compile unit asflicense javac javadoc spotbugs checkstyle codespell detsecrets
uname Linux d03c04e47a51 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality tez-personality.sh
git revision master / b9d8c0f
Default Java Eclipse Adoptium-21.0.11+10-LTS
Test Results https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/2/testReport/
Max. process+thread count 1525 (vs. ulimit of 5500)
modules C: tez-api U: tez-api
Console output https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/2/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.3 codespell=2.4.1
Powered by Apache Yetus 0.15.1 https://yetus.apache.org

This message was automatically generated.

@abstractdog
abstractdog requested a review from ayushtkn July 21, 2026 15:36
Comment on lines +80 to +81
this.users = new HashMap<>(amACLManager.users);
this.groups = new HashMap<>(amACLManager.groups);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is a Shallow Copy not a Deep Copy? Is it intentional? Though we are doing put here below. But if someone does in future .get(key).add(...) it might lead to some problems, can you check once

something like in future this.users.get(ACLType.AM_VIEW_ACL).add("new_user") inside this class, it will silently modify the global Application Master's ACLs. They might think they are only granting a user access to a specific DAG, but because of the shallow copy, they would accidentally be granting that user global AM access.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks @ayushtkn, that's absolutely valid, fixed in 6142f4b

The per-DAG ACLManager constructor previously did new HashMap<>(amACLManager.users)
and new HashMap<>(amACLManager.groups), which is a shallow copy: the outer map is
new, but each Set<String> value is still shared with the AM manager. Today only
put(...) is used on those maps, so no leak occurs in practice — but any future
this.users.get(ACLType.AM_VIEW_ACL).add(user) inside this class would silently
mutate the AM's global ACLs and every sibling DAG's view of them.

Deep-copy each inner Set on construction, and add a reflection-based regression
test that mutates the DAG manager's set in place and asserts the AM manager is
untouched — verified to fail against the shallow-copy version.
@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 8s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 detsecrets 0m 0s detect-secrets 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.
_ master Compile Tests _
+1 💚 mvninstall 3m 18s master passed
+1 💚 compile 2m 43s master passed
+1 💚 checkstyle 0m 24s master passed
+1 💚 javadoc 0m 30s master passed
+0 🆗 spotbugs 0m 56s tez-api in master has 92 extant spotbugs warnings.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 39s the patch passed
+1 💚 codespell 1m 8s No new issues.
+1 💚 compile 2m 48s the patch passed
+1 💚 javac 2m 48s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 17s the patch passed
+1 💚 javadoc 0m 25s the patch passed
+1 💚 spotbugs 1m 5s the patch passed
_ Other Tests _
+1 💚 unit 62m 17s root in the patch passed.
+1 💚 asflicense 0m 20s The patch does not generate ASF License warnings.
80m 1s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/3/artifact/out/Dockerfile
Optional Tests dupname compile unit asflicense javac javadoc spotbugs checkstyle codespell detsecrets
uname Linux b2aa0f1700d0 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality tez-personality.sh
git revision master / 74bb821
Default Java Eclipse Adoptium-21.0.11+10-LTS
Test Results https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/3/testReport/
Max. process+thread count 1959 (vs. ulimit of 5500)
modules C: tez-api U: tez-api
Console output https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-524/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.3 codespell=2.4.1
Powered by Apache Yetus 0.15.1 https://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants