gnodet-bot commented on code in PR #29722:
URL: https://github.com/apache/camel/pull/29722#discussion_r4559923515


##########
components/camel-ai/camel-ai-resource/src/main/java/org/apache/camel/component/ai/resource/AiResourceExecutor.java:
##########
@@ -52,47 +52,47 @@ private AiResourceExecutor() {
      * @return          an {@link AiResourceResult} classifying the outcome; 
never null
      */
     public static AiResourceResult execute(AiResourceSpec spec, Exchange 
exchange) {
-        String uri = spec.getUri();
+        String resourceName = spec.getName();
 
         DefaultConsumer consumer = spec.getConsumer();
         if (consumer == null) {
             IllegalStateException cause = new IllegalStateException(
-                    String.format("No consumer available for resource '%s'", 
uri));
+                    String.format("No consumer available for resource '%s'", 
spec.getUri()));
             return new AiResourceResult.ExecutionError(cause.getMessage(), 
cause);
         }
 

Review Comment:
   💡 **Minor inconsistency — exception messages embed the concrete URI**
   
   Log statements now correctly use `resourceName` (`spec.getName()`), but the 
exception messages inside `AiResourceResult.ExecutionError` still embed 
`spec.getUri()`. For template reads, `spec.getUri()` is the **client-supplied 
concrete URI** (set via `asResourceSpec(resourceUri)`), so strings like `"No 
consumer available for resource 'crm://customers/ATTACKER_INPUT'"` land in 
`error.message()`.
   
   The same pattern applies at lines ~67, ~80, ~87 and ~95 in this file.
   
   Since `McpServerBridge.read()` now returns `GENERIC_READ_ERROR` and no 
longer logs `error.message()` (fixed in this PR), there is **no 
MCP-protocol-level exposure**. The risk is limited to route-level error 
handlers that inspect `exchange.getException()` chain.
   
   For consistency and defence-in-depth, consider using `spec.getName()` here 
too:
   ```suggestion
                       String.format("No consumer available for resource '%s'", 
spec.getName()));
   ```



-- 
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