Skip to content

[backport camel-4.18.x] CAMEL-24677: camel-smooks - align XML reader configuration with the other XML components - #26329

Merged
davsclaus merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/26270-to-camel-4.18.x
Sep 11, 2026
Merged

[backport camel-4.18.x] CAMEL-24677: camel-smooks - align XML reader configuration with the other XML components#26329
davsclaus merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/26270-to-camel-4.18.x

Conversation

@oscerd

@oscerd oscerd commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Backport of #26270 to camel-4.18.x.

Original PR: #26270CAMEL-24677
Original author: @oscerd

Not a straight cherry-pick — adapted for camel-4.18.x

  • Security marker dropped: camel-4.18.x's @UriParam does not have the security / insecureValue attributes (that infrastructure is newer) and SecurityUtils does not exist on this branch, so the allowExternalEntities endpoint option is declared without them.
  • JUnit 5: the new component test uses camel-test-junit5 (this branch uses JUnit 5; main uses JUnit 6).
  • The main-only 4.23 upgrade-guide entry and generated files that do not exist on this branch (newer camel-java-io/camel-yaml-io writers, the canonical/model YAML schema variants) are excluded.

The runtime fix (hardened DOM pre-parse via SmooksSecuritySupport, applied only when the config uses the default XML reader) and the allowExternalEntities option are otherwise identical to the merged PR.

Verified on camel-4.18.x

A full mvn clean install -DskipTests passes on this branch, and all generated files (catalog, endpoint-DSL, YAML-DSL deserializers/schema, XSDs) are regenerated for camel-4.18.x. The two new XML-security tests pass, confirming external entities are not resolved by default and are resolved with allowExternalEntities=true.

As a non-mechanical backport, this needs a normal review (it is not eligible for the straight-cherry-pick fast path).

🤖 Generated with Claude Code

@oscerd oscerd added the backport indicate that a Pull request is a backport from a fix from the main branch label Sep 11, 2026
@oscerd
oscerd marked this pull request as ready for review September 11, 2026 12:16
@oscerd
oscerd requested a review from davsclaus September 11, 2026 12:17
…ther XML components

Backport of apache#26270 to camel-4.18.x.

Adapted for this branch:
- The endpoint option drops the @UriParam security/insecureValue attributes, which do
  not exist on camel-4.18.x.
- The new component test uses JUnit 5 (camel-test-junit5), matching this branch.

The runtime fix, the allowExternalEntities option, and the two new XML-security tests
are otherwise identical to the merged PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@oscerd
oscerd force-pushed the backport/26270-to-camel-4.18.x branch from 8f6386f to 048fbbd Compare September 11, 2026 12:43
oscerd added a commit to oscerd/camel that referenced this pull request Sep 11, 2026
…4.22 and 4.18 upgrade guides

The fix was backported to camel-4.22.x (apache#26327, merged) and camel-4.18.x (apache#26329). The
version-specific upgrade guides live on main, so add the 4.22.1 and 4.18.5 notes here to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean security backport of #26270 to camel-4.18.x. Reviewed the 8 hand-written files (SmooksSecuritySupport, SmooksProcessor, SmooksEndpoint, SmooksDataFormat × model + runtime, SmooksDataFormatReifier, both security tests) and all generated artifacts.

Security architecture is sound:

  • SmooksSecuritySupport is identical to main — correct use of DocumentBuilderFactory with all external entity features disabled, proper synchronized around the non-thread-safe factory, DocumentBuilder.parse() correctly outside the lock.
  • hardenXmlInput flag computed once at doStart() — no per-message overhead when the config uses a custom reader (EDI/CSV/JSON).
  • getSource() reordering in SmooksProcessor matches main: NodehardenXmlInputbyte[]InputStream, ensuring DOM payloads bypass the security pre-parse (they're already parsed).

Backport adaptations are correct:

  • No security/insecureValue attributes on @UriParam (those don't exist on 4.18.x) — the security label is set via the label attribute instead.
  • JUnit 5 test framework (vs JUnit 6 on main).
  • Generated files are consistent with the 4.18.x code generators.

Wiring verified: SmooksComponent.configureSmooksProcessor() calls setProperties(smooksProcessor, parameters) which injects allowExternalEntities from endpoint URI parameters into the processor.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid backport of CAMEL-24677 (XXE hardening for camel-smooks) to camel-4.18.x. Reviewed the security implementation, API threading, concurrency, and backport adaptations — no issues found.

Security: SmooksSecuritySupport.createSecureDocumentBuilderFactory() correctly disables FEATURE_SECURE_PROCESSING, external general entities, external parameter entities, and external DTD loading. The defense-in-depth approach (swallowing ParserConfigurationException when a feature isn't recognized) is appropriate.

Concurrency: The shared DocumentBuilderFactory is correctly synchronized for newDocumentBuilder() calls, and the DocumentBuilder instance is used only within the calling thread.

Payload ordering in SmooksProcessor.getSource(): Moving the instanceof Node check before the hardenXmlInput path is correct — DOM payloads have no InputStream to parse and carry no XXE risk.

Backport adaptations: @UriParam uses label = "security" instead of the main-only security/insecureValue attributes. Tests correctly use camel-test-junit5. No SecurityUtils dependency (doesn't exist on this branch).

This review was generated by an AI agent, Hermès on behalf of @gnodet.

davsclaus pushed a commit that referenced this pull request Sep 11, 2026
…4.22 and 4.18 upgrade guides (#26332)

The fix was backported to camel-4.22.x (#26327, merged) and camel-4.18.x (#26329). The
version-specific upgrade guides live on main, so add the 4.22.1 and 4.18.5 notes here to match.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@davsclaus davsclaus added this to the 4.18.5 milestone Sep 11, 2026
@davsclaus davsclaus added the enhancement New feature or request label Sep 11, 2026
@davsclaus
davsclaus merged commit 680290f into apache:camel-4.18.x Sep 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants