Skip to content

[wrangler] cloudchamber curl truncates header values containing a colon, and crashes on headers with none #14827

Description

@chinesepowered

What versions & operating system are you using?

Wrangler 4.114.0, Node v24.11.0, macOS 15 (Darwin 24.6.0). Also present on main @ 3a141ed11.

Please provide a link to a minimal reproduction

No repo needed — reproduced directly from the CLI, commands included below.

Describe the Bug

wrangler cloudchamber curl mis-parses the --header flag in two ways, both caused by splitting the header on every colon and keeping only the segment between the first and second:

// packages/wrangler/src/cloudchamber/curl.ts
const headers: Record<string, string> = (args.header ?? []).reduce(
    (prev, now) => ({
        ...prev,
        [now.toString().split(":")[0].trim()]: now
            .toString()
            .split(":")[1]          // <-- only the segment before the SECOND colon
            .trim(),
    }),
    { "coordinator-request-id": requestId }
);

1. Header values containing a colon are silently truncated.

wrangler cloudchamber curl /test --header "location:https://example.com/a:b"

The header is sent as location: https — everything from the second colon onward is dropped. This affects any value with a colon in it, which includes URLs, timestamps, and Authorization: Bearer style values with encoded content.

2. A header with no colon crashes the command.

wrangler cloudchamber curl /test --header "invalid"

"invalid".split(":")[1] is undefined, so .trim() throws:

TypeError: Cannot read properties of undefined (reading 'trim')

Expected: split on the first colon only — the standard rule for HTTP header parsing (RFC 9110 §5.1: the field name is everything before the first colon, the value is the remainder). A header with no colon should produce a clear user-facing error rather than an unhandled TypeError.

Please provide any relevant error logs

TypeError: Cannot read properties of undefined (reading 'trim')
    at packages/wrangler/src/cloudchamber/curl.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:wranglerRelating to the `wrangler` packageproduct:containersRelating to Cloudflare Containers: https://developers.cloudflare.com/containers/

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions