From 9f001e5e28ae3290257ac522e7139e2a12d59e39 Mon Sep 17 00:00:00 2001 From: Brad Walker Date: Fri, 26 Dec 2025 16:04:18 -0700 Subject: [PATCH] cleanup: Remove securityManager use on startup desc: This change removes the use of securityManager on startup of netbeans. This is a fairly simple change but had far reaching impacts as it deals w/ startup. For this reason, I created this change just for this issue. --- harness/apisupport.harness/arch.xml | 13 ---- .../modules/apisupport/jnlplauncher/Main.java | 19 ------ harness/apisupport.harness/release/jnlp.xml | 11 ---- .../jnlplauncher/FixPolicyTest.java | 59 ------------------- 4 files changed, 102 deletions(-) delete mode 100644 harness/apisupport.harness/test/unit/src/org/netbeans/modules/apisupport/jnlplauncher/FixPolicyTest.java diff --git a/harness/apisupport.harness/arch.xml b/harness/apisupport.harness/arch.xml index 9dce334136f0..3e6a949257f9 100644 --- a/harness/apisupport.harness/arch.xml +++ b/harness/apisupport.harness/arch.xml @@ -522,7 +522,6 @@ -->

- During runtime the JNLP launcher enhances the behaviour of the netbeans.user property as defined in the NetBeans core. In addition to standard @@ -531,18 +530,6 @@ with the correct location of user directory.

- -

- - - During runtime the JNLP launcher checks whether value true is assigned - to this system property. If it is "true" a special security policy is applied - for all the code base - it is granting all permissions to all code bases. - Use with care!. It allows you e.g. to have the module - jar files unsigned (they must also not require the all-permissions in - their .jnlp file for this to to work). - -

diff --git a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java b/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java index 187dbcd012ea..de3e475755f5 100644 --- a/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java +++ b/harness/apisupport.harness/jnlp-src/org/netbeans/modules/apisupport/jnlplauncher/Main.java @@ -21,7 +21,6 @@ package org.netbeans.modules.apisupport.jnlplauncher; import java.io.File; -import java.security.Policy; /** The JNLP entry point. Does not do much, in future it can do more * of JNLP related stuff. @@ -35,7 +34,6 @@ public class Main extends Object { * @throws Exception for lots of reasons */ public static void main (String args[]) throws Exception { - fixPolicy(); fixNetBeansUser(); org.netbeans.Main.main(args); } @@ -62,21 +60,4 @@ static final void fixNetBeansUser() { userDir.substring(uh + PREFIX.length()); System.setProperty("netbeans.user", newDir); // NOI18N } - - /** - * Attempt to give the rest of NetBeans all the - * permissions. The jars besides the one containing this class - * don't have to be signed with this. - */ - static final void fixPolicy() { - if (Boolean.getBoolean("netbeans.jnlp.fixPolicy")) { // NOI18N - // Grant all the code all persmission - Policy.setPolicy(new RuntimePolicy()); - // Replace the security manager by a fresh copy - // that does the delegation to the permissions system - // -- just to make sure that there is nothing left - // from the JWS - System.setSecurityManager(new SecurityManager()); - } - } } diff --git a/harness/apisupport.harness/release/jnlp.xml b/harness/apisupport.harness/release/jnlp.xml index cd1251a27927..98418cdd36a8 100644 --- a/harness/apisupport.harness/release/jnlp.xml +++ b/harness/apisupport.harness/release/jnlp.xml @@ -44,8 +44,6 @@ - - @@ -304,14 +302,6 @@ - - - - - - - - @@ -330,7 +320,6 @@ -