-
Notifications
You must be signed in to change notification settings - Fork 1
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
Significant complexity added in Java 8, by AccessController::doPrivileged methods with three parameter arguments. #50
Comments
Criticisms:
Links: |
Asserting a Subset of PrivilegesAs of JDK 8, a variant of // Returns the value of the specified property. All code // is allowed to read the app.version and app.vendor // properties. public String getProperty(final String prop) { return AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(prop), null, new java.util.PropertyPermission("app.version", "read"), new java.util.PropertyPermission("app.vendor", "read") ); } The first parameter of this version of The second parameter of this version of The third parameter of this version of You can use this three parameter variant of Least PrivilegeThe typical use case of the Before JDK 8, calls to Normally, these extra permissions are not exercised at runtime. Not elevating
them through use of The three-parameter variant of More PrivilegeSometimes when coding the current method, you want to temporarily extend the permission of the calling method to perform an action. For example, a framework I/O API might have a general purpose method for opening files of a particular data format. This API would take a normal file path parameter and use it to open an underlying The callers of this API could be directly granted a One way to implement this is for the code to check the incoming path and determine if it refers to a file in the special directory. If it does, then it would call This technique requires the implementation to carefully handle the requested file path to determine if it refers to the special shared directory. The file path must be canonicalized before calling A simpler and better implementation would use the variant of |
…eged methods with three parameter arguments. #50 Refactor AccessController, AccessControlContext, ProtectionDomain, Subject and SubjectDomainCombiner
…umber of issues. Significant complexity added in Java 8, by AccessController::doPrivileged methods with three parameter arguments. #50 Test failure in TEST='test/hotspot/jtreg/:tier1_common following SecurityManager & AccessController support for privileges and access control with VirtualThread's #46 #49 SecurityManager & AccessController support for privileges and access control with VirtualThread's #46
These additional methods added to AccessController are a result of Java not placing a domain on the stack to represent an external data source, if that data source is authenticated, then it might have privilege, or if the data is parsed and verified, then it may be "untainted". The implementors of Java did not do this, instead, they provided these methods so code could reduce privileges, prior to parsing untrusted data for example, this would not have been necessary, were there a domain on the stack representing untrusted data. |
Although these methods added in Java 1.8, were focused on code, there is an opportunity to make use of these methods, to allow permission to be granted to authenticated Principal's by removing the privileges of privileged domain code, this is especially true in the case of Java serialization. |
Three argument AccessController::doPrivileged methods were added in Java 8, c0c2397 their implementation has added significant complexity to AccessControlContext.
The text was updated successfully, but these errors were encountered: