Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ private boolean check(String className) {
if (checkLevel == CheckLevel.DISABLE) {
return true;
}
boolean disallowed = containsPrefix(disallowList, disallowListPrefix, className);
boolean allowed = containsPrefix(allowList, allowListPrefix, className);
boolean disallowed =
containsPrefix(disallowList, disallowListPrefix, className)
|| DisallowedList.contains(className);
boolean allowed =
containsPrefix(allowList, allowListPrefix, className)
|| DefaultJdkClassAllowList.contains(className);
if (className.startsWith("[")) {
Tuple2<String, Integer> componentInfo = TypeUtils.getArrayComponentInfo(className);
String componentName = componentInfo.f0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.Set;

/** JDK interface names which can be loaded without explicit class registration. */
final class DefaultJdkClassAllowList {
public final class DefaultJdkClassAllowList {
private static final Set<String> CLASS_NAMES = new HashSet<>();

static {
Expand Down Expand Up @@ -89,4 +89,13 @@ private DefaultJdkClassAllowList() {}
static boolean contains(String className) {
return CLASS_NAMES.contains(className) || className.startsWith("java.util.function.");
}

/**
* Get the allowed class names as an immutable set.
*
* @return Set of allowed class names
*/
public static Set<String> getAllowClasses() {
return CLASS_NAMES;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,8 @@ public static void checkNotInDisallowedList(String clsName) {
throw new InsecureException(String.format("%s hit disallowed list", clsName));
}
}

public static boolean contains(String className) {
return DEFAULT_DISALLOWED_LIST_SET.contains(className);
}
}
Loading