...
An alternative approach is to create a secure sandbox using a security manager . (See see SEC60-JG. Create a secure sandbox using a security manager.) The application should prevent the script from executing arbitrary commands, including, for example, querying the local file system. The two-argument form of doPrivileged()
can be used to lower privileges when the application must operate with higher privileges but the scripting engine must not. The RestrictedAccessControlContext
strips reduces the permissions granted in the default policy file by reducing the permissions granted to those of the newly created protection domain. The effective permissions are the intersection of the permissions of the newly created protection domain and the systemwide security policy. Refer to SEC50-JG. Avoid granting excess privileges for more details on the two-argument form.
...