davsclaus commented on code in PR #31126:
URL: https://github.com/apache/camel/pull/31126#discussion_r4740039758


##########
components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java:
##########
@@ -783,18 +783,33 @@ private String generateXmlCipherAlgorithmKeyWrap() {
         return algorithmKeyWrap;
     }
 
-    // Check to see if the asymmetric key transport algorithm is allowed
+    private static boolean isGcmAlgorithm(String algorithm) {
+        return XMLCipher.AES_128_GCM.equals(algorithm)
+                || XMLCipher.AES_192_GCM.equals(algorithm)
+                || XMLCipher.AES_256_GCM.equals(algorithm);
+    }
+
+    // Check to see if the data cipher and asymmetric key transport algorithms 
are allowed
     private void checkEncryptionAlgorithm(Key keyEncryptionKey, Element 
parentElement) throws Exception {
+        Element encryptedElement = findEncryptedDataElement(parentElement);
+        if (encryptedElement == null) {
+            return;
+        }
+
+        String configuredXmlCipher = resolvedXmlCipherAlgorithm();
+        if (isGcmAlgorithm(configuredXmlCipher)) {
+            String foundDataMethod = findEncryptionMethod(encryptedElement);
+            if (foundDataMethod != null && !isGcmAlgorithm(foundDataMethod)) {

Review Comment:
   Addressed in 74165d0: a missing `EncryptedData` or `EncryptionMethod` now 
fails closed (`foundDataMethod == null || !isGcmAlgorithm(...)`).
   
   _Claude Code on behalf of davsclaus_



-- 
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]

Reply via email to