From bb8100a3cdb76f9b0498f449ad9afc4741cd00d6 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 20 May 2026 12:58:56 +0200 Subject: [PATCH] CAMEL-23522: camel-mail - gate JavaMail session properties from headers behind opt-in (#23362) MailProducer.getSender extracted mail.smtp.* / mail.smtps. exchange headers and applied them as JavaMail session properties on a per-message custom sender. The namespace is Camel-internal (only MailProducer interprets it) and is not filtered by any HeaderFilterStrategy, so a route chaining an untrusted producer (platform-http, JMS, Kafka, ...) into smtp/smtps without an explicit removeHeaders between them let an attacker drive transport-security settings (mail.smtp.ssl.trust, mail.smtp.starttls.enable, mail.smtp.socks.host, ...). This is the same conceptual pattern as the Camel* header injection family (CAMEL-23222 / CVE-2025-27636), with a namespace that was missed in that sweep. Changes: * New @UriParam useJavaMailSessionPropertiesFromHeaders (default false, label producer,advanced,security, security=insecure:ssl) on MailConfiguration. When false, MailProducer.getSender always returns the default sender. * MailHeaderFilterStrategy now also filters mail.smtp. / mail.smtps. on the inbound path (defense in depth, mirroring CAMEL-23222). * Doc note in mail-component.adoc with the security warning and the opt-in URI. * Upgrade-guide entry in camel-4x-upgrade-guide-4_21.adoc. * Tests for both flag values and for the header-filter strategy behaviour. The build's SECURITY-OPTIONS generator picked up the new annotation and added the property to the policy-enforceable map in core/camel-util SecurityUtils. Signed-off-by: Andrea Cosentino --- .../apache/camel/catalog/components/imap.json | 8 +- .../camel/catalog/components/imaps.json | 8 +- .../apache/camel/catalog/components/pop3.json | 8 +- .../camel/catalog/components/pop3s.json | 8 +- .../apache/camel/catalog/components/smtp.json | 8 +- .../camel/catalog/components/smtps.json | 8 +- .../mail/MailComponentConfigurer.java | 6 ++ .../mail/MailEndpointConfigurer.java | 6 ++ .../mail/MailEndpointUriFactory.java | 3 +- .../org/apache/camel/component/mail/imap.json | 8 +- .../apache/camel/component/mail/imaps.json | 8 +- .../org/apache/camel/component/mail/pop3.json | 8 +- .../apache/camel/component/mail/pop3s.json | 8 +- .../org/apache/camel/component/mail/smtp.json | 8 +- .../apache/camel/component/mail/smtps.json | 8 +- .../src/main/docs/mail-component.adoc | 20 +++-- .../component/mail/MailConfiguration.java | 19 ++++ .../mail/MailHeaderFilterStrategy.java | 9 +- .../camel/component/mail/MailProducer.java | 8 ++ .../mail/MailHeaderFilterStrategyTest.java | 62 +++++++++++++ .../MailSessionPropertiesFromHeadersTest.java | 87 +++++++++++++++++++ .../pages/camel-4x-upgrade-guide-4_18.adoc | 23 +++++ .../dsl/ImapComponentBuilderFactory.java | 26 ++++++ .../dsl/ImapsComponentBuilderFactory.java | 26 ++++++ .../dsl/Pop3ComponentBuilderFactory.java | 26 ++++++ .../dsl/Pop3sComponentBuilderFactory.java | 26 ++++++ .../dsl/SmtpComponentBuilderFactory.java | 26 ++++++ .../dsl/SmtpsComponentBuilderFactory.java | 26 ++++++ .../dsl/MailEndpointBuilderFactory.java | 46 ++++++++++ 29 files changed, 498 insertions(+), 43 deletions(-) create mode 100644 components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderFilterStrategyTest.java create mode 100644 components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSessionPropertiesFromHeadersTest.java diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imap.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imap.json index fedadf6a3febe..c932db355fca0 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imap.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imap.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imaps.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imaps.json index fb69665326a17..b0f980fa1d153 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imaps.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/imaps.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3.json index c4c7ff5a43cec..412b14b394643 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3s.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3s.json index 3294112e212ea..3e0f5e59cd378 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3s.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pop3s.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtp.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtp.json index 56a2cc35d4f9f..8cb59f2d6647e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtp.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtp.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtps.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtps.json index 74c4ec7a05dff..0c6c27052a70d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtps.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/smtps.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailComponentConfigurer.java b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailComponentConfigurer.java index c0169ddd0f5b1..17e3bfca899f8 100644 --- a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailComponentConfigurer.java +++ b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailComponentConfigurer.java @@ -111,6 +111,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "useGlobalSslContextParameters": target.setUseGlobalSslContextParameters(property(camelContext, boolean.class, value)); return true; case "useinlineattachments": case "useInlineAttachments": getOrCreateConfiguration(target).setUseInlineAttachments(property(camelContext, boolean.class, value)); return true; + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration(target).setUseJavaMailSessionPropertiesFromHeaders(property(camelContext, boolean.class, value)); return true; case "username": getOrCreateConfiguration(target).setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -200,6 +202,8 @@ public Class getOptionType(String name, boolean ignoreCase) { case "useGlobalSslContextParameters": return boolean.class; case "useinlineattachments": case "useInlineAttachments": return boolean.class; + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": return boolean.class; case "username": return java.lang.String.class; default: return null; } @@ -290,6 +294,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "useGlobalSslContextParameters": return target.isUseGlobalSslContextParameters(); case "useinlineattachments": case "useInlineAttachments": return getOrCreateConfiguration(target).isUseInlineAttachments(); + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": return getOrCreateConfiguration(target).isUseJavaMailSessionPropertiesFromHeaders(); case "username": return getOrCreateConfiguration(target).getUsername(); default: return null; } diff --git a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointConfigurer.java b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointConfigurer.java index a2ca579356e3e..d2724a50ee0d4 100644 --- a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointConfigurer.java +++ b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointConfigurer.java @@ -143,6 +143,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true; case "useinlineattachments": case "useInlineAttachments": target.getConfiguration().setUseInlineAttachments(property(camelContext, boolean.class, value)); return true; + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": target.getConfiguration().setUseJavaMailSessionPropertiesFromHeaders(property(camelContext, boolean.class, value)); return true; case "username": target.getConfiguration().setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -271,6 +273,8 @@ public Class getOptionType(String name, boolean ignoreCase) { case "useFixedDelay": return boolean.class; case "useinlineattachments": case "useInlineAttachments": return boolean.class; + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": return boolean.class; case "username": return java.lang.String.class; default: return null; } @@ -400,6 +404,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "useFixedDelay": return target.isUseFixedDelay(); case "useinlineattachments": case "useInlineAttachments": return target.getConfiguration().isUseInlineAttachments(); + case "usejavamailsessionpropertiesfromheaders": + case "useJavaMailSessionPropertiesFromHeaders": return target.getConfiguration().isUseJavaMailSessionPropertiesFromHeaders(); case "username": return target.getConfiguration().getUsername(); default: return null; } diff --git a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointUriFactory.java b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointUriFactory.java index dbf7936aecf03..13bcb19da28be 100644 --- a/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointUriFactory.java +++ b/components/camel-mail/src/generated/java/org/apache/camel/component/mail/MailEndpointUriFactory.java @@ -24,7 +24,7 @@ public class MailEndpointUriFactory extends org.apache.camel.support.component.E private static final Set SECRET_PROPERTY_NAMES; private static final Map MULTI_VALUE_PREFIXES; static { - Set props = new HashSet<>(71); + Set props = new HashSet<>(72); props.add("additionalJavaMailProperties"); props.add("alternativeBodyHeader"); props.add("attachmentsContentTransferEncodingResolver"); @@ -95,6 +95,7 @@ public class MailEndpointUriFactory extends org.apache.camel.support.component.E props.add("unseen"); props.add("useFixedDelay"); props.add("useInlineAttachments"); + props.add("useJavaMailSessionPropertiesFromHeaders"); props.add("username"); PROPERTY_NAMES = Collections.unmodifiableSet(props); Set secretProps = new HashSet<>(2); diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imap.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imap.json index fedadf6a3febe..c932db355fca0 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imap.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imap.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imaps.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imaps.json index fb69665326a17..b0f980fa1d153 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imaps.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/imaps.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3.json index c4c7ff5a43cec..412b14b394643 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3s.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3s.json index 3294112e212ea..3e0f5e59cd378 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3s.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/pop3s.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtp.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtp.json index 56a2cc35d4f9f..8cb59f2d6647e 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtp.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtp.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtps.json b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtps.json index 74c4ec7a05dff..0c6c27052a70d 100644 --- a/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtps.json +++ b/components/camel-mail/src/generated/resources/META-INF/org/apache/camel/component/mail/smtps.json @@ -73,7 +73,8 @@ "password": { "index": 44, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 45, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, "useGlobalSslContextParameters": { "index": 46, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "username": { "index": 47, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 47, "kind": "property", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 48, "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." } }, "headers": { "Subject": { "index": 0, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Subject", "constantName": "org.apache.camel.component.mail.MailConstants#MAIL_SUBJECT" }, @@ -158,7 +159,8 @@ "useFixedDelay": { "index": 66, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, "password": { "index": 67, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The password for login. See also setAuthenticator(MailAuthenticator)." }, "sslContextParameters": { "index": 68, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters." }, - "username": { "index": 69, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, - "sortTerm": { "index": 70, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } + "useJavaMailSessionPropertiesFromHeaders": { "index": 69, "kind": "parameter", "displayName": "Use Java Mail Session Properties From Headers", "group": "security", "label": "producer,advanced,security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. or mail.smtps.) to override the endpoint configuration on a per-message basis. This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, never from data crossing a trust boundary (for example HTTP query parameters, or JMS\/Kafka messages from untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection." }, + "username": { "index": 70, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.mail.MailConfiguration", "configurationField": "configuration", "description": "The username for login. See also setAuthenticator(MailAuthenticator)." }, + "sortTerm": { "index": 71, "kind": "parameter", "displayName": "Sort Term", "group": "sort", "label": "consumer,sort", "required": false, "type": "object", "javaType": "org.eclipse.angus.mail.imap.SortTerm[]", "deprecated": false, "autowired": false, "secret": false, "description": "Sorting order for messages. Only natively supported for IMAP. Emulated to some degree when using POP3 or when IMAP server does not have the SORT capability." } } } diff --git a/components/camel-mail/src/main/docs/mail-component.adoc b/components/camel-mail/src/main/docs/mail-component.adoc index 4079363e56aee..3616aaaee5dfc 100644 --- a/components/camel-mail/src/main/docs/mail-component.adoc +++ b/components/camel-mail/src/main/docs/mail-component.adoc @@ -575,20 +575,30 @@ SearchTerm term = builder.build(); === Using headers with additional Java Mail Sender properties When sending mails, then you can provide dynamic java mail properties for the `JavaMailSender` from -the Exchange as message headers with keys starting with `java.smtp.`. +the Exchange as message headers with keys starting with `mail.smtp.` (or `mail.smtps.`). -You can set any of the `java.smtp` properties which you can find in the Java Mail documentation. +You can set any of the `mail.smtp` properties which you can find in the Java Mail documentation. -For example, to provide a dynamic uuid in `java.smtp.from` (SMTP MAIL command): +For example, to provide a dynamic uuid in `mail.smtp.from` (SMTP MAIL command): [source,java] ---- .setHeader("from", constant("reply2me@foo.com")); - .setHeader("java.smtp.from", method(UUID.class, "randomUUID")); - .to("smtp://mymailserver:1234"); + .setHeader("mail.smtp.from", method(UUID.class, "randomUUID")); + .to("smtp://mymailserver:1234?useJavaMailSessionPropertiesFromHeaders=true"); ---- NOTE: This is only supported when *not* using a custom `JavaMailSender`. +WARNING: This feature is *disabled by default* and must be explicitly enabled with +`useJavaMailSessionPropertiesFromHeaders=true`. The `mail.smtp.*` / `mail.smtps.*` keys are a +Camel-internal namespace that is not filtered by any `HeaderFilterStrategy`, so if these headers can +originate from data crossing a trust boundary (for example HTTP query parameters, or JMS/Kafka +messages from untrusted producers) an attacker could weaken transport security (such as +`mail.smtp.ssl.trust` or `mail.smtp.starttls.enable`) or redirect the SMTP connection. Only enable +the option when these headers are set exclusively by trusted route logic, and strip the namespace +with `removeHeaders("mail.smtp.*", "mail.smtps.*")` before the producer when bridging an untrusted +source. + include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java index 1036ea4c9009f..bb5410fc541fa 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java @@ -112,6 +112,8 @@ public class MailConfiguration implements Cloneable { private boolean useInlineAttachments; @UriParam(label = "advanced") private boolean ignoreUnsupportedCharset; + @UriParam(label = "producer,advanced,security") + private boolean useJavaMailSessionPropertiesFromHeaders; @UriParam @Metadata(label = "consumer") private boolean disconnect; @@ -692,6 +694,23 @@ public void setUseInlineAttachments(boolean useInlineAttachments) { this.useInlineAttachments = useInlineAttachments; } + public boolean isUseJavaMailSessionPropertiesFromHeaders() { + return useJavaMailSessionPropertiesFromHeaders; + } + + /** + * Whether to allow dynamic JavaMail session properties (message headers whose key starts with mail.smtp. + * or mail.smtps.) to override the endpoint configuration on a per-message basis. + * + * This is disabled by default. Only enable it when these headers originate exclusively from trusted route logic, + * never from data crossing a trust boundary (for example HTTP query parameters, or JMS/Kafka messages from + * untrusted producers). When enabled, an attacker able to set these headers could weaken transport security (such + * as mail.smtp.ssl.trust or mail.smtp.starttls.enable) or redirect the SMTP connection. + */ + public void setUseJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + this.useJavaMailSessionPropertiesFromHeaders = useJavaMailSessionPropertiesFromHeaders; + } + public boolean isIgnoreUnsupportedCharset() { return ignoreUnsupportedCharset; } diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailHeaderFilterStrategy.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailHeaderFilterStrategy.java index 659cdcfbb0391..c92548a6ac5e4 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailHeaderFilterStrategy.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailHeaderFilterStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.mail; +import java.util.Arrays; + import org.apache.camel.support.DefaultHeaderFilterStrategy; public class MailHeaderFilterStrategy extends DefaultHeaderFilterStrategy { @@ -28,7 +30,12 @@ protected void initialize() { setLowerCase(true); // filter headers begin with "Camel" or "org.apache.camel" setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH); - setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH); + // on the inbound path also filter the Camel-internal mail.smtp.* / mail.smtps.* namespace so an + // external mail message cannot inject JavaMail session properties (CAMEL-23522) + String[] inFilter = Arrays.copyOf(CAMEL_FILTER_STARTS_WITH, CAMEL_FILTER_STARTS_WITH.length + 2); + inFilter[CAMEL_FILTER_STARTS_WITH.length] = "mail.smtp."; + inFilter[CAMEL_FILTER_STARTS_WITH.length + 1] = "mail.smtps."; + setInFilterStartsWith(inFilter); } } diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailProducer.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailProducer.java index f0557eb6a5437..bd14f220ee05c 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailProducer.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailProducer.java @@ -87,6 +87,14 @@ public MailEndpoint getEndpoint() { } protected JavaMailSender getSender(Exchange exchange) { + // dynamic JavaMail session properties from message headers is an opt-in feature; it is disabled by + // default because mail.smtp.* / mail.smtps.* is a Camel-internal namespace that is not filtered by + // any HeaderFilterStrategy, so an untrusted producer could otherwise weaken transport security or + // redirect the SMTP connection (CAMEL-23522) + if (!getEndpoint().getConfiguration().isUseJavaMailSessionPropertiesFromHeaders()) { + LOG.trace("Using default JavaMailSender (useJavaMailSessionPropertiesFromHeaders=false)"); + return defaultSender; + } // do we have special headers (try both smtp and smtps) String prefix = "mail.smtp."; Map additional = URISupport.extractProperties(exchange.getMessage().getHeaders(), prefix); diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderFilterStrategyTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderFilterStrategyTest.java new file mode 100644 index 0000000000000..10670a6afd489 --- /dev/null +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderFilterStrategyTest.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.mail; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Verifies that {@link MailHeaderFilterStrategy} blocks the Camel-internal {@code mail.smtp.*} / {@code mail.smtps.*} + * namespace on the inbound path (CAMEL-23522) while still letting ordinary mail headers through, and that the existing + * {@code Camel*} filtering (CAMEL-23222) is preserved. + */ +public class MailHeaderFilterStrategyTest { + + private final MailHeaderFilterStrategy strategy = new MailHeaderFilterStrategy(); + + @Test + public void testInboundFiltersSmtpPropertyNamespace() { + assertTrue(strategy.applyFilterToExternalHeaders("mail.smtp.host", "evil", null)); + assertTrue(strategy.applyFilterToExternalHeaders("mail.smtp.ssl.trust", "*", null)); + assertTrue(strategy.applyFilterToExternalHeaders("mail.smtps.host", "evil", null)); + // case-insensitive + assertTrue(strategy.applyFilterToExternalHeaders("MAIL.SMTP.STARTTLS.ENABLE", "false", null)); + } + + @Test + public void testInboundStillFiltersCamelHeaders() { + assertTrue(strategy.applyFilterToExternalHeaders("CamelFileName", "x", null)); + assertTrue(strategy.applyFilterToExternalHeaders("camelfilename", "x", null)); + } + + @Test + public void testInboundLetsOrdinaryMailHeadersThrough() { + assertFalse(strategy.applyFilterToExternalHeaders("Subject", "Hello", null)); + assertFalse(strategy.applyFilterToExternalHeaders("To", "user@host.com", null)); + // a header that merely contains, but does not start with, the namespace must pass + assertFalse(strategy.applyFilterToExternalHeaders("X-mail.smtp.host", "x", null)); + } + + @Test + public void testOutboundIsUnaffectedBySmtpNamespaceFilter() { + // the inbound-only filter must not change the outbound behaviour; only Camel* is filtered outbound + assertFalse(strategy.applyFilterToCamelHeaders("mail.smtp.host", "myhost", null)); + assertTrue(strategy.applyFilterToCamelHeaders("CamelFileName", "x", null)); + } +} diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSessionPropertiesFromHeadersTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSessionPropertiesFromHeadersTest.java new file mode 100644 index 0000000000000..ed90a306d3c6a --- /dev/null +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSessionPropertiesFromHeadersTest.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.mail; + +import org.apache.camel.Exchange; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; + +/** + * Verifies that dynamic JavaMail session properties provided as {@code mail.smtp.*} / {@code mail.smtps.*} message + * headers only override the endpoint configuration when explicitly opted-in via + * {@code useJavaMailSessionPropertiesFromHeaders=true} (CAMEL-23522). + */ +public class MailSessionPropertiesFromHeadersTest extends CamelTestSupport { + + private MailProducer producer(String uri) throws Exception { + MailEndpoint endpoint = context.getEndpoint(uri, MailEndpoint.class); + return (MailProducer) endpoint.createProducer(); + } + + private Exchange withSmtpHostHeader(MailProducer producer, String header) { + Exchange exchange = producer.getEndpoint().createExchange(); + exchange.getMessage().setHeader(header, "attacker-smtp.example.com"); + return exchange; + } + + @Test + public void testHeadersIgnoredByDefault() throws Exception { + MailProducer producer = producer("smtp://user@myhost:25?password=secret"); + + // no special headers -> default sender + Exchange plain = producer.getEndpoint().createExchange(); + JavaMailSender defaultSender = producer.getSender(plain); + + // mail.smtp.* header present, but feature is disabled by default -> still the default sender + JavaMailSender withSmtp = producer.getSender(withSmtpHostHeader(producer, "mail.smtp.host")); + assertSame(defaultSender, withSmtp, "mail.smtp.* header must be ignored when feature is disabled (default)"); + + JavaMailSender withSmtps = producer.getSender(withSmtpHostHeader(producer, "mail.smtps.host")); + assertSame(defaultSender, withSmtps, "mail.smtps.* header must be ignored when feature is disabled (default)"); + } + + @Test + public void testHeadersHonouredWhenOptedIn() throws Exception { + MailProducer producer + = producer("smtp://user@myhost:25?password=secret&useJavaMailSessionPropertiesFromHeaders=true"); + + Exchange plain = producer.getEndpoint().createExchange(); + JavaMailSender defaultSender = producer.getSender(plain); + + // with the opt-in enabled, a mail.smtp.* header creates a per-message custom sender + JavaMailSender withSmtp = producer.getSender(withSmtpHostHeader(producer, "mail.smtp.host")); + assertNotSame(defaultSender, withSmtp, "mail.smtp.* header must create a custom sender when opted-in"); + + // and the same applies to the mail.smtps.* fallback prefix + JavaMailSender withSmtps = producer.getSender(withSmtpHostHeader(producer, "mail.smtps.host")); + assertNotSame(defaultSender, withSmtps, "mail.smtps.* header must create a custom sender when opted-in"); + } + + @Test + public void testNoHeadersAlwaysUsesDefaultSenderWhenOptedIn() throws Exception { + MailProducer producer + = producer("smtp://user@myhost:25?password=secret&useJavaMailSessionPropertiesFromHeaders=true"); + + Exchange a = producer.getEndpoint().createExchange(); + Exchange b = producer.getEndpoint().createExchange(); + // no mail.smtp.* headers at all -> default sender even when the feature is enabled + assertSame(producer.getSender(a), producer.getSender(b)); + } +} diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc index 3ceaf1fdbf179..8314c1fc7ae9d 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_18.adoc @@ -115,6 +115,29 @@ this pattern now fails fast with an `IllegalArgumentException` (wrapped in a `Neo4jOperationException`) instead of producing a malformed query. Property values continue to be passed as bound query parameters and are unaffected. +=== camel-mail + +The SMTP producer no longer extracts dynamic JavaMail session properties from message headers by +default. Previously any message header whose key started with `mail.smtp.` (or `mail.smtps.`) was +applied to a per-message `JavaMailSender`, which meant an upstream producer that mapped untrusted +input into the exchange header map (for example `platform-http` query parameters, JMS or Kafka +messages from untrusted producers) could override transport-security settings such as +`mail.smtp.ssl.trust` or `mail.smtp.starttls.enable`, or redirect the SMTP connection. + +This behaviour is now disabled by default. Routes that legitimately rely on per-message +`mail.smtp.*` / `mail.smtps.*` headers must opt back in on the endpoint: + +[source,java] +---- +.to("smtp://mymailserver:1234?useJavaMailSessionPropertiesFromHeaders=true"); +---- + +Even with the opt-in, route authors should still strip the namespace with +`removeHeaders("mail.smtp.*", "mail.smtps.*")` between any untrusted ingress and the mail producer. + +In addition, the inbound `MailHeaderFilterStrategy` now blocks the `mail.smtp.` / `mail.smtps.` +prefix as well, so an external mail message can no longer inject these into a downstream exchange. + == Upgrading from 4.18.1 to 4.18.2 === camel-platform-http-main diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapComponentBuilderFactory.java index 1f702e75f067b..47da0a73892af 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapComponentBuilderFactory.java @@ -926,6 +926,31 @@ default ImapComponentBuilder useGlobalSslContextParameters(boolean useGlobalSslC return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default ImapComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapsComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapsComponentBuilderFactory.java index b1a81c5651554..62d5b5db5ef8f 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapsComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ImapsComponentBuilderFactory.java @@ -926,6 +926,31 @@ default ImapsComponentBuilder useGlobalSslContextParameters(boolean useGlobalSsl return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default ImapsComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3ComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3ComponentBuilderFactory.java index c9420410c98df..fda38f6de97d0 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3ComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3ComponentBuilderFactory.java @@ -926,6 +926,31 @@ default Pop3ComponentBuilder useGlobalSslContextParameters(boolean useGlobalSslC return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default Pop3ComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3sComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3sComponentBuilderFactory.java index 9ecd5e2517634..1953923c60367 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3sComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Pop3sComponentBuilderFactory.java @@ -926,6 +926,31 @@ default Pop3sComponentBuilder useGlobalSslContextParameters(boolean useGlobalSsl return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default Pop3sComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpComponentBuilderFactory.java index d70368d7cb8bf..a2d5f1efa29a7 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpComponentBuilderFactory.java @@ -926,6 +926,31 @@ default SmtpComponentBuilder useGlobalSslContextParameters(boolean useGlobalSslC return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default SmtpComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpsComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpsComponentBuilderFactory.java index 5d21961ac0485..ffd4748932fe1 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpsComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmtpsComponentBuilderFactory.java @@ -926,6 +926,31 @@ default SmtpsComponentBuilder useGlobalSslContextParameters(boolean useGlobalSsl return this; } + + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default SmtpsComponentBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** * The username for login. See also setAuthenticator(MailAuthenticator). * @@ -1008,6 +1033,7 @@ protected boolean setPropertyOnComponent( case "password": getOrCreateConfiguration((MailComponent) component).setPassword((java.lang.String) value); return true; case "sslContextParameters": getOrCreateConfiguration((MailComponent) component).setSslContextParameters((org.apache.camel.support.jsse.SSLContextParameters) value); return true; case "useGlobalSslContextParameters": ((MailComponent) component).setUseGlobalSslContextParameters((boolean) value); return true; + case "useJavaMailSessionPropertiesFromHeaders": getOrCreateConfiguration((MailComponent) component).setUseJavaMailSessionPropertiesFromHeaders((boolean) value); return true; case "username": getOrCreateConfiguration((MailComponent) component).setUsername((java.lang.String) value); return true; default: return false; } diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MailEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MailEndpointBuilderFactory.java index 1ce3be3e8f3fc..015596795d084 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MailEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MailEndpointBuilderFactory.java @@ -2718,6 +2718,52 @@ default AdvancedMailEndpointProducerBuilder useInlineAttachments(String useInlin doSetProperty("useInlineAttachments", useInlineAttachments); return this; } + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option is a: boolean type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default AdvancedMailEndpointProducerBuilder useJavaMailSessionPropertiesFromHeaders(boolean useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } + /** + * Whether to allow dynamic JavaMail session properties (message headers + * whose key starts with mail.smtp. or mail.smtps.) to override the + * endpoint configuration on a per-message basis. This is disabled by + * default. Only enable it when these headers originate exclusively from + * trusted route logic, never from data crossing a trust boundary (for + * example HTTP query parameters, or JMS/Kafka messages from untrusted + * producers). When enabled, an attacker able to set these headers could + * weaken transport security (such as mail.smtp.ssl.trust or + * mail.smtp.starttls.enable) or redirect the SMTP connection. + * + * The option will be converted to a boolean type. + * + * Default: false + * Group: security + * + * @param useJavaMailSessionPropertiesFromHeaders the value to set + * @return the dsl builder + */ + default AdvancedMailEndpointProducerBuilder useJavaMailSessionPropertiesFromHeaders(String useJavaMailSessionPropertiesFromHeaders) { + doSetProperty("useJavaMailSessionPropertiesFromHeaders", useJavaMailSessionPropertiesFromHeaders); + return this; + } } /**