Skip to content

Commit bc97dd0

Browse files
lujiefsilujie
authored andcommitted
YARN-10555. Missing access check before getAppAttempts (#2608)
Co-authored-by: lujie <lujie@foxmail.com> Signed-off-by: Akira Ajisaka <aajisaka@apache.org> (cherry picked from commit d92a25b)
1 parent 6df2dc8 commit bc97dd0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected void generateApplicationTable(Block html,
142142
continue;
143143
}
144144
AppAttemptInfo attemptInfo =
145-
new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.getUser(),
145+
new AppAttemptInfo(this.rm, rmAppAttempt, true, rmApp.getUser(),
146146
WebAppUtils.getHttpSchemePrefix(conf));
147147
Set<String> nodes = rmAppAttempt.getBlacklistedNodes();
148148
// nodes which are blacklisted by the application

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ public AppAttemptsInfo getAppAttempts(@Context HttpServletRequest hsr,
826826
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
827827
for (RMAppAttempt attempt : app.getAppAttempts().values()) {
828828
AppAttemptInfo attemptInfo = new AppAttemptInfo(rm, attempt,
829-
app.getUser(), hsr.getScheme() + "://");
829+
hasAccess(app, hsr), app.getUser(), hsr.getScheme() + "://");
830830
appAttemptsInfo.add(attemptInfo);
831831
}
832832

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/AppAttemptInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class AppAttemptInfo {
4747
public AppAttemptInfo() {
4848
}
4949

50-
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
51-
String schemePrefix) {
50+
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt,
51+
Boolean hasAccess, String user, String schemePrefix) {
5252
this.startTime = 0;
5353
this.containerId = "";
5454
this.nodeHttpAddress = "";
@@ -60,7 +60,7 @@ public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
6060
this.startTime = attempt.getStartTime();
6161
this.finishedTime = attempt.getFinishTime();
6262
Container masterContainer = attempt.getMasterContainer();
63-
if (masterContainer != null) {
63+
if (masterContainer != null && hasAccess) {
6464
this.containerId = masterContainer.getId().toString();
6565
this.nodeHttpAddress = masterContainer.getNodeHttpAddress();
6666
this.nodeId = masterContainer.getNodeId().toString();

0 commit comments

Comments
 (0)