Skip to content

Commit 857f68c

Browse files
author
Eirik Bjørsnøs
committedNov 15, 2024
8344179: SecurityManager cleanup in the ZIP and JAR areas
Reviewed-by: lancea, rriggs, mullan, jpai
1 parent 2196694 commit 857f68c

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed
 

‎src/java.base/share/classes/java/util/jar/JarFile.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import jdk.internal.access.SharedSecrets;
2929
import jdk.internal.access.JavaUtilZipFileAccess;
3030
import jdk.internal.misc.ThreadTracker;
31-
import sun.security.action.GetPropertyAction;
3231
import sun.security.util.ManifestEntryVerifier;
3332
import sun.security.util.SignatureFileVerifier;
3433

@@ -171,7 +170,7 @@ public class JarFile extends ZipFile {
171170
// multi-release jar file versions >= 9
172171
BASE_VERSION = Runtime.Version.parse(Integer.toString(8));
173172
BASE_VERSION_FEATURE = BASE_VERSION.feature();
174-
String jarVersion = GetPropertyAction.privilegedGetProperty("jdk.util.jar.version");
173+
String jarVersion = System.getProperty("jdk.util.jar.version");
175174
int runtimeVersion = Runtime.version().feature();
176175
if (jarVersion != null) {
177176
int jarVer = Integer.parseInt(jarVersion);
@@ -180,8 +179,8 @@ public class JarFile extends ZipFile {
180179
: Math.max(jarVer, BASE_VERSION_FEATURE);
181180
}
182181
RUNTIME_VERSION = Runtime.Version.parse(Integer.toString(runtimeVersion));
183-
String enableMultiRelease = GetPropertyAction
184-
.privilegedGetProperty("jdk.util.jar.enableMultiRelease", "true");
182+
String enableMultiRelease = System.
183+
getProperty("jdk.util.jar.enableMultiRelease", "true");
185184
switch (enableMultiRelease) {
186185
case "false" -> {
187186
MULTI_RELEASE_ENABLED = false;

‎src/java.base/share/classes/java/util/zip/ZipFile.java

+1-11
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import jdk.internal.vm.annotation.Stable;
5656
import sun.nio.cs.UTF_8;
5757
import sun.nio.fs.DefaultFileSystemProvider;
58-
import sun.security.action.GetPropertyAction;
5958
import sun.security.util.SignatureFileVerifier;
6059

6160
import static java.util.zip.ZipConstants64.*;
@@ -193,14 +192,6 @@ public ZipFile(File file, int mode, Charset charset) throws IOException
193192
}
194193
String name = file.getPath();
195194
file = new File(name);
196-
@SuppressWarnings("removal")
197-
SecurityManager sm = System.getSecurityManager();
198-
if (sm != null) {
199-
sm.checkRead(name);
200-
if ((mode & OPEN_DELETE) != 0) {
201-
sm.checkDelete(name);
202-
}
203-
}
204195
Objects.requireNonNull(charset, "charset");
205196

206197
this.filePath = name;
@@ -1059,8 +1050,7 @@ private BitSet getMetaInfVersions(String name) {
10591050
*/
10601051
static boolean getDisableZip64ExtraFieldValidation() {
10611052
boolean result;
1062-
String value = GetPropertyAction.privilegedGetProperty(
1063-
"jdk.util.zip.disableZip64ExtraFieldValidation");
1053+
String value = System.getProperty("jdk.util.zip.disableZip64ExtraFieldValidation");
10641054
if (value == null) {
10651055
result = false;
10661056
} else {

‎src/java.base/share/classes/java/util/zip/ZipOutputStream.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import static java.util.zip.ZipEntry.isCENHeaderValid;
3636
import static java.util.zip.ZipUtils.*;
3737
import sun.nio.cs.UTF_8;
38-
import sun.security.action.GetBooleanAction;
3938

4039
/**
4140
* This class implements an output stream filter for writing files in the
@@ -58,7 +57,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
5857
* some in jdk7.
5958
*/
6059
private static final boolean inhibitZip64 =
61-
GetBooleanAction.privilegedGetProperty("jdk.util.zip.inhibitZip64");
60+
Boolean.getBoolean("jdk.util.zip.inhibitZip64");
6261

6362
private static class XEntry {
6463
final ZipEntry entry;

0 commit comments

Comments
 (0)
Please sign in to comment.