Repository navigation
CAMEL-26916: camel-yaml-dsl-validator - an insecure opt-in that can be set on the component keeps its default when reading the body - #29808
Conversation
…pects a pulsar finding Since #29753 the pulsar producer body depends on allowJavaSerializedObject, an option that may also be set on the component. The validator then does not know the body a route sends to pulsar, and says nothing, as it does for spring-rabbitmq. The test still expected the "to: pulsar needs the body as text" finding, and failed on every PR whose build runs camel-yaml-dsl-validator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…e set on the component keeps its default when reading the body A body type that depends on an option the route does not set, but that can be set on the component, is not known. For the insecure opt-ins (security insecure:ssl, insecure:serialization or insecure:dev) that meant the validator went quiet: pulsar since CAMEL-26012 (allowJavaSerializedObject), and the transferExchange, objectMessageEnabled and allowOperationHeader of jms, activemq, amqp, sjms, mina, netty, keycloak and spiffe. Such an option is off unless turned on, and one turned on for the whole component is reported by the security policy at startup, so it now keeps its default when the route does not set it. TextBodyFlowTest expects the pulsar finding again, and a route that turns allowJavaSerializedObject on itself says nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
gnodet-bot
left a comment
There was a problem hiding this comment.
LGTM. No issues found.
The isInsecure() helper correctly uses startsWith("insecure:"), which matches exactly the three insecure security categories enforced by BaseOptionModel.VALID_SECURITY_CATEGORIES (insecure:ssl, insecure:serialization, insecure:dev). The null guard on getSecurity() is in place. Test size changes (hasSize(3)→4) are correct — pulsar's body type finding is properly reinstated. The new testTheBodyOfAnInsecureOptIn() correctly covers both the default-off (finding produced) and explicitly-enabled (no finding) cases.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 602 of 722 tested, 26 compile-only — current: 74 all testedMaveniverse Scalpel detected 602 affected modules (current approach: 74). Skip-tests mode would test 602 modules (3 direct + 600 downstream), skip tests for 26 (generated code, meta-modules)
|
| Module | Duration | Status |
|---|---|---|
| Camel :: YAML DSL :: Validator | 35.2s | SUCCESS |
| Camel :: Docs | 26.1s | SUCCESS |
| Camel :: Tooling :: Model | 6.5s | SUCCESS |
Top 20 slowest modules:
Camel :: YAML DSL :: Validator(35.2s)Camel :: Docs(26.1s)Camel :: Tooling :: Model(6.5s)
oscerd
left a comment
There was a problem hiding this comment.
Reviewed the incremental change on top of #29807, and this is the principled version of what #29807 had to stub.
The validator's rule is that a body type depending on an option the step does not set, but that could be set on the component, is not knowable, so it stays quiet. The insight here is that an insecure opt-in is not one of those: allowJavaSerializedObject, transferExchange, objectMessageEnabled and the rest keep their safe default unless the route turns them on, and one turned on for the whole component is already surfaced by the security policy at startup, so the validator should reason from the default rather than go silent. That restores the pulsar finding #29807 dropped, and does it for the right reason.
What makes it clean is that isInsecure keys on the metadata rather than a hardcoded list: option.getSecurity().startsWith("insecure:") picks up every option marked insecure:ssl, insecure:serialization or insecure:dev, so pulsar, jms, activemq, amqp, sjms, mina, netty and anything marked the same way in future are covered without a maintenance list. That is the same security marker the components already carry, used for exactly the distinction it encodes.
testTheBodyOfAnInsecureOptIn pins the pulsar case (default off, parsed data must be marshalled). The body-types doc is updated to explain the rule. Reads correct; it retargets to main once #29807 lands. Deferring the sign-off to the committers.
Claude Code on behalf of oscerd
Description
CAMEL-26916. Stacked on #29807 (retarget to
mainonce that is merged); this PR brings back the pulsar finding #29807 had to drop.The YAML validator treats a body type that depends on an option the route does not set, but that can be set on the component, as not known, and says nothing. For the insecure opt-ins that made it go quiet where it should not:
producerIndepends onallowJavaSerializedObjecttransferExchange,objectMessageEnabledobjectMessageEnabledtransferExchange,objectCodecPattern; netty:transferExchangeallowOperationHeaderAn option with
securityinsecure:ssl,insecure:serializationorinsecure:devis off unless turned on, and one turned on for the whole component is reported by the security policy at startup (camel.security.insecureSerializationPolicy, theprodprofile). SoCatalogBodyTypesno longer counts such a component option as "can be set elsewhere": it keeps its default unless the route sets it.Keeping these options on the component, rather than making them endpoint-only, is deliberate: the startup policy checks the configured properties (
camel.component.<name>.<option>), not endpoint URIs.Changes
CatalogBodyTypes.componentSide(): insecure component options are not in the set of options that may be set elsewhere.BodyTypeResolver: thehiddenparameter documents it.body-types.adoc(Reading a side for a step): the rule says so.TextBodyFlowTest:testTheBodyOfMessagingexpects the pulsar finding again (as on main before CAMEL-26012: camel-yaml-dsl-validator - TextBodyFlowTest no longer expects a pulsar finding #29807); newtestTheBodyOfAnInsecureOptIn: a route that leavesallowJavaSerializedObjectalone is reported, one that turns it on is not.Testing
camel-yaml-dsl-validator: 369 tests, all pass (run against a catalog with the current component JSON).CatalogBodyTypeschange,testTheBodyOfMessagingfails as on CI (expected 4, was 3), and so does the new test.Claude Code on behalf of davsclaus
🤖 Generated with Claude Code