Skip to content

CAMEL-23621: filter tool argument headers against declared parameters (4.18.x backport)#23551

Merged
Croway merged 1 commit into
apache:camel-4.18.xfrom
Croway:backport/CAMEL-23621-4.18.x
May 27, 2026
Merged

CAMEL-23621: filter tool argument headers against declared parameters (4.18.x backport)#23551
Croway merged 1 commit into
apache:camel-4.18.xfrom
Croway:backport/CAMEL-23621-4.18.x

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented May 27, 2026

Summary

Backport of #23535 to camel-4.18.x.

  • Filter LLM tool argument field names against the tool's declared parameter schema before setting them as Exchange headers
  • Affects camel-langchain4j-tools, camel-langchain4j-agent, and camel-spring-ai-tools
  • Undeclared field names are logged at WARN level and skipped
  • Fixes raw JsonNode header values in camel-langchain4j-agent (now properly extracts Java primitives)
  • Adds upgrade guide entry documenting the behavior change

This is a security hardening measure to prevent prompt-injection attacks from injecting arbitrary Camel control headers (such as CamelFileName, CamelSqlQuery, CamelHttpUri) via crafted tool call arguments.

Test plan

  • LangChain4jToolTest.testUndeclaredToolArgumentsAreNotPropagatedAsHeaders — verifies undeclared args are blocked
  • All existing langchain4j-tools tests pass (10/10)
  • camel-langchain4j-agent module compiles successfully

Claude Code on behalf of Federico Mariani

Backport of apache#23535 to camel-4.18.x. Filters LLM tool argument field
names against the tool's declared parameter schema before setting them
as Exchange headers, preventing prompt-injection attacks from injecting
arbitrary Camel control headers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Croway Croway requested a review from oscerd May 27, 2026 08:25
@Croway Croway merged commit 5d0028f into apache:camel-4.18.x May 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants