Federico Mariani created CAMEL-25641:
----------------------------------------

             Summary: camel-jbang-mcp - 21 tools in six classes are not 
@McpSecured, so audit, secret redaction and argument sanitisation skip them
                 Key: CAMEL-25641
                 URL: https://issues.apache.org/jira/browse/CAMEL-25641
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang-mcp
            Reporter: Federico Mariani


{{McpSecurityInterceptor}} is bound by the {{@McpSecured}} interceptor binding 
({{McpSecured.java:34}}, {{McpSecurityInterceptor.java:41-43}}), so audit 
logging, secret redaction of the answer and argument length/sanitisation checks 
({{McpSecurityInterceptor.java:52-120}}) apply only to classes that carry the 
annotation. Six tool classes do not:

|| Class || Tools ||
| {{AuthoringTools}} (MCP) | {{camel_catalog_doc}}, {{camel_catalog_find}}, 
{{camel_catalog_sample}}, {{camel_validate_source}}, {{camel_get_files}}, 
{{camel_write_file}}, {{camel_edit_file}}, {{camel_run}}, {{camel_control}}, 
{{camel_get_log}}, {{camel_get_errors}}, {{camel_eval_expression}}, 
{{camel_dependency_for_class}}, {{camel_project_overview}}, 
{{camel_save_project_summary}} |
| {{AiTraceTools}} | {{camel_runtime_ai_trace}} |
| {{AiPipelineScaffoldTools}} | {{camel_ai_pipeline_scaffold}} |
| {{DependencySecurityAuditTools}} | {{camel_dependency_security_audit}} |
| {{RouteCostEstimateTools}} | {{camel_route_cost_estimate}} |
| {{SecurityScanTools}} | {{camel_security_scan}} |

With {{camel.mcp.security.enabled=true}}, {{camel_get_errors}} and 
{{camel_get_log}} return exchange bodies and headers unredacted and unaudited, 
and {{camel_write_file}}, {{camel_run}}, {{camel_control}} leave no audit 
trail. The class javadoc of the MCP {{AuthoringTools}} ({{:40-41}}) even says 
the methods "carry the MCP annotations the security interceptor ... work on". 
The access filter ({{McpAccessFilter}}, a {{ToolFilter}} on the tool 
annotations) still applies, so read-only clients are not affected.

No test covers it: {{McpSecurityInterceptorTest}} and {{McpAccessFilterTest}} 
never mention these classes.

h3. Fix
Add {{@McpSecured}} to the six classes, and a test that walks every 
{{@Tool}}-bearing bean of the module and asserts the annotation is present, so 
the next tool class cannot miss it.

_Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to