Skip to content

[backport camel-4.22.x] CAMEL-25645: camel-milo - let the OPC UA client validate the server certificate against a trust list - #28053

Merged
davsclaus merged 5 commits into
apache:camel-4.22.xfrom
oscerd:backport/27824-to-camel-4.22.x
Oct 18, 2026
Merged

davsclaus merged 5 commits into
apache:camel-4.22.xfrom
oscerd:backport/27824-to-camel-4.22.x

Conversation

@oscerd

@oscerd oscerd commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Backport of #27824, with the test follow-up #27999, onto camel-4.22.x.

Original PRs: #27824 - CAMEL-25645: camel-milo - let the OPC UA client validate the server certificate against a trust list, and #27999 - CAMEL-25645: camel-milo - ServerCertificateValidationTest writes the value before the consumers start
Target branch: camel-4.22.x

CAMEL-25645

What it does

As on main, milo-client and milo-browse validate the certificate of the OPC UA server when the selected endpoint uses a security policy other than None:

  • New options:
    • trustListDirectory: Milo's file based trust list. It checks the chain, the validity period, the revocation status and the application URI. A CA-issued certificate needs a CRL of its CA in the trust list.
    • certificateValidator: a custom validator.
    • trustAllCertificates: marked insecure:ssl.
  • Without trust configuration, the client does not connect to such an endpoint, and logs a WARN that says why.
  • The same validator checks the certificate that the user name and password are encrypted with.
  • The last connection failure is the cause of No connected.

Adaptations for camel-4.22.x

This is not a straight cherry-pick, so it needs a review:

  • On this branch the connection cache id does not contain the requested publishing interval. The conflict in MiloClientConfiguration.toCacheId() keeps this branch's id and appends the trust settings, and MiloClientConfigurationTest expects the endpoint URI alone without trust settings.
  • The generated files are regenerated for this branch. SecurityUtils on this branch is keyed by option name only, and its existing trustallcertificates entry already covers the new option.
  • The 4.24 upgrade guide is not part of this backport. The note for this branch goes into the 4.22 guide on main, in a new 4.22.3 section, because 4.22.2 was already tagged.

Tests

  • camel-milo: 60 tests, 0 failures, 1 skipped (MonitorItemMultiConnectionsCertTest, already @Disabled), including ServerCertificateTrustTest, MiloClientConfigurationTest and the end-to-end ServerCertificateValidationTest.
  • A full reactor build of the branch.

Claude Code on behalf of Andrea Cosentino

🤖 Generated with Claude Code

oscerd and others added 5 commits October 18, 2026 12:15
…ertificate against a trust list

milo-client and milo-browse kept the default certificate validator of the
Eclipse Milo client configuration, which accepts any server certificate, and
had no option to configure trust material.

The client now validates the server certificate whenever the selected
endpoint uses a security policy other than None, with the trust list in
trustListDirectory or the validator in certificateValidator, and does not
connect when neither is configured. The new trustAllCertificates option,
marked insecure:ssl, accepts any server certificate. The same validator
checks the certificate that the user identity token is encrypted with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
The trust list validator checks the application URI, the validity period
and the revocation status of the server certificate. As OPC UA requires, a
certificate issued by a CA needs a revocation list of that CA in the trust
list. The documentation describes these checks exactly.

A missing trust configuration and a failed certificate or security check
are logged at WARN, and the last connection failure is the cause of the
"No connected" exception that a producer gets. The end-to-end test asserts
that reason, and the unit tests cover revoked, expired, CA without
revocation list and application URI cases. The connection cache id uses
the class name of a custom validator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
… the trust list

A server certificate issued by a CA is refused with
Bad_CertificateRevocationUnknown when the trust list holds no revocation list
of that CA. The component documentation, the option description and the
upgrade guide said the opposite, and now describe this requirement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
…nerate

On camel-4.22.x the connection cache id does not contain the requested
publishing interval, so the cache id test expects the endpoint URI alone.
The generated files are regenerated for this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
…value before the consumers start (apache#27999)

Since CAMEL-25626 a consumer also delivers a null value with a Bad status, so
a client that connected before the test wrote Foo received the initial Bad
value of the item as well, and mock:trustAll got 2 messages. The two changes
were merged on main 26 seconds apart and neither PR build ran with the other.

The consumer routes now start after the value is written, as MonitorItemTest
does since CAMEL-25626, so Foo is the first notification of each client.

Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit eb14b16)
@oscerd oscerd added the backport indicate that a Pull request is a backport from a fix from the main branch label Oct 18, 2026
@oscerd
oscerd requested review from davsclaus and gnodet October 18, 2026 11:00
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-milo
  • dsl/camel-componentdsl
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 12 tested, 26 compile-only — current: 9 all tested

Maveniverse Scalpel detected 38 affected modules (current approach: 9).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 12 modules (4 direct + 8 downstream), skip tests for 26 (generated code, meta-modules)

Modules Scalpel would test (12)
  • camel-catalog
  • camel-componentdsl
  • camel-endpointdsl
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-milo
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (26)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-csimple-maven-plugin
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (38 modules)
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: Milo
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus 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.

Thanks @oscerd.

Not a straight cherry-pick, so this was reviewed against 1109759 plus the test fix eb14b16 (#27999), which is folded in here. Every non-generated file matches main except for these, all of them needed on camel-4.22.x:

  • MiloClientConfiguration.toCacheId() and MiloClientConfigurationTest keep the branch's cache id without requestedPublishingInterval. That suffix comes from other main-only work, and the trust settings this PR appends to the cache id are the same as on main.
  • SecurityUtils is left alone. On camel-4.22.x it has no SECURITY_OPTION_OWNERS map, and trustallcertificates is already in SECURITY_OPTIONS as insecure:ssl for any component. So the security policy already sees trustAllCertificates=true on milo-client / milo-browse, and the option carries security = "insecure:ssl" here as on main.

ServerCertificateTrust, the SubscriptionManager changes (the validator also covers the UsernameProvider for both the explicit username/password options and the URI user info), the docs and the three tests are the same as on main. Branch Milo is 1.1.6, so the API is the same as main's 1.1.8. The generated files are consistent: both component JSON copies are identical, indexes are sequential, the three options show up at component and endpoint level, and the configurers, URI factories, component DSL, endpoint DSL and catalog docs are all regenerated. CI is green. The incremental build ran camel-milo, including ServerCertificateValidationTest, ServerCertificateTrustTest (13 tests) and MiloClientConfigurationTest.

The upgrade guide note for this behaviour change (a client that used to connect to a Sign/SignAndEncrypt endpoint without trust settings now refuses to connect) is in #28055 on main, under "Upgrading from 4.22.2 to 4.22.3". That one can be merged once this is in.

LGTM.

Claude Code on behalf of Claus Ibsen

@davsclaus davsclaus added this to the 4.22.3 milestone Oct 18, 2026
@davsclaus davsclaus added the bug Something isn't working label Oct 18, 2026
@davsclaus
davsclaus merged commit 80f552a into apache:camel-4.22.x Oct 18, 2026
5 checks passed
@oscerd
oscerd deleted the backport/27824-to-camel-4.22.x branch October 19, 2026 07:12
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 bug Something isn't working catalog components docs dsl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants