-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle method calls with field access (#427)
A field access example might be a call with java.security.SecureRandom.getInstance(); where instead of importing SecureRandom from java.security, the full package path to access is included thus negating the need to import. Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
- Loading branch information
Showing
4 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/unit/rules/java/stdlib/java_security/examples/JavaSecuritySecureRandomSHA1PRNG.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// level: WARNING | ||
// start_line: 9 | ||
// end_line: 9 | ||
// start_column: 83 | ||
// end_column: 93 | ||
public class JavaSecuritySecureRandomSHA1PRNG { | ||
public static void main(String[] args) { | ||
try { | ||
java.security.SecureRandom sr = java.security.SecureRandom.getInstance("SHA1PRNG"); | ||
} catch (java.security.NoSuchAlgorithmException e) { | ||
System.err.println("SHA1PRNG random algorithm not available."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters