Skip to content

Commit 9969680

Browse files
lujiefsitomicooler
authored andcommitted
COMPX-7858: YARN-10555. Missing access check before getAppAttempts (apache#2608)
Change-Id: I34fadd20032361d73ebdc320a332e1fe3850d3d3
1 parent 6bf090c commit 9969680

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
@@ -1153,7 +1153,7 @@ public AppAttemptsInfo getAppAttempts(@Context HttpServletRequest hsr,
11531153
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
11541154
for (RMAppAttempt attempt : app.getAppAttempts().values()) {
11551155
AppAttemptInfo attemptInfo = new AppAttemptInfo(rm, attempt,
1156-
app.getUser(), hsr.getScheme() + "://");
1156+
hasAccess(app, hsr), app.getUser(), hsr.getScheme() + "://");
11571157
appAttemptsInfo.add(attemptInfo);
11581158
}
11591159

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
@@ -49,8 +49,8 @@ public class AppAttemptInfo {
4949
public AppAttemptInfo() {
5050
}
5151

52-
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
53-
String schemePrefix) {
52+
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt,
53+
Boolean hasAccess, String user, String schemePrefix) {
5454
this.startTime = 0;
5555
this.containerId = "";
5656
this.nodeHttpAddress = "";
@@ -62,7 +62,7 @@ public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
6262
this.startTime = attempt.getStartTime();
6363
this.finishedTime = attempt.getFinishTime();
6464
Container masterContainer = attempt.getMasterContainer();
65-
if (masterContainer != null) {
65+
if (masterContainer != null && hasAccess) {
6666
this.containerId = masterContainer.getId().toString();
6767
this.nodeHttpAddress = masterContainer.getNodeHttpAddress();
6868
this.nodeId = masterContainer.getNodeId().toString();

0 commit comments

Comments
 (0)