Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
protected PermissionCollection getPermissions(CodeSource cs) {
  PermissionCollection pc = new Permissions();
  // allowAllow exit from the VM anytime
  pc.add(new RuntimePermission("exitVM"));
  return pc;
}

...

In this compliant solution, the getPermissions() method calls super.getPermissions(). As a result, the default systemwide security policy is applied , in addition to the custom policy.

Code Block
bgColor#ccccff
protected PermissionCollection getPermissions(CodeSource cs) {
  PermissionCollection pc = super.getPermissions(cs);
  // allowAllow exit from the VM anytime
  pc.add(new RuntimePermission("exitVM"));
  return pc;
}

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

SEC07-J

High

Probable

Low

P18

L1

Automated Detection

Violations of this rule can be discovered with a heuristic checker in the style of FindBugs. As with all heuristic checks, achieving a low false-positive rate is essential.

Android Implementation Details

The java.security package exists on Android for compatibility purposes only, and it should not be used.

Bibliography

 

...

Image Modified      14. Platform Security (SEC)      SEC08-J. Define wrappers around native methodsImage Added Image Added