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

   ## Backport of #29733
   
   Backport of #29733 onto `camel-4.22.x`: **CAMEL-26280: camel-azure-functions 
- validate the function app and function name in invokeFunction**
   
   `invokeFunction` now fails fast when the function app is missing or is not 
an app name (letters, digits and hyphens), and when the function name has a 
query, a fragment, a backslash, a percent sign, an empty segment or a dot 
segment. Function names with several segments, such as `products/42` for a 
function with a custom route, are still accepted. The URL is built with the 
multi-argument `java.net.URI` constructor, so the function name is encoded as a 
path, and the `x-functions-key` header is only added to `https` URLs on an 
`azurewebsites.net` host. `getServiceUrl` applies the same app name check.
   
   ### Adapted, not a straight cherry-pick
   
   `camel-4.22.x` does not have CAMEL-26247 (#28955) and CAMEL-26525 (#29449), 
which changed the same `invokeFunction` method and the invocation client on 
`main` (4.24 only), so the cherry-pick had conflicts:
   
   - `FunctionsProducer`: kept the `invokeFunction` body of `camel-4.22.x` 
(body, response headers) and only replaced the URL building with the new 
`functionUri(...)`; added `functionUri` and `isFunctionPath` from #29733. The 
helpers of CAMEL-26247/CAMEL-26525 (`getRequestBody`, `hasContentType`, 
`toSingleValues`) are not ported.
   - `FunctionsInvocationClient`: added the `isFunctionAppUri` check of #29733 
next to the existing `convertBodyToString` of `camel-4.22.x`.
   - Tests: `FunctionsProducerFunctionUrlTest` is ported as is. 
`FunctionsProducerInvokeTest` does not exist on `camel-4.22.x` (it came with 
CAMEL-26247), so the test that #29733 added there 
(`functionKeyIsOnlyAddedForHttpsFunctionAppUrls`) is ported as a new, small 
`client/FunctionsInvocationClientTest` against a JDK `HttpServer`.
   - The upgrade-guide note of #29733 is not part of the backport: the upgrade 
guides live on `main`, and the 4.22 entry is added to 
`camel-4x-upgrade-guide-4_22.adoc` on `main` in a separate doc-sync PR.
   
   `FunctionsEndpoint`, the component doc and its catalog copy are the same as 
in #29733.
   
   Built and tested with `mvn install` in 
`components/camel-azure/camel-azure-functions` (32 unit tests pass; the ITs 
need Azure and are skipped). No generated files changed.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   🤖 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