Repository navigation
[backport camel-4.18.x] CAMEL-26322: camel-as2 - scope the async MDN allow-list to host and port, and add an option to require https - #29055
Conversation
…allow-list to host and port, and add an option to require https
|
The backport is incomplete: the cherry-pick carried 🔴 Compile-time failuresFinding 3 — Test constructors called with 11 args, but constructor has 10 parameters
new AS2ServerConnection("1.1", "Camel", "sender.example.com",
null, null, "user", "password", null, ALLOWED, null, false)But the constructor added by this PR has exactly 10 parameters ( Finding 4 — Tests call a 4-arg
🔴 Dead security controlFinding 1 —
Finding 2 — The configuration plumbing is complete ( Finding 5 — Documentation describes behaviour that doesn't exist The updated documentation says "a bare host matches only the default port for the scheme (80 for http, 443 for https)", but Finding 6 — Javadoc on getter/setter promises enforcement that doesn't exist
What's missing from the backportThe following pieces exist on
Until these are included, |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for picking this up. The allow-list now matching host and port is a useful change for 4.18, but this port does not build yet, and part of it depends on a change that is not on this branch:
-
Compile error.
AS2ServerConnectiongetsthis.sslContext = sslContext;(around line 676), but 4.18 has nosslContextfield on that class, hencecannot find symbolin CI. -
asyncMdnRequireHttpsneeds TLS delivery, which 4.18 does not have. Onmain, https delivery of asynchronous MDNs came with CAMEL-24474 (4.23). On 4.18,AS2AsynchronousMDNManager.send()still refuses every non-httpaddress ("TLS delivery of asynchronous MDNs is not supported"). With this port,requireHttpsis stored but never read; if it were enforced, it would refuse every delivery, since http is the only scheme that works here. The option's Javadoc and docs promise behaviour the branch cannot provide, and thehttpsIsAcceptedWhenHttpsIsRequired/httpIsRefusedWhenHttpsIsRequiredtests rely on anSSLContextoverload ofdeliver. The bare-host text "443 forhttps" inas2-component.adocdoes not apply on 4.18 either.I'd suggest limiting the 4.18 port to the host-and-port scoping of
asyncMdnAllowedHosts(withisAllowedAuthority, its tests and the doc text abouthost:port/ IPv6 brackets), and leavingasyncMdnRequireHttpsout. What do you think? -
Upgrade note. A bare-host entry now matches only the default port, so deployments receiving MDNs on another port have to add the port. That needs an entry under
== Upgrading from 4.18.5 to 4.18.6incamel-4x-upgrade-guide-4_18.adoc, on this branch and onmain(main only has it in the 4_24 guide).
Reviewed with Claude Code on behalf of Claus Ibsen (@davsclaus). This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all 6 previously raised issues have been addressed. The port-aware allow-list and requireHttps enforcement are correctly implemented. Two documentation inaccuracies remain.
✅ Previous findings resolved
- Finding 1 —
requireHttpsfield was dead (never read insend()): ✅ fixed — the checkif (requireHttps && !"https".equals(scheme))is now present. - Finding 2 — wiring complete but enforcement missing: ✅ fixed — end-to-end plumbing (
AS2Configuration→AS2ConsumerConfiguration→AS2ConnectionHelper→AS2Consumer→AS2AsynchronousMDNManager) is complete. - Finding 3 — test constructors called with 11 args (SSLContext not backported): ✅ fixed — 10-parameter form used.
- Finding 4 — tests calling 4-arg
deliver()that didn't exist: ✅ fixed — 3-argdeliver(address, allowedHosts, requireHttps)overload added. - Finding 5 —
defaultPorthardcoded to 80 with no scheme-branching: ✅ acknowledged — the implementation only supports http (see remaining issues below for the doc side). - Finding 6 — Javadoc promised enforcement that didn't exist: ✅ fixed — Javadoc on
setAsyncMdnRequireHttpsaccurately describes behaviour that now exists.
The isAllowedAuthority / authorityMatches logic is correct: bracketed IPv6 parsing, bare-host → default-port, and host:port entries all handled properly.
⚠️ Two documentation inaccuracies
This review was generated by an AI agent, Hermès on behalf of @gnodet.
…dnRequireHttps on camel-4.18.x - asyncMdnAllowedHosts: bare-host entries match only port 80 (TLS not supported); remove '443 for https' from Javadoc, user docs and catalog JSON - asyncMdnRequireHttps: clarify that only http is accepted in this branch; TLS delivery of async MDNs is not yet implemented - Add upgrade guide entry for the host-and-port matching behavior change
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — both previously raised documentation inaccuracies have been addressed in AS2Configuration.java and as2-component.adoc. However, the generated artifacts were regenerated with inconsistent Javadoc text and still contain the old inaccuracies.
✅ Previous findings resolved
- Finding 1 —
asyncMdnAllowedHostsJavadoc claimed "80 for http, 443 for https" default ports: ✅ fixed inAS2Configuration.java— now correctly states "matches only the default port (80)". - Finding 2 —
asyncMdnRequireHttpsJavadoc stated "by default both http and https are accepted": ✅ fixed inAS2Configuration.java— now correctly states "by default only http is accepted (TLS delivery of asynchronous MDNs is not yet implemented)". - Finding 3 (from original
davsclausreview) — upgrade guide entry: ✅ added undercamel-4x-upgrade-guide-4_18.adoc.
⚠️ Two generated artifacts still carry the stale descriptions
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all previous findings are resolved.
✅ davsclaus concerns resolved
- Compile error (
sslContextfield): ✅ fixed —sslContextis now passed as a constructor parameter, not stored as a field. Nothis.sslContext = sslContextassignment in the diff. asyncMdnRequireHttpsin 4.18: ✅ addressed — the option now enforces its security guarantee (credentials are never sent over a sender-chosen http address) with honest Javadoc: "by default only http is accepted (TLS delivery of asynchronous MDNs is not yet implemented)." Setting it totrueis a valid opt-in posture for strict operators.- Upgrade note: ✅ added under "Upgrading from 4.18.5 to 4.18.6" in
camel-4x-upgrade-guide-4_18.adoc.
One nit
One Javadoc line runs to 161 characters. The inline comment has a suggestion.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
CI's regen.sh detected comment wrap differences in AS2ServerConnection.java, AS2Configuration.java, and the generated AS2EndpointBuilderFactory.java. Apply the exact rewrapping the code generator produces to eliminate the "uncommitted changes" CI failure.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the nit (161-char Javadoc line) from the last pass is resolved.
✅ All previous findings resolved
- Port-aware allow-list: ✅ implemented —
isAllowedAuthority()+authorityMatches()match the full host:port authority. requireHttpswiring: ✅ complete — field added toAS2ConsumerConfiguration, propagated throughAS2ServerConnectionand wired intoAS2AsynchronousMDNManager.- Test coverage: ✅
AS2ServerTwoConsumerAsyncMdnSettingsTestupdated to uselocalhost:PORTentries; new unit tests for port-based matching andrequireHttpsadded. - Upgrade guide: ✅ documents the bare-host → default-port change.
One remaining gap — upgrade guide omits IPv6 format change
The upgrade guide correctly documents the non-default port migration (partner.example → partner.example:8443), but omits a second breaking change that affects IPv6 users.
Before this PR: isAllowedHost() compared entry.trim().equalsIgnoreCase(host) — host-only, no port. normalizeHost() strips brackets from URI.getHost(), so host = "::1". An entry ::1 (unbracketed) matched delivery to http://[::1]:1/ regardless of port.
After this PR: authorityMatches("::1", "::1", 1, 80) — entry ::1 has multiple colons → falls into the "unbracketed IPv6 → bare-host" branch → entryPort = 80, entryPort (80) ≠ port (1) → refused. The same applies even at port 80: an entry ::1 now requires [::1]:80 to match http://[::1]:80/.
A deployment with asyncMdnAllowedHosts=::1 that worked before this commit silently stops matching all IPv6 MDN deliveries. The inline comment has a suggestion.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all 6 findings have been addressed in this update.
Finding 1 (requireHttps dead store) — ✅ Addressed. send() now enforces the flag with if (requireHttps && !"https".equals(scheme)) throw.
Finding 2 (requireHttps wiring without enforcement) — ✅ Addressed. End-to-end plumbing from AS2Configuration → AS2ConsumerConfiguration → AS2AsynchronousMDNManager now carries the flag through to enforcement.
Finding 3 (constructor arg-count mismatch) — ✅ Addressed. Overloaded constructors added to AS2AsynchronousMDNManager and AS2ServerConnection; the original constructors now delegate to the new ones with requireHttps=false, preserving backward compatibility.
Finding 4 (missing 4-arg deliver() test helper) — ✅ Addressed. A 3-arg deliver(address, hosts, requireHttps) overload is added; the 4-arg variant with SSLContext is appropriately out of scope for the 4.18.x backport where TLS delivery is not yet implemented.
Finding 5 (defaultPort=80 with no scheme-awareness) — ✅ Addressed (scope). On camel-4.18.x, the existing scheme check (if (!"http".equals(scheme))) already rejects https, so defaultPort=80 is correct for this branch. The isAllowedAuthority(host, port, defaultPort) API is forward-compatible — when TLS delivery lands, callers pass defaultPort=443 for https.
Finding 6 (Javadoc promises enforcement that doesn't exist) — ✅ Addressed. The enforcement is now real; the Javadoc is accurate.
The upgrade guide entry correctly documents the breaking change to asyncMdnAllowedHosts (now matches host+port, not host only), and the tests for asyncMdnRequireHttps (httpIsRefusedWhenHttpsIsRequired, httpIsAcceptedWhenHttpsIsNotRequired) exercise the new enforcement path.
LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Backport of #28527
Cherry-pick of 8cedca3 to camel-4.18.x.
Conflicts resolved automatically by backport bot agent.