ParkerM opened a new pull request, #31330:
URL: https://github.com/apache/camel/pull/31330

   _Claude Code on behalf of @ParkerM_
   
   [CAMEL-28095](https://issues.apache.org/jira/browse/CAMEL-28095)
   
   CAMEL-26425 computes the MDN's `Received-Content-MIC` over the signed part 
as received. `MicUtils.findMultipartSignedEntity` looks for the 
`multipart/signed` at the top level, inside a top-level `compressed-data` 
entity, and as the decrypted entity of an `enveloped-data` message. It didn't 
look inside a `compressed-data` entity that is itself the decrypted entity, 
which is how a message that was signed, then compressed, then encrypted 
arrives. For that structure the MIC fell back to a re-serialisation of the 
parsed part, which the sender can't match when the part has folded headers, or 
a `base64` or `quoted-printable` body with its own line length or escaping.
   
   Changes:
   
   - `MicUtils`: the `enveloped-data` branch also decompresses a decrypted 
`compressed-data` entity, with the same `MAX_COMPRESSED_ENTITY_EXPANSION` bound 
as the top-level `compressed-data` branch, and returns the 
`MultipartSignedEntity` found inside. That entity is parsed by `EntityParser`, 
so `getSignedDataContent()` returns the part as received, as at the other 
depths.
   - `MultipartSignedEntityAsReceivedTest`: 
`micOfASignedThenCompressedThenEncryptedMessageIsComputedOverThePartAsReceived` 
builds such a message from raw bytes for `base64`, `quoted-printable` and 
`binary` parts, and checks the MIC is the digest of the signed part as sent. 
Without the change in `MicUtils`, two of the three cases fail. The `binary` 
case passes either way, because its re-serialisation happens to be 
byte-identical.
   - Upgrade guide 4.25: an entry next to the CAMEL-26425 ones in the 4.22 and 
4.24 guides.
   
   `mvn verify` in `components/camel-as2` passes: 163 tests in `camel-as2-api` 
and 157 in `camel-as2-component`. 
`AS2ServerSecEncryptedSignedIT.invalidSigningCertFailureTest` failed once with 
a 404 on a loaded machine, and passed on reruns with and without this change. 
`-Psourcecheck` passes on `camel-as2-api`.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
     Run in `components/camel-as2`, the module that changed, as 
`.oss-ai-helper-rules/project-standards.md` describes; it left no uncommitted 
changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   


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