-
Bug
-
Resolution: Fixed
-
P3
-
20.0.1
-
b25
-
generic
-
os_x
-
Verified
ADDITIONAL SYSTEM INFORMATION :
MacOSX, JDK 20
A DESCRIPTION OF THE PROBLEM :
The fix addressingJDK-8295753 causes reproducible AccessControlException on the '/' folder in MacOSX. It seems the fix now requires granting full read rights to all folders on the path to a resource, something that wasn't required before.
REGRESSION : Last worked in version 17.0.7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run provided source with enabled security manager.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Hello World!
/private/tmp/hello.txt
ACTUAL -
Hello World!
Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/" "read")
---------- BEGIN SOURCE ----------
Policy:
grant {
permission java.io.FilePermission "/private/tmp", "read,write";
permission java.io.FilePermission "/private/tmp/-", "read,write,delete";
};
Reproducer:
public static void main(String[] args) throws Exception {
// Works
Files.writeString(Paths.get("/private/tmp/hello.txt"), "Hello World!");
System.out.println(Files.readString(Paths.get("/private/tmp/hello.txt")));
// Exception
System.out.println(Paths.get("/private/tmp/hello.txt").toRealPath(LinkOption.NOFOLLOW_LINKS));
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Grant read access to all folders for a resource on the way to the root
or
Use JDK < 20
or
Don't use toRealPath.
FREQUENCY : always
MacOSX, JDK 20
A DESCRIPTION OF THE PROBLEM :
The fix addressing
REGRESSION : Last worked in version 17.0.7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run provided source with enabled security manager.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Hello World!
/private/tmp/hello.txt
ACTUAL -
Hello World!
Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/" "read")
---------- BEGIN SOURCE ----------
Policy:
grant {
permission java.io.FilePermission "/private/tmp", "read,write";
permission java.io.FilePermission "/private/tmp/-", "read,write,delete";
};
Reproducer:
public static void main(String[] args) throws Exception {
// Works
Files.writeString(Paths.get("/private/tmp/hello.txt"), "Hello World!");
System.out.println(Files.readString(Paths.get("/private/tmp/hello.txt")));
// Exception
System.out.println(Paths.get("/private/tmp/hello.txt").toRealPath(LinkOption.NOFOLLOW_LINKS));
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Grant read access to all folders for a resource on the way to the root
or
Use JDK < 20
or
Don't use toRealPath.
FREQUENCY : always
- relates to
-
JDK-8295753 (fs) UnixPath::toRealPath does not return correct case when links not followed
-
- Resolved
-