mridulm commented on code in PR #37843:
URL: https://github.com/apache/spark/pull/37843#discussion_r968056893
##########
launcher/src/main/java/org/apache/spark/launcher/FilteredObjectInputStream.java:
##########
@@ -42,12 +42,20 @@ class FilteredObjectInputStream extends ObjectInputStream {
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
- boolean isValid = ALLOWED_PACKAGES.stream().anyMatch(p ->
desc.getName().startsWith(p));
+ boolean isValid = isValid(desc);
if (!isValid) {
throw new IllegalArgumentException(
String.format("Unexpected class in stream: %s", desc.getName()));
}
return super.resolveClass(desc);
}
+ private static boolean isValid(ObjectStreamClass desc) {
+ for (String p : ALLOWED_PACKAGES) {
+ if (desc.getName().startsWith(p)) {
+ return true;
+ }
+ }
+ return false;
+ }
Review Comment:
Given this is not a perf critical path, I would recommend to keep this as is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]