oscerd opened a new pull request, #25641: URL: https://github.com/apache/camel/pull/25641
Fixes [CAMEL-24429](https://issues.apache.org/jira/browse/CAMEL-24429). ## The problem `ResponseMDN` holds the AS2 security material in mutable instance fields and overwrites them per request when the keys are dynamic: ```java this.signingAlgorithm = (AS2SignatureAlgorithm) context.getAttribute(...); this.signingCertificateChain = (Certificate[]) context.getAttribute(...); this.signingPrivateKey = (PrivateKey) context.getAttribute(...); ... ``` A single `ResponseMDN` is registered on the shared `HttpProcessor` and serves every request. The assignment block is not covered by the class's lock — that lock guards the lazily built Velocity engine — and the values stay in place after the request that set them. A deployment hosting several partners on different paths, each with its own keys, can therefore sign one partner's MDN with another partner's private key, or validate against the wrong chain. An MDN is the non-repudiation record for the interchange, so signing it with the wrong key undermines the property it exists to carry. ## The change `process()` resolves the five values into locals for the duration of the call. The locals shadow the fields, so the three downstream uses need no change. The fields and `keysAreDynamic` are now `final`, which is the actual regression guard: a later change cannot reintroduce per-request mutation without failing to compile. Both constructors assign every field, the dynamic-keys one with `null`. No public API change, no configuration change, no behaviour change for a single-partner deployment. ## Testing `ResponseMDNPerRequestKeysTest` states the property directly — after a request carrying dynamic keys has been processed, the shared instance retains none of them. Against the previous code it fails with: ``` expected: <null> but was: <SHA256WITHRSA> ``` `camel-as2-api` 95 tests and `camel-as2-component` 12 tests pass, along with a full `mvn clean install -DskipTests` across all 697 modules. _Claude Code on behalf of oscerd_ -- 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]
