You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/10/06 06:38:27 UTC

[PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

gnodet opened a new pull request, #27409:
URL: https://github.com/apache/camel/pull/27409

   ## What's Changed
   
   Fixes two bugs in `MainHelper.java` that together made `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*` environment variables non-functional since CAMEL-16345 (Camel 3.9).
   
   ### Bug 1 — Filter prefix mismatch (all env vars silently ignored)
   
   `BaseMainSupport.autoConfigurationFromProperties` called `MainHelper.filterEnvVariables` with lowercase dotted prefixes (`"camel.component."`, `"camel.dataformat."`, `"camel.language."`), but `filterEnvVariables` uppercases every env var key before comparing:
   
   ```java
   final String uk = k.toUpperCase(Locale.US);
   if (uk.startsWith(prefix))   // prefix is "camel.component." — never starts with 'C'
   ```
   
   So the filter always returned an empty map, and none of the `CAMEL_COMPONENT_*` / `CAMEL_DATAFORMAT_*` / `CAMEL_LANGUAGE_*` variables were ever picked up. **Fix**: pass uppercase underscore prefixes (`"CAMEL_COMPONENT_"`, `"CAMEL_DATAFORMAT_"`, `"CAMEL_LANGUAGE_"`) — matching what `filterEnvVariables` expects.
   
   ### Bug 2 — Non-deterministic name lookup for overlapping catalog names
   
   The name-resolution step (`addComponentEnvVariables` etc.) used `stream().filter(k::startsWith).findFirst()` on a `HashSet`. Catalog entries like `CAMEL_COMPONENT_NETTY` / `CAMEL_COMPONENT_NETTY_HTTP` or `CAMEL_LANGUAGE_JS` / `CAMEL_LANGUAGE_JSONPATH` are plain prefixes of one another, so whichever came first in the hash iteration order "won", mapping variables to the wrong component (e.g. `CAMEL_COMPONENT_NETTY_HTTP_MUTE_EXCEPTION` → `camel.component.netty.http-mute-exception`).
   
   **Fix**: a new private helper `longestMatch` filters by `k.startsWith(name + "_")` (exact boundary check) and picks the longest matching name with `max(Comparator.comparingInt(String::length))`, giving a deterministic and correct result regardless of iteration order.
   
   ### Affected pairs (non-exhaustive)
   
   | Kind | Shorter name | Longer name |
   |------|-------------|-------------|
   | component | `NETTY` | `NETTY_HTTP` |
   | component | `SJMS` | `SJMS2` |
   | component | `FILE` | `FILE_WATCH` |
   | component | `SQL` | `SQL_STORED` |
   | component | `REST` | `REST_OPENAPI`, `REST_API`, `REST_POSTMAN` |
   | component | `HTTP` | `HTTPS` |
   | component | `FTP` | `FTPS` |
   | component | `VERTX` | `VERTX_HTTP`, `VERTX_WEBSOCKET` |
   | component | `ACTIVEMQ` | `ACTIVEMQ6` |
   | language | `JS` | `JSONPATH` |
   | dataformat | `AVRO` | `AVROJACKSON` |
   
   ### Tests
   
   Three new tests added to `MainHelperTest`:
   - `testLongestMatchComponentEnvVariables` — NETTY_HTTP vs NETTY, SJMS2 vs SJMS, FILE_WATCH vs FILE
   - `testLongestMatchLanguageEnvVariables` — JSONPATH vs JS
   - `testLongestMatchDataFormatEnvVariables` — AVROJACKSON vs AVRO
   
   All 286 existing camel-main tests pass.
   
   ### Upgrade Note
   
   Since fix 1 makes variables that were previously silently ignored now take effect, a stray env var for a component not on the classpath or for an unknown option will now fail the startup (unless `autoConfigurationFailFast=false`). This is consistent with the documented behaviour of `autoConfigurationEnvironmentVariablesEnabled`.
   
   Fixes https://issues.apache.org/jira/browse/CAMEL-25352
   
   _This PR was prepared by a coding agent (Claude Sonnet 4.6) on behalf of gnodet._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27409:
URL: https://github.com/apache/camel/pull/27409#discussion_r4206459438


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3700,6 +3700,44 @@ When `camel.opentelemetry.*` properties are configured but OpenTelemetry is disa
 the `camel.opentelemetry2.*` or `camel.telemetryDev.*` properties are now used. Previously they were ignored whenever
 any `camel.opentelemetry.*` property was configured.
 
+=== camel-main - `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*`, `CAMEL_LANGUAGE_*` environment variables now take effect
+
+Two bugs in `camel-main`'s environment-variable processing were fixed and are now active.
+
+**Bug 1 — variables were silently ignored since Camel 3.9 (CAMEL-16345)**
+
+`filterEnvVariables` uppercases the variable names before comparing them against the supplied prefixes, so the prefixes
+themselves must be uppercase. Before this fix the code passed lowercase prefixes (`camel.component.`, etc.), causing
+every match to fail silently. This has been corrected: `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*`
+variables are now actually read.
+
+If your deployments intentionally set such variables but relied on them being ignored (for example to pass secrets that
+should not reach the component), use
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false` to opt out, or remove the variables.
+
+Variables that refer to a name not present on the classpath (for example `CAMEL_COMPONENT_KAFKA_BROKERS` in an
+application that does not include camel-kafka) will fail the startup with an `IllegalArgumentException`. There is no
+per-variable opt-out: rename the variable, remove it, or set
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.
+
+Secrets passed as component environment variables (for example `CAMEL_COMPONENT_AWS2_S3_SECRET_KEY`) will be seen by
+the `prod`-profile security check as plain-text secrets and will fail the startup. Use a property-placeholder instead:
+`camel.component.aws2-s3.secret-key={{env:CAMEL_COMPONENT_AWS2_S3_SECRET_KEY}}` or configure the value through a
+vault.
+
+**Bug 2 — ambiguous name resolution**
+
+When the catalog contained component/dataformat/language pairs whose names were prefixes of each other (such as `netty`
+/ `netty-http`, `js` / `jsonpath`, `avro` / `avroJackson`), the variable was randomly mapped to either name.
+A longest-match strategy now always selects the most specific name.
+
+**Known limitation — `rest` / `rest-api`**
+
+`CAMEL_COMPONENT_REST_API_DOC=api.json` is matched to `camel.component.rest-api.doc` (the longer match), not to
+`camel.component.rest.apiDoc`. Use `CAMEL_COMPONENT_REST_APIDOC=api.json` instead (option names are matched
+case-insensitively), or configure the option directly:
+`camel.component.rest.apiDoc={{env:CAMEL_COMPONENT_REST_API_DOC}}`.
+

Review Comment:
   ⚠️ **Same self-defeating pattern**: `CAMEL_COMPONENT_REST_API_DOC` will be matched by `filterEnvVariables` via the longestMatch logic to `rest-api` + option `doc` (introduced in this PR), and bound literally to `camel.component.rest-api.doc`. The `{{env:CAMEL_COMPONENT_REST_API_DOC}}` placeholder in `camel.component.rest.apiDoc` runs *in addition to* (not instead of) that auto-binding — the env var is not suppressed.
   
   The `CAMEL_COMPONENT_REST_APIDOC=api.json` alternative mentioned above is actually sound for reaching `rest.apiDoc`, but the `{{env:...}}` form at the end should be removed or corrected.



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3700,6 +3700,44 @@ When `camel.opentelemetry.*` properties are configured but OpenTelemetry is disa
 the `camel.opentelemetry2.*` or `camel.telemetryDev.*` properties are now used. Previously they were ignored whenever
 any `camel.opentelemetry.*` property was configured.
 
+=== camel-main - `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*`, `CAMEL_LANGUAGE_*` environment variables now take effect
+
+Two bugs in `camel-main`'s environment-variable processing were fixed and are now active.
+
+**Bug 1 — variables were silently ignored since Camel 3.9 (CAMEL-16345)**
+
+`filterEnvVariables` uppercases the variable names before comparing them against the supplied prefixes, so the prefixes
+themselves must be uppercase. Before this fix the code passed lowercase prefixes (`camel.component.`, etc.), causing
+every match to fail silently. This has been corrected: `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*`
+variables are now actually read.
+
+If your deployments intentionally set such variables but relied on them being ignored (for example to pass secrets that
+should not reach the component), use
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false` to opt out, or remove the variables.
+
+Variables that refer to a name not present on the classpath (for example `CAMEL_COMPONENT_KAFKA_BROKERS` in an
+application that does not include camel-kafka) will fail the startup with an `IllegalArgumentException`. There is no
+per-variable opt-out: rename the variable, remove it, or set
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.
+
+Secrets passed as component environment variables (for example `CAMEL_COMPONENT_AWS2_S3_SECRET_KEY`) will be seen by
+the `prod`-profile security check as plain-text secrets and will fail the startup. Use a property-placeholder instead:
+`camel.component.aws2-s3.secret-key={{env:CAMEL_COMPONENT_AWS2_S3_SECRET_KEY}}` or configure the value through a
+vault.
+

Review Comment:
   ⚠️ **Self-defeating workaround**: `filterEnvVariables` (now using `CAMEL_COMPONENT_` prefix correctly after this fix) will also match `CAMEL_COMPONENT_AWS2_S3_SECRET_KEY` and bind its literal value directly. The `{{env:...}}` placeholder doesn't suppress the direct auto-binding — it only adds a *second* binding. The security concern this is trying to address is not resolved by this suggestion.
   
   Safer alternatives to document:
   - `camel.main.autoConfigurationEnvironmentVariablesEnabled=false` + vault
   - Rename the env var to avoid the `CAMEL_COMPONENT_` prefix entirely



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27409:
URL: https://github.com/apache/camel/pull/27409#discussion_r4192803200


##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -168,8 +169,7 @@ public void addComponentEnvVariables(Map<String, String> env, Properties propert
                 ck = ck.replaceFirst("-", ".");
                 properties.put(ck, v);

Review Comment:
   In custom mode this takes every key left in `env`, not just the `CAMEL_COMPONENT_` ones, so leftover `CAMEL_DATAFORMAT_*` / `CAMEL_LANGUAGE_*` variables become bogus component keys (`CAMEL_LANGUAGE_FOO_BAR` becomes `camel.component.oo.bar`, which fails the startup). Only take keys that start with `CAMEL_COMPONENT_` here, and likewise in the data format and language branches.



##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -212,8 +211,7 @@ public void addLanguageEnvVariables(Map<String, String> env, Properties properti
                 ck = ck.replaceFirst("-", ".");
                 properties.put(ck, v);
             } else {
-                Optional<String> e
-                        = languageEnvNames.stream().filter(k::startsWith).findFirst();
+                Optional<String> e = longestMatch(languageEnvNames, k);
                 if (e.isPresent()) {
                     toRemove.add(k);
                     String cname = "camel.language." + e.get().substring(15).toLowerCase(Locale.US).replace('_', '-');

Review Comment:
   `toLowerCase` loses the catalog spelling of camelCase names: `CAMEL_LANGUAGE_EXCHANGEPROPERTY_TRIM=false` fails the startup with *cannot find language with name exchangeproperty*, as the lookup on the classpath is case-sensitive. Same for the camelCase data formats above (`avroJackson`, `jacksonXml`, ...). Keeping a map from the env name to the catalog name would let this use the real name.



##########
core/camel-main/src/test/java/org/apache/camel/main/MainHelperTest.java:
##########
@@ -87,4 +87,68 @@ public void testAddCustomComponentEnvVariables() {
         Assertions.assertEquals("false", prop.getProperty("camel.component.foo.pretty-print"));
     }
 
+    /**
+     * Verifies that overlapping component names (e.g. NETTY vs NETTY_HTTP, SJMS vs SJMS2, FILE vs FILE_WATCH) are
+     * resolved by longest-match so that each variable is mapped to the correct component.
+     */
+    @Test
+    void testLongestMatchComponentEnvVariables() {
+        Map<String, String> env = MainHelper.filterEnvVariables(new String[] { "CAMEL_COMPONENT_" });
+        // netty-http must not be mapped to netty
+        env.put("CAMEL_COMPONENT_NETTY_HTTP_MUTE_EXCEPTION", "true");
+        // sjms2 must not be mapped to sjms
+        env.put("CAMEL_COMPONENT_SJMS2_RECOVERY_INTERVAL", "2000");
+        // file-watch must not be mapped to file
+        env.put("CAMEL_COMPONENT_FILE_WATCH_POLL_TIMEOUT", "5000");
+        // netty itself (no suffix clash)
+        env.put("CAMEL_COMPONENT_NETTY_RECEIVE_BUFFER_SIZE", "65536");
+
+        Properties prop = new OrderedProperties();
+        helper.addComponentEnvVariables(env, prop, false);
+
+        Assertions.assertEquals(0, env.size());
+        Assertions.assertEquals(4, prop.size());
+        Assertions.assertEquals("true", prop.getProperty("camel.component.netty-http.mute-exception"));
+        Assertions.assertEquals("2000", prop.getProperty("camel.component.sjms2.recovery-interval"));
+        Assertions.assertEquals("5000", prop.getProperty("camel.component.file-watch.poll-timeout"));
+        Assertions.assertEquals("65536", prop.getProperty("camel.component.netty.receive-buffer-size"));
+    }
+
+    /**
+     * Verifies that overlapping language names (e.g. JS vs JSONPATH) are resolved by longest-match.
+     */
+    @Test
+    void testLongestMatchLanguageEnvVariables() {
+        Map<String, String> env = MainHelper.filterEnvVariables(new String[] { "CAMEL_LANGUAGE_" });
+        // jsonpath must not be mapped to js
+        env.put("CAMEL_LANGUAGE_JSONPATH_SUPPRESS_EXCEPTIONS", "true");
+
+        Properties prop = new OrderedProperties();
+        helper.addLanguageEnvVariables(env, prop, false);
+
+        Assertions.assertEquals(0, env.size());
+        Assertions.assertEquals(1, prop.size());
+        Assertions.assertEquals("true", prop.getProperty("camel.language.jsonpath.suppress-exceptions"));
+    }
+
+    /**
+     * Verifies that overlapping dataformat names (e.g. AVRO vs AVROJACKSON) are resolved by longest-match.
+     */
+    @Test
+    void testLongestMatchDataFormatEnvVariables() {
+        Map<String, String> env = MainHelper.filterEnvVariables(new String[] { "CAMEL_DATAFORMAT_" });
+        // avrojackson must not be mapped to avro
+        env.put("CAMEL_DATAFORMAT_AVROJACKSON_PRETTY_PRINTER", "true");
+        // avro itself
+        env.put("CAMEL_DATAFORMAT_AVRO_SCHEMA_CLASS_NAME", "com.example.MySchema");
+
+        Properties prop = new OrderedProperties();
+        helper.addDataFormatEnvVariables(env, prop, false);
+
+        Assertions.assertEquals(0, env.size());
+        Assertions.assertEquals(2, prop.size());
+        Assertions.assertEquals("true", prop.getProperty("camel.dataformat.avrojackson.pretty-printer"));

Review Comment:
   This asserts the lowercased key, but `camel.dataformat.avrojackson` cannot be resolved (the data format is `avroJackson`), so the test pins down the wrong key.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6010855058

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6010987640

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `core/camel-main`
   
   > :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the `test-dependents` label to force testing all dependents.
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 65 of 698 tested, 28 compile-only — current: 65 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **65 affected modules** (current approach: 65).
   
   **Skip-tests mode would test 65 modules** (1 direct + 64 downstream), **skip tests for 28** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (65)</summary>
   
   - `camel-a2a` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-as2` ← downstream of org.apache.camel:camel-jetty
   - `camel-clickup` ← downstream of org.apache.camel:camel-netty-http
   - `camel-consul` ← downstream of org.apache.camel:camel-spring-main
   - `camel-core-all` ← downstream of org.apache.camel:camel-main
   - `camel-csv` ← downstream of org.apache.camel:camel-main
   - `camel-fhir` ← downstream of org.apache.camel:camel-hl7
   - `camel-groovy` ← downstream of org.apache.camel:camel-main
   - `camel-hazelcast` ← downstream of org.apache.camel:camel-spring-main
   - `camel-hl7` ← downstream of org.apache.camel:camel-netty
   - `camel-ibm-watsonx-ai` ← downstream of org.apache.camel:camel-vertx-websocket
   - `camel-iso8583` ← downstream of org.apache.camel:camel-groovy
   - `camel-java-joor-dsl` ← downstream of org.apache.camel:camel-main
   - `camel-jbang-mcp` ← downstream of org.apache.camel:camel-xml-io-dsl
   - `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jetty` ← downstream of org.apache.camel:camel-main
   - `camel-jsonpath` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-kamelet` ← downstream of org.apache.camel:camel-main
   - `camel-kamelet-main-support` ← downstream of org.apache.camel:camel-main
   - `camel-knative-http` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
   - `camel-mail` ← downstream of org.apache.camel:camel-spring-main
   - `camel-mail-microsoft-oauth` ← downstream of org.apache.camel:camel-mail
   - `camel-main` ← core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java, core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java, core/camel-main/src/test/java/org/apache/camel/main/MainHelperTest.java
   - `camel-maven-plugin` ← downstream of org.apache.camel:camel-spring-main
   - `camel-mcp-server` ← downstream of org.apache.camel:camel-main
   - `camel-micrometer-prometheus` ← downstream of org.apache.camel:camel-platform-http-main
   - `camel-microprofile-health` ← downstream of org.apache.camel:camel-main
   - `camel-netty` ← downstream of org.apache.camel:camel-main
   - `camel-netty-http` ← downstream of org.apache.camel:camel-jetty
   - `camel-oauth` ← downstream of org.apache.camel:camel-platform-http-main
   - `camel-observability-services` ← downstream of org.apache.camel:camel-micrometer-prometheus
   - `camel-once` ← downstream of org.apache.camel:camel-groovy
   - `camel-openai` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-openapi-validator` ← downstream of org.apache.camel:camel-rest-openapi
   - `camel-platform-http-main` ← downstream of org.apache.camel:camel-main
   - `camel-platform-http-vertx` ← downstream of org.apache.camel:camel-rest-openapi
   - `camel-plc4x` ← downstream of org.apache.camel:camel-main
   - `camel-pubnub` ← downstream of org.apache.camel:camel-main
   - `camel-quickfix` ← downstream of org.apache.camel:camel-jetty
   - `camel-rest-openapi` ← downstream of org.apache.camel:camel-netty-http
   - `camel-restdsl-openapi-plugin` ← downstream of org.apache.camel:camel-jetty
   - `camel-salesforce` ← downstream of org.apache.camel:camel-csv
   - `camel-salesforce-codegen` ← downstream of org.apache.camel:camel-salesforce
   - `camel-semantic` ← downstream of org.apache.camel:camel-main
   - `camel-spring-main` ← downstream of org.apache.camel:camel-main
   - `camel-state-store` ← downstream of org.apache.camel:camel-test-main-junit5
   - `camel-syslog` ← downstream of org.apache.camel:camel-netty
   - `camel-telegram` ← downstream of org.apache.camel:camel-netty-http
   - `camel-test-main-junit5` ← downstream of org.apache.camel:camel-main
   - `camel-test-main-junit6` ← downstream of org.apache.camel:camel-main
   - `camel-typesafe-ai` ← downstream of org.apache.camel:camel-main
   - `camel-vertx-websocket` ← downstream of org.apache.camel:camel-main
   - `camel-webhook` ← downstream of org.apache.camel:camel-netty-http
   - `camel-whatsapp` ← downstream of org.apache.camel:camel-netty-http
   - `camel-xml-io-dsl` ← downstream of org.apache.camel:camel-main
   - `camel-xml-jaxb-dsl` ← downstream of org.apache.camel:camel-main
   - `camel-xml-jaxb-dsl-test-definition` ← downstream of org.apache.camel:camel-main
   - `camel-xml-jaxb-dsl-test-spring` ← downstream of org.apache.camel:camel-main
   - `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-yaml-dsl
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   - `camel-zookeeper` ← downstream of org.apache.camel:camel-spring-main
   
   </details>
   
   <details><summary>Modules with tests skipped (28)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-salesforce-maven-plugin`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `docs`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/37424871553)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6036764428

   @gnodet friendly bump: we are cutting 4.23.0 this Friday, and it would be great to get this fix in.
   
   The open points from the review:
   - the Upgrade Note says `autoConfigurationFailFast=false` keeps a stray variable from failing the startup, but the flag only covers an unknown option on a target. Fix the note or the behaviour.
   - the longest match still splits `rest.apiDoc` (and custom-named instances) at the wrong place.
   - some test variables use options that don't exist (`file-watch` `pollTimeout`, avro `schemaClassName`, avroJackson `prettyPrinter`).
   - the inline threads I opened.
   
   The fix turns on env variables that were ignored since 3.9, so the upgrade-guide entry needs to be accurate before this goes into a release. Do you think you can get to it before Friday? If not, we can move it to 4.24.0.
   
   _Claude Code on behalf of davsclaus_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6037566358

   All review concerns from @davsclaus and @oscerd have been addressed in the two commits on this PR:
   
   **Code fixes (commit `2496129c`):**
   1. ✅ **Custom-pass prefix isolation** — each `custom=true` branch now guards with its own prefix (`CAMEL_COMPONENT_`, `CAMEL_DATAFORMAT_`, `CAMEL_LANGUAGE_`), so leftover keys from one category no longer bleed into another
   2. ✅ **camelCase name preservation** — catalog name lookup via `Map<String, String>` (env-key → catalog-name); `longestMatch` returns the catalog name directly, so `camel.dataformat.avroJackson`, `camel.language.exchangeProperty`, etc. are produced without lowercasing
   3. ✅ **Test options** — replaced non-existent options with real ones (`avroJackson.auto-discover-object-mapper`, `avro.instance-class-name`, `file-watch.queue-size`)
   
   **Upgrade guide (commit `b5e646492f`):**
   4. ✅ **Self-defeating workaround examples removed** — the guide now correctly explains why `{{env:...}}` placeholders don't suppress direct auto-binding, and documents the real remedies
   5. ✅ **`autoConfigurationFailFast=false` scope** — corrected: only opt-out is `camel.main.autoConfigurationEnvironmentVariablesEnabled=false`
   6. ✅ **Secrets concern** — documented: apps using `prod` profile with component env vars need to rename vars or use vault
   7. ✅ **`rest`/`rest-api` collision** — documented as a known limitation with the `CAMEL_COMPONENT_REST_APIDOC=api.json` workaround
   
   All inline review threads are resolved. CI is green. @oscerd, could you take another look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #27409:
URL: https://github.com/apache/camel/pull/27409


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6036931178

   Thanks for the thorough review @davsclaus and @oscerd. Pushed a fixup commit (074970251dac) addressing the code issues:
   
   1. **camelCase name recovery** — changed `Set<String>` to `Map<String, String>` (env-key → catalog-name) throughout; `longestMatch` now returns the catalog name directly so `camel.language.exchangeProperty`, `camel.dataformat.avroJackson`, etc. are produced without lowercasing. Fixed in all three `add*EnvVariables` methods.
   
   2. **Custom-pass prefix filter** — each `custom=true` branch now guards with its own prefix (`CAMEL_COMPONENT_`, `CAMEL_DATAFORMAT_`, `CAMEL_LANGUAGE_`) before processing, so leftover DATAFORMAT/LANGUAGE keys no longer bleed into the component pass and vice versa.
   
   3. **Test options** — replaced non-existent options (`pollTimeout`, `prettyPrinter`, `schemaClassName`) with real ones (`queueSize`, `autoDiscoverObjectMapper`, `instanceClassName`).
   
   ---
   
   Two design questions still open:
   
   **`autoConfigurationFailFast=false` scope** (@oscerd): Agreed — the upgrade guide note I had was wrong. The flag only covers unknown *options* on resolved targets, not unresolved names or empty values. I'll remove that escape hatch from the guide and replace it with the accurate scope: the only targeted opt-out today is `camel.main.autoConfigurationEnvironmentVariablesEnabled=false`. The suggestion to WARN-and-skip on unresolved names is worth a follow-up; adding it here would expand scope, but I'll open a separate issue.
   
   **`rest`/`rest-api` collision** (@oscerd): Correct — longest-match is still a heuristic and this is the one real ambiguity in the current catalog. The workaround (`CAMEL_COMPONENT_REST_APIDOC=api.json` works because option matching is case-insensitive, or use `camel.component.rest.apiDoc={{env:...}}`) is valid and I'll document it in the upgrade guide. Fully fixing it would require a different disambiguation scheme (e.g. double-underscore separator like Quarkus uses) which is a larger change.
   
   Adding the upgrade guide entry next.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6010862629

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   This bugfix targets `main` and may need porting to:
   - `camel-4.22.x`
   
   Add a `port/<branch>` label to automatically create a backport PR for that branch.
   
   Backport PRs will be created automatically on merge (once a port label is added). Comment `/port` to create them immediately.
   
   ℹ️ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #27409:
URL: https://github.com/apache/camel/pull/27409#discussion_r4193653024


##########
core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java:
##########
@@ -3020,7 +3020,7 @@ protected void autoConfigurationFromProperties(
         // load properties from ENV (override existing)
         if (mainConfigurationProperties.isAutoConfigurationEnvironmentVariablesEnabled()) {
             Map<String, String> env = MainHelper
-                    .filterEnvVariables(new String[] { "camel.component.", "camel.dataformat.", "camel.language." });
+                    .filterEnvVariables(new String[] { "CAMEL_COMPONENT_", "CAMEL_DATAFORMAT_", "CAMEL_LANGUAGE_" });

Review Comment:
   **`autoConfigurationFailFast=false` does not stop the startup failures this line makes reachable**
   
   The Upgrade Note says a stray variable fails the startup *unless `autoConfigurationFailFast=false`*, but the flag only reaches `setPropertiesOnTarget`, so it only covers an unknown option on a target that resolves. The two most likely stray-variable cases fail no matter how it is set:
   
   - **A name that does not resolve**: the supplier lambdas in `doAutoConfigurationFromProperties` throw `IllegalArgumentException("... cannot find component|dataformat|language with name ...")` unconditionally. Example: `CAMEL_COMPONENT_KAFKA_BROKERS` injected through a shared `envFrom` ConfigMap into an application that does not ship camel-kafka.
   - **An empty value**: `MainHelper.computeProperties` calls `validateOptionAndValue`, which throws `... because value is empty`. Empty variables are common (`X=${UNSET}` in compose, `value: ""` in a pod spec), and by then `putAllOverride` has already removed the matching `application.properties` key.
   
   The same keys in a properties file fail the same way, so the behaviour is consistent. But since these variables were silently ignored since 3.9, this is what existing deployments will hit after upgrading, and the only switch is `autoConfigurationEnvironmentVariablesEnabled=false`, which also turns off `CAMEL_MAIN_*`. The upgrade-guide entry should not offer `autoConfigurationFailFast=false` as the way out. Skipping (with a WARN) names from the ENV source that do not resolve, or a warn-only mode, would give a targeted opt-out.



##########
core/camel-main/src/test/java/org/apache/camel/main/MainHelperTest.java:
##########
@@ -87,4 +87,68 @@ public void testAddCustomComponentEnvVariables() {
         Assertions.assertEquals("false", prop.getProperty("camel.component.foo.pretty-print"));
     }
 
+    /**
+     * Verifies that overlapping component names (e.g. NETTY vs NETTY_HTTP, SJMS vs SJMS2, FILE vs FILE_WATCH) are
+     * resolved by longest-match so that each variable is mapped to the correct component.
+     */
+    @Test
+    void testLongestMatchComponentEnvVariables() {
+        Map<String, String> env = MainHelper.filterEnvVariables(new String[] { "CAMEL_COMPONENT_" });
+        // netty-http must not be mapped to netty
+        env.put("CAMEL_COMPONENT_NETTY_HTTP_MUTE_EXCEPTION", "true");
+        // sjms2 must not be mapped to sjms
+        env.put("CAMEL_COMPONENT_SJMS2_RECOVERY_INTERVAL", "2000");
+        // file-watch must not be mapped to file
+        env.put("CAMEL_COMPONENT_FILE_WATCH_POLL_TIMEOUT", "5000");

Review Comment:
   **Some test variables use options that do not exist**
   
   Three of the test variables use options that do not exist: `file-watch` has no `pollTimeout` (it has `pollThreads`, `queueSize`, ...), `avro` has `instanceClassName` rather than `schemaClassName`, and `avroJackson` has no `prettyPrinter`. The assertions only check the mapped key, so the tests pass. But these are the only examples of the variable form in the PR, and set for real (or reused in the end-to-end test asked for in the existing thread) they would fail the startup. Real options keep the same coverage, e.g. `CAMEL_COMPONENT_FILE_WATCH_QUEUE_SIZE` and `CAMEL_DATAFORMAT_AVRO_INSTANCE_CLASS_NAME`.



##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -476,6 +474,21 @@ public static void validateOptionAndValue(String key, String option, String valu
         }
     }
 
+    /**
+     * Returns the longest name from {@code names} such that {@code envVarKey} starts with that name followed by
+     * {@code _}, or {@link Optional#empty()} if no such name exists.
+     * <p>
+     * Using the longest match is critical when the catalog contains prefix pairs such as {@code CAMEL_COMPONENT_NETTY}
+     * / {@code CAMEL_COMPONENT_NETTY_HTTP} or {@code CAMEL_LANGUAGE_JS} / {@code CAMEL_LANGUAGE_JSONPATH}: a simple
+     * {@code findFirst()} on a {@link java.util.HashSet} gives a non-deterministic result, whereas the longest match
+     * always selects the most specific name.
+     */
+    private static Optional<String> longestMatch(Set<String> names, String envVarKey) {
+        return names.stream()
+                .filter(name -> envVarKey.startsWith(name + "_"))
+                .max(Comparator.comparingInt(String::length));

Review Comment:
   **Longest match still splits `rest.apiDoc` (and custom-named instances) at the wrong place**
   
   Longest match fixes the hash-order dependence, but the underscore form still cannot show where the name ends, and there is one real collision in the catalog today. `rest` has the component option `apiDoc`, while `rest-api` is a component of its own (options: `bridgeErrorHandler`, `consumerComponentName`, `autowiredEnabled`). So `CAMEL_COMPONENT_REST_API_DOC=api.json` becomes `camel.component.rest-api.doc`, an unknown option. An extra instance registered under a name that starts with a catalog name is split the same way (`kafka-dr` → `CAMEL_COMPONENT_KAFKA_DR_BROKERS` becomes `camel.component.kafka.dr-brokers`). A heuristic is fine here, since only the names are known, but the docs could state the limitation and the workarounds: `CAMEL_COMPONENT_REST_APIDOC` binds because the option is matched ignoring case, or use `camel.component.rest.apiDoc={{env:...}}`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27409:
URL: https://github.com/apache/camel/pull/27409#discussion_r4206866082


##########
core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java:
##########
@@ -3020,7 +3020,7 @@ protected void autoConfigurationFromProperties(
         // load properties from ENV (override existing)
         if (mainConfigurationProperties.isAutoConfigurationEnvironmentVariablesEnabled()) {
             Map<String, String> env = MainHelper
-                    .filterEnvVariables(new String[] { "camel.component.", "camel.dataformat.", "camel.language." });
+                    .filterEnvVariables(new String[] { "CAMEL_COMPONENT_", "CAMEL_DATAFORMAT_", "CAMEL_LANGUAGE_" });

Review Comment:
   This line is the actual bug 1 fix, and nothing tests it yet. Reverting it back to `"camel.component."` keeps every test green, because `MainHelperTest` calls `filterEnvVariables(new String[] { "CAMEL_COMPONENT_" })` itself. An end-to-end test that sets `CAMEL_COMPONENT_SEDA_QUEUE_SIZE` the way `MainPropertyPlaceholderWithEnvTest` sets its ENV, starts `Main`, and asserts the seda component's `queueSize` would stop this from regressing silently again, as it did after CAMEL-16345.



##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -163,17 +164,20 @@ public void addComponentEnvVariables(Map<String, String> env, Properties propert
         Set<String> toRemove = new HashSet<>();
         env.forEach((k, v) -> {
             if (custom) {
+                if (!k.startsWith("CAMEL_COMPONENT_")) {

Review Comment:
   The prefix guard fixes the `CAMEL_LANGUAGE_FOO_BAR` → `camel.component.oo.bar` problem, but no test covers it. A `MainHelperTest` case that puts a leftover `CAMEL_LANGUAGE_FOO_BAR` and `CAMEL_DATAFORMAT_FOO_BAR` in `env`, runs the three custom passes, and asserts `camel.language.foo.bar` / `camel.dataformat.foo.bar` (and no `camel.component.*`) would guard it. The same applies to the language branch keeping camelCase (`CAMEL_LANGUAGE_EXCHANGEPROPERTY_TRIM` → `camel.language.exchangeProperty.trim`), which currently has no test.



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3700,6 +3700,48 @@ When `camel.opentelemetry.*` properties are configured but OpenTelemetry is disa
 the `camel.opentelemetry2.*` or `camel.telemetryDev.*` properties are now used. Previously they were ignored whenever
 any `camel.opentelemetry.*` property was configured.
 
+=== camel-main - `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*`, `CAMEL_LANGUAGE_*` environment variables now take effect
+
+Two bugs in `camel-main`'s environment-variable processing were fixed and are now active.
+
+**Bug 1 — variables were silently ignored since Camel 3.9 (CAMEL-16345)**
+
+`filterEnvVariables` uppercases the variable names before comparing them against the supplied prefixes, so the prefixes
+themselves must be uppercase. Before this fix the code passed lowercase prefixes (`camel.component.`, etc.), causing
+every match to fail silently. This has been corrected: `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*`
+variables are now actually read.
+
+If your deployments intentionally set such variables but relied on them being ignored (for example to pass secrets that
+should not reach the component), use
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false` to opt out, or remove the variables.
+
+Variables that refer to a name not present on the classpath (for example `CAMEL_COMPONENT_KAFKA_BROKERS` in an
+application that does not include camel-kafka) will fail the startup with an `IllegalArgumentException`. There is no
+per-variable opt-out: rename the variable, remove it, or set
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.
+
+Secrets passed as component environment variables (for example `CAMEL_COMPONENT_AWS2_S3_SECRET_KEY`) will be seen by
+the `prod`-profile security check as plain-text secrets and will fail the startup. The
+`camel.component.aws2-s3.secret-key={{env:CAMEL_COMPONENT_AWS2_S3_SECRET_KEY}}` placeholder form does not help —
+`filterEnvVariables` still picks up the original variable and binds its value directly. To pass a secret without
+triggering the security check, either rename the environment variable to a name that does not match the
+`CAMEL_COMPONENT_*` pattern, configure the value through a vault, or disable auto-configuration entirely with
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.

Review Comment:
   Renaming alone leaves the option unset: the renamed variable also has to be referenced with a placeholder.
   
   ```suggestion
   triggering the security check, either rename the environment variable to a name that does not match the
   `CAMEL_COMPONENT_*` pattern and reference it with a placeholder (for example
   `camel.component.aws2-s3.secret-key={{env:MY_AWS_SECRET_KEY}}`), configure the value through a vault, or disable
   auto-configuration from environment variables with `camel.main.autoConfigurationEnvironmentVariablesEnabled=false`
   (which also turns off the `CAMEL_MAIN_*` variables).
   ```



##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -59,24 +60,24 @@ public final class MainHelper {
 
     private final String version;
     private final StopWatch stopWatch;
-    private final Set<String> componentEnvNames = new HashSet<>();
-    private final Set<String> dataformatEnvNames = new HashSet<>();
-    private final Set<String> languageEnvNames = new HashSet<>();
+    private final Map<String, String> componentEnvNames = new HashMap<>();
+    private final Map<String, String> dataformatEnvNames = new HashMap<>();
+    private final Map<String, String> languageEnvNames = new HashMap<>();
 
     public MainHelper() {
         stopWatch = new StopWatch();
 
         try {
             InputStream is = MainHelper.class.getResourceAsStream("/org/apache/camel/main/components.properties");
-            loadLines(is, componentEnvNames, s -> "CAMEL_COMPONENT_" + s.toUpperCase(Locale.US).replace('-', '_'));
+            loadLines(is, componentEnvNames, s -> "CAMEL_COMPONENT_" + s.toUpperCase(Locale.US).replace('-', '_'), s -> s);

Review Comment:
   Nit: `valueFunc` is `s -> s` at all three call sites, so `loadLines` could take only the key function and do `map.put(keyFunc.apply(line), line)`.



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3700,6 +3700,48 @@ When `camel.opentelemetry.*` properties are configured but OpenTelemetry is disa
 the `camel.opentelemetry2.*` or `camel.telemetryDev.*` properties are now used. Previously they were ignored whenever
 any `camel.opentelemetry.*` property was configured.
 
+=== camel-main - `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*`, `CAMEL_LANGUAGE_*` environment variables now take effect
+
+Two bugs in `camel-main`'s environment-variable processing were fixed and are now active.
+
+**Bug 1 — variables were silently ignored since Camel 3.9 (CAMEL-16345)**
+
+`filterEnvVariables` uppercases the variable names before comparing them against the supplied prefixes, so the prefixes
+themselves must be uppercase. Before this fix the code passed lowercase prefixes (`camel.component.`, etc.), causing
+every match to fail silently. This has been corrected: `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*`
+variables are now actually read.
+
+If your deployments intentionally set such variables but relied on them being ignored (for example to pass secrets that
+should not reach the component), use
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false` to opt out, or remove the variables.
+
+Variables that refer to a name not present on the classpath (for example `CAMEL_COMPONENT_KAFKA_BROKERS` in an
+application that does not include camel-kafka) will fail the startup with an `IllegalArgumentException`. There is no
+per-variable opt-out: rename the variable, remove it, or set
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.
+
+Secrets passed as component environment variables (for example `CAMEL_COMPONENT_AWS2_S3_SECRET_KEY`) will be seen by
+the `prod`-profile security check as plain-text secrets and will fail the startup. The
+`camel.component.aws2-s3.secret-key={{env:CAMEL_COMPONENT_AWS2_S3_SECRET_KEY}}` placeholder form does not help —
+`filterEnvVariables` still picks up the original variable and binds its value directly. To pass a secret without
+triggering the security check, either rename the environment variable to a name that does not match the
+`CAMEL_COMPONENT_*` pattern, configure the value through a vault, or disable auto-configuration entirely with
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.
+
+**Bug 2 — ambiguous name resolution**
+
+When the catalog contained component/dataformat/language pairs whose names were prefixes of each other (such as `netty`
+/ `netty-http`, `js` / `jsonpath`, `avro` / `avroJackson`), the variable was randomly mapped to either name.
+A longest-match strategy now always selects the most specific name.
+
+**Known limitation — `rest` / `rest-api`**
+
+`CAMEL_COMPONENT_REST_API_DOC=api.json` is matched to `camel.component.rest-api.doc` (the longer match), not to
+`camel.component.rest.apiDoc`. Use `CAMEL_COMPONENT_REST_APIDOC=api.json` instead (option names are matched
+case-insensitively). Note that using `camel.component.rest.apiDoc={{env:CAMEL_COMPONENT_REST_API_DOC}}` does not work
+as a workaround — `filterEnvVariables` still matches the original variable and binds it to `rest-api.doc` in addition
+to the placeholder.

Review Comment:
   The same limitation applies to custom-named instances whose name starts with a catalog name: with an extra kafka component registered as `kafka-dr`, `CAMEL_COMPONENT_KAFKA_DR_BROKERS` matches `kafka` and becomes `camel.component.kafka.dr-brokers`, an unknown option that fails the startup. It is worth a sentence here. Configuring such instances through `application.properties` (`camel.component.kafka-dr.brokers={{env:KAFKA_DR_BROKERS}}`) is the workaround.



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3700,6 +3700,48 @@ When `camel.opentelemetry.*` properties are configured but OpenTelemetry is disa
 the `camel.opentelemetry2.*` or `camel.telemetryDev.*` properties are now used. Previously they were ignored whenever
 any `camel.opentelemetry.*` property was configured.
 
+=== camel-main - `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*`, `CAMEL_LANGUAGE_*` environment variables now take effect
+
+Two bugs in `camel-main`'s environment-variable processing were fixed and are now active.
+
+**Bug 1 — variables were silently ignored since Camel 3.9 (CAMEL-16345)**
+
+`filterEnvVariables` uppercases the variable names before comparing them against the supplied prefixes, so the prefixes
+themselves must be uppercase. Before this fix the code passed lowercase prefixes (`camel.component.`, etc.), causing
+every match to fail silently. This has been corrected: `CAMEL_COMPONENT_*`, `CAMEL_DATAFORMAT_*` and `CAMEL_LANGUAGE_*`
+variables are now actually read.
+
+If your deployments intentionally set such variables but relied on them being ignored (for example to pass secrets that
+should not reach the component), use
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false` to opt out, or remove the variables.
+
+Variables that refer to a name not present on the classpath (for example `CAMEL_COMPONENT_KAFKA_BROKERS` in an
+application that does not include camel-kafka) will fail the startup with an `IllegalArgumentException`. There is no
+per-variable opt-out: rename the variable, remove it, or set
+`camel.main.autoConfigurationEnvironmentVariablesEnabled=false`.

Review Comment:
   Two gaps in this paragraph:
   
   - `camel.main.autoConfigurationEnvironmentVariablesEnabled=false` is not a targeted opt-out. It also turns off `CAMEL_MAIN_*` and the other ENV-based configuration, which `BaseMainSupport` gates on the same flag. Users who configure Camel through `CAMEL_MAIN_*` in containers need to know that before they reach for it, here and in the two other places it is recommended.
   - An **empty** variable fails too (`CAMEL_COMPONENT_SEDA_QUEUE_SIZE=` → *... because value is empty* from `validateOptionAndValue`), and empty variables are common (`X=${UNSET}` in compose, `value: ""` in a pod spec). It should be listed next to the unknown-name case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25352: fix CAMEL_COMPONENT_*/CAMEL_DATAFORMAT_*/CAMEL_LANGUAGE_* env vars ignored and ambiguous name lookup [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27409:
URL: https://github.com/apache/camel/pull/27409#issuecomment-6038247561

   <!-- regen-patch -->
   ### :warning: Generated files are out of date
   
   The [CI build](https://github.com/apache/camel/actions/runs/37622120371) regenerated files that are not committed on this PR.
   
   If *Allow edits from maintainers* is enabled, a maintainer bot will automatically
   push a "Regen" commit to this branch shortly.
   
   Otherwise, you can apply the patch manually — the missing changes are available
   as the `regen-patch` artifact of that run:
   
   ```bash
   gh pr checkout 27409 --repo apache/camel
   gh run download 37622120371 --repo apache/camel -n regen-patch
   git apply --index regen.patch && rm regen.patch pr-number
   git commit -m "Regen" && git push
   ```
   
   Alternatively, run `./etc/scripts/regen.sh` locally and commit the resulting changes.
   If the patch does not apply cleanly, update the branch from the base branch first —
   the patch was generated against the merge with the base branch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org