Skip to content

fix(mcp): missing length bounds on session_id and protocol_version #361

Description

@praxis-bot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status
    In Progress

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions