Skip to content

Conversation

@hareeshvp
Copy link

No description provided.


public static SecretKeySpec getKeySpec1() throws UnsupportedEncodingException {
String secret = "It's a secret to everybody 1.";
SecretKeySpec keyspec = new SecretKeySpec(secret.getBytes("UTF-8"), "MD5");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR Comment From Polaris SAST

Polaris SAST Issue - Use of Hard-coded Cryptographic Key

Medium CWE-321
A cryptographic key is stored directly in the source code.

Users with access to this source code can use this key to access encrypted production data. Changing this key requires changing the code and re-deploying the application.

How to fix

Potential mitigations include the following:

  1. Prevention schemes mirror that of hard-coded password storage.


public static SecretKeySpec getKeySpec1() throws UnsupportedEncodingException {
String secret = "It's a secret to everybody 1.";
SecretKeySpec keyspec = new SecretKeySpec(secret.getBytes("UTF-8"), "MD5");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR Comment From Polaris SAST

Polaris SAST Issue - Weak Hash Function

Medium CWE-328
A risky hashing function was used. This may allow an attacker to produce collisions on the hash or execute length extension attacks.

A use of a weak hashing algorithm was detected. There exist well known ways to produce collisions on the hashes.

How to fix

Ensure the use of cryptographically strong hashing algorithms such as the ones approved by NIST:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants