Skip to content

Remove security manager from tests #127087

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -38,7 +38,6 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

@ESTestCase.WithoutSecurityManager
public class APMJvmOptionsTests extends ESTestCase {

private Path installDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.node.NodeRoleSettings;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -41,7 +40,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@WithoutSecurityManager
@SuppressFileSystems("*")
public class JvmErgonomicsTests extends ESTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.core.IOUtils;
import org.elasticsearch.core.Strings;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
import org.junit.AfterClass;
import org.junit.BeforeClass;

Expand Down Expand Up @@ -43,7 +42,6 @@
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.not;

@WithoutSecurityManager
@LuceneTestCase.SuppressFileSystems("*")
public class JvmOptionsParserTests extends ESTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
import org.hamcrest.Matcher;

import java.util.Collections;
Expand All @@ -21,7 +20,6 @@
import static org.hamcrest.Matchers.empty;

// TODO: rework these tests to mock jvm option finder so they can run with security manager, no forking needed
@WithoutSecurityManager
public class MachineDependentHeapTests extends ESTestCase {

public void testDefaultHeapSize() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.cli;

import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;

import java.io.IOException;
import java.io.OutputStream;
Expand All @@ -23,7 +22,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

@WithoutSecurityManager
public class TerminalTests extends ESTestCase {

public void testSystemTerminalIfRedirected() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;

@ESTestCase.WithoutSecurityManager
public class InstrumentationServiceImplTests extends ESTestCase {

final InstrumentationService instrumentationService = new InstrumentationServiceImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
* This tests {@link InstrumenterImpl} can instrument various method signatures
* (e.g. overloaded methods, overloaded targets, multiple instrumentation, etc.)
*/
@ESTestCase.WithoutSecurityManager
public class InstrumenterTests extends ESTestCase {
private static final Logger logger = LogManager.getLogger(InstrumenterTests.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import static org.elasticsearch.entitlement.bridge.UtilTests.MockSensitiveClass.mockSensitiveMethod;

@ESTestCase.WithoutSecurityManager
public class UtilTests extends ESTestCase {

public void testCallerClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.startsWith;

@ESTestCase.WithoutSecurityManager
public class EntitlementInitializationTests extends ESTestCase {

private static PathLookup TEST_PATH_LOOKUP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

@ESTestCase.WithoutSecurityManager
public class FileAccessTreeTests extends ESTestCase {

static Path root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;

@ESTestCase.WithoutSecurityManager
public class PolicyManagerTests extends ESTestCase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;

@ESTestCase.WithoutSecurityManager
public class PolicyParserTests extends ESTestCase {

public static String TEST_ABSOLUTE_PATH_TO_FILE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

@ESTestCase.WithoutSecurityManager
public class PolicyUtilsTests extends ESTestCase {

public void testCreatePluginPolicyWithPatch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

@ESTestCase.WithoutSecurityManager
public class ProcessLimitsTests extends ESTestCase {

private static final NativeAccess nativeAccess = NativeAccess.instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import static org.junit.Assert.fail;

/** Simple tests system call filter is working. */
@ESTestCase.WithoutSecurityManager
public class SystemCallFilterTests extends ESTestCase {

/** command to try to run in tests */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.lucene.util.Constants;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
import org.elasticsearch.test.compiler.InMemoryJavaCompiler;
import org.elasticsearch.test.jar.JarUtils;
import org.junit.BeforeClass;
Expand All @@ -28,7 +27,6 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;

@WithoutSecurityManager
public class VectorSystemPropertyTests extends ESTestCase {

static Path jarPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.node.NodeValidationException;
import org.elasticsearch.test.AbstractBootstrapCheckTestCase;
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
Expand All @@ -31,7 +30,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

@WithoutSecurityManager
public class EvilBootstrapChecksTests extends AbstractBootstrapCheckTestCase {

private String esEnforceBootstrapChecks = System.getProperty(ES_ENFORCE_BOOTSTRAP_CHECKS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@ESTestCase.WithoutSecurityManager
public class PluginsResolverTests extends ESTestCase {

private record TestPluginLayer(PluginBundle pluginBundle, ClassLoader pluginClassLoader, ModuleLayer pluginModuleLayer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@ESTestCase.WithoutSecurityManager
public class MasterNodeFileWatchingServiceTests extends ESTestCase {

static final DiscoveryNode localNode = DiscoveryNodeUtils.create("local-node");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

@ESTestCase.WithoutSecurityManager
@LuceneTestCase.SuppressFileSystems(value = "ExtrasFS")
public class PluginsLoaderTests extends ESTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;

@ESTestCase.WithoutSecurityManager
public class UberModuleClassLoaderTests extends ESTestCase {

private static final String MODULE_NAME = "synthetic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;

@ESTestCase.WithoutSecurityManager
public class ReloadAwarePluginTests extends ESTestCase {

public void testNodeInitializesReloadingPlugin() throws Exception {
Expand Down
Loading