In filters/src/agentic/mcp/mod.rs, write_metadata() enforces
MAX_DYNAMIC_VALUE_LEN on method and name but not on session_id
(line ~369) or protocol_version (line ~374). Only control characters
are checked.
Similarly, promote_mcp_headers() length-bounds method and name
before injecting into upstream headers, but protocol_version (line ~405)
skips the length check, allowing unbounded values in upstream headers.
Fix: Add && value.len() <= max_len guards to session_id and
protocol_version in both write_metadata and promote_mcp_headers,
matching the existing pattern for method and name.
In
filters/src/agentic/mcp/mod.rs,write_metadata()enforcesMAX_DYNAMIC_VALUE_LENonmethodandnamebut not onsession_id(line ~369) or
protocol_version(line ~374). Only control charactersare checked.
Similarly,
promote_mcp_headers()length-boundsmethodandnamebefore injecting into upstream headers, but
protocol_version(line ~405)skips the length check, allowing unbounded values in upstream headers.
Fix: Add
&& value.len() <= max_lenguards tosession_idandprotocol_versionin bothwrite_metadataandpromote_mcp_headers,matching the existing pattern for
methodandname.