CAMEL-24298: extend the allowedSchemes allow-list to the sibling dynamic-URI EIPs - #25361
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for extending allowedSchemes to the sibling dynamic-URI EIPs, @oscerd — the centralised ProcessorHelper approach is clean and the generated files are all consistent.
Two copy-constructor omissions need fixing before this can merge (details in the inline comments). Everything else is a suggestion or design question.
Questions
Positive test case — the test covers rejection well, but there is no positive test verifying an allowed scheme passes through. A single test (e.g. recipientList(header("target")).allowedSchemes("mock") with target=mock:result, asserting the message arrives) would strengthen confidence.
ignoreInvalidEndpoints interaction — for toD, a disallowed scheme always hard-fails (check is before the ignoreInvalidEndpoint catch). For these 5 EIPs, the check sits inside the existing try-catch, so ignoreInvalidEndpoints=true would silently skip a disallowed scheme. Is that intentional, or should allowedSchemes always be a hard boundary?
This review covers project rules and conventions. It does not replace specialised tools (CodeRabbit, SonarCloud) for deep static analysis.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 552 tested, 26 compile-only — current: 549 all testedMaveniverse Scalpel detected 578 affected modules (current approach: 549).
|
|
i am working on this |
|
Thanks for the thorough review @davsclaus — all points addressed: Copy constructors — both Positive test — added
Claude Code on behalf of Andrea Cosentino (@oscerd) |
6246de6 to
c7900a1
Compare
…mic-URI EIPs Following the toD MVP (apache#25315), add the optional allowedSchemes allow-list to the remaining dynamic-URI EIPs: recipientList, routingSlip, dynamicRouter, enrich and pollEnrich. A resolved dynamic recipient whose scheme is not in the configured list is rejected. Enforcement is a shared ProcessorHelper.checkAllowedSchemes(...) called at each processor's recipient-resolution point: RoutingSlip (and DynamicRouter, which extends it), PollEnricher and RecipientListProcessor after prepareRecipient; enrich delegates to its internal SendDynamicProcessor which already enforces it. Default unset = any scheme allowed (no behavioural change). Because the check throws at the resolution point, a disallowed scheme follows each EIP's existing ignoreInvalidEndpoint semantics (hard-fail by default). Each of the 5 model definitions gets the allowedSchemes attribute + getter/setter + fluent builder, wired through its reifier. DynamicUriEipAllowedSchemesTest covers rejection across all five EIPs. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
- Fix copy constructors in RecipientListDefinition and RoutingSlipDefinition to copy the allowedSchemes field (would be lost during AdviceWith / route template instantiation). - Add positive test verifying an allowed scheme passes through. - Make allowedSchemes a hard boundary: move the check before the ignoreInvalidEndpoints catch in RecipientListProcessor and PollEnricher so a disallowed scheme always fails regardless of ignoreInvalidEndpoints. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Verify that a disallowed scheme always hard-fails even when ignoreInvalidEndpoints is enabled on recipientList and pollEnrich. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
c7900a1 to
e19b80a
Compare
|
Thanks for taking this over and folding in the fixes, @davsclaus — the hard-boundary rework in One small completeness observation for a possible follow-up (non-blocking — this can land as-is): in Adding the same Claude Code on behalf of Andrea Cosentino |
…outingSlip Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
Good catch on the async continuation path — added `ProcessorHelper.checkAllowedSchemes(allowedSchemes, recipient)` after `prepareRecipient()` at the async path in `RoutingSlip.java`. The surrounding `catch` already sets the exception and breaks, so it hard-fails consistently with the sync path. Claude Code on behalf of davsclaus |
What
Follows the toD MVP (#25315, CAMEL-24298) by extending the optional
allowedSchemesallow-list to the remaining 5 dynamic-URI EIPs:recipientList,routingSlip,dynamicRouter,enrich,pollEnrich. A resolved dynamic recipient whose component scheme is not in the configured list is rejected — a defence-in-depth restriction for low-code / Kamelet deployments.Enforcement
A shared
ProcessorHelper.checkAllowedSchemes(...)(+parseAllowedSchemes(...)) is called at each processor's recipient-resolution point:prepareRecipient.Enricherdelegates to its internalSendDynamicProcessor, which already enforcesallowedSchemes(from CAMEL-24298: add an optional allowedSchemes allow-list to the toD dynamic-URI EIP #25315).Each of the 5 model definitions gets the
allowedSchemesattribute + getter/setter + fluent builder, wired through its reifier.Behaviour
Default unset = any scheme allowed → no behavioural change. The check always hard-fails (
ResolveEndpointFailedException) regardless ofignoreInvalidEndpoints—allowedSchemesis a security boundary, not an endpoint-validity question. This is consistent withtoDbehaviour.Tests
DynamicUriEipAllowedSchemesTest— a disallowed scheme (seda:against anallowedSchemes("mock")route) is rejected across all five EIPs.mock:resultagainstallowedSchemes("mock")) passes through and the message arrives.Full-reactor
mvn clean install -DskipTestsgreen (model JSON, XML/YAML schemas, DSL writers/parsers/deserializers, catalog regenerated). The option is documented on each EIP's auto-generated options table (via the@Metadatadescription).Scope
Completes CAMEL-24298:
toDlanded in #25315,wireTapinherits it, and this covers the 5 sibling EIPs. Main only — additive feature (default unrestricted), not a bug fix.Closes CAMEL-24298.
Claude Code on behalf of Andrea Cosentino (@oscerd)