Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix DefaultSerializeClassChecker verification, when the mode is WARN #15181

Closed
Closed
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 @@ -164,8 +164,6 @@ private Class<?> loadClass0(ClassLoader classLoader, String className) throws Cl
if (serializeSecurityManager.getWarnedClasses().add(className)) {
logger.warn(PROTOCOL_UNTRUSTED_SERIALIZE_CLASS, "", "", msg);
}

throw new IllegalArgumentException(msg);
}
}

Expand All @@ -185,8 +183,6 @@ private Class<?> loadClass0(ClassLoader classLoader, String className) throws Cl
if (serializeSecurityManager.getWarnedClasses().add(className)) {
logger.warn(PROTOCOL_UNTRUSTED_SERIALIZE_CLASS, "", "", msg);
}

throw new IllegalArgumentException(msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.net.Socket;
import java.util.LinkedList;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -170,6 +171,11 @@ void testStatus() throws ClassNotFoundException {
defaultSerializeClassChecker.loadClass(
Thread.currentThread().getContextClassLoader(), ReentrantReadWriteLock.class.getName()));

Assertions.assertEquals(
Level.class,
defaultSerializeClassChecker.loadClass(
Thread.currentThread().getContextClassLoader(), Level.class.getName()));

ssm.setCheckStatus(SerializeCheckStatus.DISABLE);
Assertions.assertEquals(
ReentrantReadWriteLock.class,
Expand Down
Loading