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

   ## Problem
   
   `camel-jbang run` does not auto-download the JAR that backs a secret 
properties function. A route using `{{secret:...}}` (or `{{configmap:...}}`) 
**without** an explicit `--dep=camel-kubernetes` resolves the placeholder to 
the wrong literal instead of the secret value — e.g. `{{secret:probe/user}}` 
resolves to `probe/user`. It works only when `camel-kubernetes` is added 
explicitly, causing misleading downstream auth failures.
   
   Reported in CAMEL-24776 (thanks to Serdar Gökay for the precise reproduction 
and root-cause pointer).
   
   ## Root cause
   
   In `DependencyDownloaderPropertiesFunctionResolver`, the dependency download 
(`secret`/`configmap` → `camel-kubernetes`, plus 
`base64`/`aws`/`azure`/`gcp`/`hashicorp`) was invoked only under `if (export)`. 
On a normal run (`export=false, transform=false`) nothing was downloaded, so 
`super.resolvePropertiesFunction` could not find the function, and 
`DefaultPropertiesParser` then interpreted `{{secret:probe/user}}` as key 
`secret` with default value `probe/user`.
   
   This is a regression from **CAMEL-23073** (commit `f1d57f8`), which moved 
the previously **unconditional** download logic behind the `export` flag while 
introducing the transform stubs.
   
   ## Fix
   
   Invert the branch so the dependency download runs for **both run and 
export**, while preserving the transform stubbing (CAMEL-23073) and the export 
wrapping:
   
   - `transform` → stub the function (unchanged)
   - otherwise (run **or** export) → download the backing dependency
   - export still wraps the resolved function in `ExportPropertiesFunction`
   
   The two flags are never both true (run constructs `(false, transform)`, 
export constructs `(export, false)`), so the reorder is behavior-preserving for 
the transform and export modes.
   
   ## Affected versions / backport
   
   Regression present on `main` and `camel-4.22.x`. **`camel-4.18.x` is NOT 
affected** — it still carries the pre-CAMEL-23073 unconditional download. 
Backport target: `camel-4.22.x` only.
   
   ## Test
   
   Added `DependencyDownloaderPropertiesFunctionResolverTest` (no network): a 
recording `DependencyDownloader` double asserts that `secret`/`configmap` 
trigger a `camel-kubernetes` download on **run** and **export**, and that 
**transform** stubs without downloading.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to