github-advanced-security[bot] commented on code in PR #19828:
URL: https://github.com/apache/druid/pull/19828#discussion_r3686945729


##########
processing/src/main/java/org/apache/druid/crypto/CryptoService.java:
##########
@@ -132,15 +155,19 @@
   public byte[] decrypt(byte[] data)
   {
     try {
-      EncryptedData encryptedData = EncryptedData.fromByteArray(data);
+      if (hasAuthenticatedFormatMagic(data)) {
+        return decryptAuthenticated(data);
+      }
+
+      final EncryptedData encryptedData = EncryptedData.fromByteArray(data);
 
-      SecretKey tmp = getKeyFromPassword(passPhrase, encryptedData.getSalt());
-      SecretKey secret = new SecretKeySpec(tmp.getEncoded(), cipherAlgName);
+      final SecretKey tmp = getKeyFromPassword(passPhrase, 
encryptedData.getSalt());
+      final SecretKey secret = new SecretKeySpec(tmp.getEncoded(), 
cipherAlgName);
 
       // error-prone warns if the transformation is not a compile-time constant
       // since it cannot check it for insecure combinations.
       @SuppressWarnings("InsecureCryptoUsage")
-      Cipher dcipher = Cipher.getInstance(transformation);
+      final Cipher dcipher = Cipher.getInstance(transformation);

Review Comment:
   ## CodeQL / Use of a potentially broken or risky cryptographic algorithm
   
   Cryptographic algorithm [CBC](1) may not be secure. Consider using a 
different algorithm.
   Cryptographic algorithm [PKCS5Padding](2) may not be secure. Consider using 
a different algorithm.
   Cryptographic algorithm [CBC](3) may not be secure. Consider using a 
different algorithm.
   Cryptographic algorithm [PKCS5Padding](4) may not be secure. Consider using 
a different algorithm.
   Cryptographic algorithm [%s/%s/%s](5) may not be secure. Consider using a 
different algorithm.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/11448)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to