You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/10/06 07:43:38 UTC
[PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
oscerd opened a new pull request, #27419:
URL: https://github.com/apache/camel/pull/27419
Follow-up to CAMEL-24735 (#27385), from @davsclaus's review there. The code is correct; the documentation that shipped with it is not — worth fixing before 4.23.0 goes out, so no user meets it.
### The documented route denies every request
The policy example configured no client authentication:
```java
from("netty-http:https://0.0.0.0:8443?sslContextParameters=#spiffeSsl")
.policy(spiffePolicy)
```
`SSLContextServerParameters.clientAuthentication` defaults to `null`, so the JSSE default applies and the server never *requests* a client certificate. `SSLSession.getPeerCertificates()` then throws `SSLPeerUnverifiedException`, `SpiffePeerIdentity` returns null, and the policy denies — correctly, failing closed. But that means the documented route rejects **every** request, and the only signal is an authorization failure.
The example now builds the server `SpiffeSSLContextParameters` with `clientAuthentication=REQUIRE`.
### Two caveats a reader could not have inferred
Both now in an `[IMPORTANT]` block:
- **The server must use `SpiffeSSLContextParameters`**, not a plain truststore that happens to trust the SPIFFE CA. Such a truststore accepts any SVID that CA issued, which is a weaker check than the allow-list this policy appears to give you.
- **Only camel-netty and camel-netty-http put the `SSLSession` on the message today**, as `CamelNettySSLSession`. Behind platform-http, jetty, undertow or servlet there is no session on the exchange, so the policy has no verified certificate to read and denies everything. A reader seeing a generic `AuthorizationPolicy` would reasonably assume otherwise.
The catalog copy of the component doc is a verbatim mirror and is updated in step — the two files are byte-identical after the change.
### Negative tests
Five, and I want to be clear that **the current code already passes all of them** — they pin behaviour rather than fix it:
- a `String`-valued `CamelNettySSLSession` header — a sender cannot assert an identity, because an `SSLSession` does not convert from a `String`;
- the two near-miss ids, `spiffe://example.org.evil/frontend` and `spiffe://example.org/frontend/x`;
- a malformed `spiffe://` URI SAN;
- a leaf certificate that is not an `X509Certificate`.
**Mutation check**, since tests that pass on unchanged code prove nothing by themselves: changing `isAuthorized` from the exact `Set.contains` to a prefix match fails `deniesAnIdWhosePathOnlyStartsWithTheAllowedOne` and nothing else. The trust-domain near-miss is *not* covered by that mutation — it rests on the exact-match semantics of `Set.contains` over parsed `SpiffeId`s, and I'd rather say so than imply all five are mutation-validated.
### The open question, answered rather than implemented
You asked whether `sslSessionHeader` should be required to start with `Camel`. It should not, and the String-header test is the demonstration: an `SSLSession` is a Java object, so it cannot arrive through an HTTP string header at all — the conversion simply yields null and the policy denies. Adding a name constraint would suggest a threat that does not exist here.
Module suite 46 tests green. Docs and tests only, no `@UriParam` change, so nothing regenerates.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27419:
URL: https://github.com/apache/camel/pull/27419#issuecomment-6011751319
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: 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](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27419:
URL: https://github.com/apache/camel/pull/27419
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27419:
URL: https://github.com/apache/camel/pull/27419#issuecomment-6012345113
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `catalog/camel-catalog`
- `components/camel-spiffe`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 9 of 698 tested, 26 compile-only — current: 9 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **9 affected modules** (current approach: 9).
**Skip-tests mode would test 9 modules** (2 direct + 8 downstream), **skip tests for 26** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (9)</summary>
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-route-parser
- `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
- `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
- `camel-spiffe` ← components/camel-spiffe/src/main/docs/spiffe-component.adoc, components/camel-spiffe/src/test/java/org/apache/camel/component/spiffe/SpiffeSecurityPolicyTest.java
- `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
- `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
</details>
<details><summary>Modules with tests skipped (26)</summary>
- `apache-camel`
- `camel-allcomponents`
- `camel-catalog-console`
- `camel-catalog-maven`
- `camel-catalog-suggest`
- `camel-componentdsl`
- `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`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
<details><summary>All tested modules (36 modules, 4m 24s total)</summary>
**Total reactor time:** 4m 24s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: JBang :: Plugin :: TUI | 36.8s | SUCCESS |
| Camel :: Launcher | 33.4s | SUCCESS |
| Camel :: JBang :: MCP | 29.5s | SUCCESS |
| Camel :: Catalog :: Camel Catalog | 18.4s | SUCCESS |
| Camel :: Component DSL | 18.0s | SUCCESS |
| Camel :: YAML DSL :: Validator | 15.2s | SUCCESS |
| Camel :: YAML DSL | 14.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 14.2s | SUCCESS |
| Camel :: Docs | 12.3s | SUCCESS |
| Camel :: Kamelet Main | 9.1s | SUCCESS |
| Camel :: SPIFFE | 8.6s | SUCCESS |
| Camel :: Catalog :: Camel Route Parser | 6.3s | SUCCESS |
| Camel :: YAML DSL :: Deserializers | 6.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 6.1s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 5.0s | SUCCESS |
| Camel :: Catalog :: Camel Report Maven Plugin | 4.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 4.5s | SUCCESS |
| Camel :: All Components Sync point | 4.3s | SUCCESS |
| Camel :: Catalog :: Maven | 2.6s | SUCCESS |
| Camel :: YAML DSL :: Maven Plugins | 2.3s | SUCCESS |
| Camel :: Catalog :: Suggest (deprecated) | 2.1s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.3s | SUCCESS |
| Camel :: Assembly | 1.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.1s | SUCCESS |
| Camel :: Catalog :: Dummy Component | 1.0s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 0.9s | SUCCESS |
| Camel :: Coverage | 0.8s | SUCCESS |
| Camel :: Catalog :: Console | 0.7s | SUCCESS |
| Camel :: Launcher :: Container | 0.6s | SUCCESS |
| Camel :: JBang :: Main | 0.6s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 0.5s | SUCCESS |
| Camel :: Endpoint DSL :: Support | 0.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.4s | SUCCESS |
| Camel :: Endpoint DSL | n/a | |
| Camel :: Integration Tests | n/a | |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: JBang :: Plugin :: TUI` (36.8s)
- `Camel :: Launcher` (33.4s)
- `Camel :: JBang :: MCP` (29.5s)
- `Camel :: Catalog :: Camel Catalog` (18.4s)
- `Camel :: Component DSL` (18.0s)
- `Camel :: YAML DSL :: Validator` (15.2s)
- `Camel :: YAML DSL` (14.3s)
- `Camel :: JBang :: Plugin :: Kubernetes` (14.2s)
- `Camel :: Docs` (12.3s)
- `Camel :: Kamelet Main` (9.1s)
- `Camel :: SPIFFE` (8.6s)
- `Camel :: Catalog :: Camel Route Parser` (6.3s)
- `Camel :: YAML DSL :: Deserializers` (6.3s)
- `Camel :: JBang :: Plugin :: Testing` (6.1s)
- `Camel :: YAML DSL :: Validator Maven Plugin` (5.0s)
- `Camel :: Catalog :: Camel Report Maven Plugin` (4.8s)
- `Camel :: JBang :: Plugin :: Validate` (4.5s)
- `Camel :: All Components Sync point` (4.3s)
- `Camel :: Catalog :: Maven` (2.6s)
- `Camel :: YAML DSL :: Maven Plugins` (2.3s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/37433081024)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27419:
URL: https://github.com/apache/camel/pull/27419#discussion_r4192828453
##########
components/camel-spiffe/src/main/docs/spiffe-component.adoc:
##########
@@ -155,6 +155,14 @@ verified SPIFFE ID:
[source,java]
------------------------------------------------------------
+// the server must REQUIRE a client certificate, or the policy has no verified peer to authorize
+SpiffeSSLContextParameters serverSsl = new SpiffeSSLContextParameters();
+serverSsl.setAcceptedSpiffeIds("spiffe://example.org/frontend");
Review Comment:
Optional: worth one sentence that this TLS-level allow-list must contain every ID that any route's `SpiffeSecurityPolicy` accepts, otherwise the handshake rejects the peer before the policy runs. That matters when several routes with different policies share one server.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-25369: camel-spiffe - fix the SpiffeSecurityPolicy doc example, and add the negative tests [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #27419:
URL: https://github.com/apache/camel/pull/27419#discussion_r4192894060
##########
components/camel-spiffe/src/main/docs/spiffe-component.adoc:
##########
@@ -155,6 +155,14 @@ verified SPIFFE ID:
[source,java]
------------------------------------------------------------
+// the server must REQUIRE a client certificate, or the policy has no verified peer to authorize
+SpiffeSSLContextParameters serverSsl = new SpiffeSSLContextParameters();
+serverSsl.setAcceptedSpiffeIds("spiffe://example.org/frontend");
Review Comment:
Good point — added in 34fc600 as a third bullet in the server-side IMPORTANT block: `SpiffeSSLContextParameters.acceptedSpiffeIds` gates the handshake before any route's policy runs, so when several routes with different `SpiffeSecurityPolicy` allow-lists share one server the TLS-level list must contain every ID those policies accept (or use `acceptAnySpiffeId` and let each policy narrow it), otherwise a peer is turned away before its route could have authorized it.
_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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org