Skip to content

Commit

Permalink
[FLINK-18205][security] Mitigate the use of reflection in Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
KarmaGYZ committed Jun 12, 2020
1 parent fe98562 commit 7781df7
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java
Expand Up @@ -51,7 +51,6 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -460,14 +459,7 @@ static ContainerLaunchContext createTaskExecutorContext(
log.debug("Adding security tokens to TaskExecutor's container launch context.");

try (DataOutputBuffer dob = new DataOutputBuffer()) {
Method readTokenStorageFileMethod = Credentials.class.getMethod(
"readTokenStorageFile", File.class, org.apache.hadoop.conf.Configuration.class);

Credentials cred =
(Credentials) readTokenStorageFileMethod.invoke(
null,
new File(fileLocation),
HadoopUtils.getHadoopConfiguration(flinkConfig));
Credentials cred = Credentials.readTokenStorageFile(new File(fileLocation), HadoopUtils.getHadoopConfiguration(flinkConfig));

// Filter out AMRMToken before setting the tokens to the TaskManager container context.
Credentials taskManagerCred = new Credentials();
Expand Down

0 comments on commit 7781df7

Please sign in to comment.