What are these Security Objectives:
* Denial of Service
* Confidential Information
* Injection and Inclusion
What are these Security Objectives:
* Accessibility and Extensibility
* Input Validation
* Mutability
What are these Security Objectives:
* Object Construction
* Serialization and Deserialzation
* Access Control
How permissions are check in Java?
How to restrict privileges through invoking java.security.AccessController.doPrivileged()?
Access Permission Control Example
Permission perm = new java.io.FilePermission(f.getPath(), "read"); PermissionCollection perms = perm.newPermissionCollection(); perms.add(perm);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
l.add(fun.apply(f));
return null;
}},
new AccessControlContext(
new ProtectionDomain[] {
new ProtectionDomain(null, perms)
}
)
);
**By applying a new AccessControlContext with just the read permission, it ensures that even if the caller has full permissions, it is restricted to performing only the read operation.**</Void>
Permission perm = new java.io.FilePermission(f.getPath(), “read”);
AccessController.checkPermission(perm);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
l.add(fun.apply(f));
return null;
}}
);
**This only checks whether the caller has read permission or not. It doesn't restrict the caller to doing only the read operation. If the caller already has write or delete permission, the caller will be able to overwrite and delete the files.**</Void>
What are the tow most important overloaded doPrivileged methods in java.security.AccessController?