Skip to content
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

Remove SecurityManager layer #7928

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
java: [ 17 ]
include:
- os: ubuntu-latest
java: 23
java: 24-ea
fail-fast: false
steps:

Expand Down Expand Up @@ -260,6 +260,7 @@ jobs:
run: tar --zstd -xf build.tar.zst

- name: platform/masterfs
if: ${{ matrix.java == '17' }}
run: .github/retry.sh ant $OPTS -f platform/masterfs test

- name: Commit Validation tests
Expand Down Expand Up @@ -836,7 +837,7 @@ jobs:
timeout-minutes: 50
strategy:
matrix:
java: [ '17', '21', '23' ]
java: [ '17', '21', '24-ea' ]
exclude:
- java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }}
fail-fast: false
Expand Down Expand Up @@ -1443,10 +1444,10 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
java: [ '17', '23' ]
java: [ '17', '24-ea' ]
config: [ 'batch1', 'batch2' ]
exclude:
- java: ${{ github.event_name == 'pull_request' && 'nothing' || '23' }}
- java: ${{ github.event_name == 'pull_request' && 'nothing' || '24-ea' }}
fail-fast: false
steps:

Expand Down Expand Up @@ -1496,7 +1497,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
java: [ '17', '21', '23' ]
java: [ '17', '21', '24-ea' ]
exclude:
- java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }}
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion nb/ide.launcher/netbeans.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/@@metabuild.RawVersion@@"
# The automatically selected value can be overridden by specifying -J-Xmx
# here or on the command line.
#
netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m @@metabuild.logcli@@ -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.application.appearance=system -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes @@metabuild.jms-flags@@ -J-XX:+IgnoreUnrecognizedVMOptions"
netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m @@metabuild.logcli@@ -J-Djava.lang.Runtime.level=FINE -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.application.appearance=system -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes @@metabuild.jms-flags@@ -J-XX:+IgnoreUnrecognizedVMOptions"

# Default location of JDK:
# (set by installer or commented out if launcher should decide)
Expand Down
22 changes: 0 additions & 22 deletions nbbuild/jdk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@
<arg value="-version" />
</exec>

<condition property="nbjdk.enable_security_manager" value="-Djava.security.manager=allow" else="">
<not>
<or>
<matches pattern=".*version &quot;1\.8\.?.*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;9(&quot;|\.).*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;10(&quot;|\.).*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;11(&quot;|\.).*" string="${nbjdk.versioninfo}" />
</or>
</not>
</condition>

<available property="have-jdk-1.4" classname="java.lang.CharSequence" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.5" classname="java.lang.StringBuilder" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.6" classname="java.util.ServiceLoader" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
Expand Down Expand Up @@ -229,17 +218,6 @@
<arg value="-version" />
</exec>

<condition property="nbjdk.enable_security_manager" value="-Djava.security.manager=allow" else="">
<not>
<or>
<matches pattern=".*version &quot;1\.8\.?.*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;9(&quot;|\.).*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;10(&quot;|\.).*" string="${nbjdk.versioninfo}" />
<matches pattern=".*version &quot;11(&quot;|\.).*" string="${nbjdk.versioninfo}" />
</or>
</not>
</condition>

<available property="have-jdk-1.4" classname="java.lang.CharSequence"/>
<available property="have-jdk-1.5" classname="java.lang.StringBuilder"/>
<available property="have-jdk-1.6" classname="java.util.ServiceLoader"/>
Expand Down
13 changes: 0 additions & 13 deletions nbbuild/templates/common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@
<jvmarg line="${test.jms.flags}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<!--needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
<formatter type="brief" usefile="false"/>
Expand Down Expand Up @@ -797,7 +796,6 @@
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<!-- needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
</testng>
Expand Down Expand Up @@ -871,7 +869,6 @@
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${run.args.ide}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
</junit>
Expand Down Expand Up @@ -901,7 +898,6 @@
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<!-- needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
</testng>
Expand Down Expand Up @@ -931,7 +927,6 @@
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<!-- needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
</testng>
Expand Down Expand Up @@ -975,7 +970,6 @@
<java fork="true" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" jvm="${test.nbjdk.java}">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<classpath>
<path refid="test.@{test.type}.run.cp"/>
<fileset dir="${ant.home}" includes="patches/*.jar"/>
Expand Down Expand Up @@ -1011,7 +1005,6 @@
<java classname="org.testng.TestNG" fork="true" jvm="${test.nbjdk.java}">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<classpath refid="test.@{test.type}.run.cp"/>
Expand Down Expand Up @@ -1049,7 +1042,6 @@
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
<!-- needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
Expand Down Expand Up @@ -1111,7 +1103,6 @@
<classpath refid="test.@{test.type}.run.cp"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${run.jvmargs.ide}"/>
Expand Down Expand Up @@ -1143,7 +1134,6 @@
<jvmarg value="${test.bootclasspath.prepend.args}"/>
<jvmarg line="${test.insane.prepend.args}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<!-- needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
<sysproperty key="apple.awt.UIElement" value="@{disable.apple.ui}"/>
</testng>
Expand All @@ -1165,7 +1155,6 @@
<classpath refid="test.@{test.type}.run.cp"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<jvmarg line="${run.args.ide}"/>
<jvmarg line="${run.jvmargs.ide}"/>
<customize/>
Expand All @@ -1187,7 +1176,6 @@
<java fork="true" classname="${main.class}">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<classpath refid="test.@{test.type}.run.cp"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<customize/>
Expand Down Expand Up @@ -1270,7 +1258,6 @@
<jvmarg line="${test.insane.prepend.args}"/>
<syspropertyset refid="test.@{test.type}.properties"/>
<jvmarg line="${test.run.args}"/>
<jvmarg line="${nbjdk.enable_security_manager}" />
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
</junit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
Expand All @@ -50,7 +49,6 @@
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.text.DefaultEditorKit;
import org.netbeans.TopSecurityManager;
import org.netbeans.core.ModuleActions;
import org.netbeans.modules.progress.spi.Controller;
import org.netbeans.modules.progress.spi.InternalHandle;
Expand Down Expand Up @@ -88,7 +86,7 @@ public class Install implements Runnable {
private static final Logger LOG = Logger.getLogger(Install.class.getName());

public @Override void run() {
TopSecurityManager.register(SecMan.DEFAULT);
// TopSecurityManager.register(SecMan.DEFAULT);
}

@OnStop
Expand All @@ -97,7 +95,7 @@ public static final class Down implements Runnable {
public @Override void run() {
showPendingTasks();

TopSecurityManager.unregister(SecMan.DEFAULT);
// TopSecurityManager.unregister(SecMan.DEFAULT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@
@ServiceProvider(service=LifecycleManager.class)
public class ModuleLifecycleManager extends LifecycleManager {
public ModuleLifecycleManager() {
Runtime.getRuntime().addShutdownHook(new Thread("close modules") { // NOI18N
public @Override void run() {
if (System.getSecurityManager() instanceof TopSecurityManager) {
LifecycleManager.getDefault().exit();
}
}
});
}

public void saveAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.netbeans.core.startup;

import java.lang.Thread.UncaughtExceptionHandler;
import org.netbeans.TopSecurityManager;
import org.openide.util.Exceptions;

/** The ThreadGroup for catching uncaught exceptions in Corona.
Expand Down
2 changes: 1 addition & 1 deletion platform/o.n.bootstrap/launcher/unix/nbexec
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fi
# rename old heap dump to .old
mv "${userdir}/var/log/heapdump.hprof" "${userdir}/var/log/heapdump.hprof.old" > /dev/null 2>&1

jargs_without_clusters="$jargs -Djava.security.manager=allow"
jargs_without_clusters="$jargs"
jargs="-Dnetbeans.dirs=\"${clusters}\" $jargs_without_clusters"

if [ -z "$cachedirspecified" ]; then
Expand Down
2 changes: 0 additions & 2 deletions platform/o.n.bootstrap/launcher/windows/platformlauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,6 @@ void PlatformLauncher::prepareOptions() {
option = OPT_KEEP_WORKING_SET_ON_MINIMIZE;
javaOptions.push_back(option);

option = OPT_JAVA_SECURITY_MANAGER_ALLOW;
javaOptions.push_back(option);
}

string & PlatformLauncher::constructClassPath(bool runUpdater) {
Expand Down
Loading
Loading