Skip to content

[BUG]: proxy corrupts binary response bodies served as text/* (UTF-8 decode) #1263

Closed

Description

@mygrexit

varlock version

1.24.0 (standalone binary via install.sh)1.24.0 (standalone binary via install.sh

Steps to reproduce

  1. .env.schema:

    # @proxyConfig={egress="strict"}
    # @proxy(domain="sum.golang.org")
    # ---
    X=1
    
  2. Start the proxy:

    varlock proxy start --port 47995 --cert-dir ./certs --no-allow-reload -p ./
  3. Compare a binary response fetched directly and through the proxy:

    curl -s https://sum.golang.org/tile/8/3/000.p/4 | wc -c                                    # 128
    curl -s -k --proxy http://127.0.0.1:47995 https://sum.golang.org/tile/8/3/000.p/4 | wc -c   # 226
    curl -s -k --proxy http://127.0.0.1:47995 https://sum.golang.org/tile/8/3/000.p/4 | xxd | head

The server sends this binary body with Content-Type: text/plain; charset=UTF-8. No secret is attached to the rule.

What is expected?

The response body arrives byte for byte (128 bytes), as it does for hosts without a rule.

What is actually happening?

The body arrives with 226 bytes: every invalid UTF-8 byte is replaced by U+FFFD (ef bf bd).

It looks like the body is decoded as UTF-8 text (probably for response scrubbing) and re-encoded.

Same result with --compressed and with a wildcard rule (*.org). In permissive mode, an unmatched host passes through unchanged (128 bytes).

Real-world effect: Go behind the proxy cannot verify modules against its checksum database (go get, go install pkg@version, toolchain switches fail with tile ... len=226, want 128).

System Info

- OS: Debian 13 (trixie)
- Architecture: x86_64
- Kernel: 6.12
- Varlock: 1.24.0 (standalone binary)

Any additional comments?

We run varlock as a per-user broker with egress="strict" in front of Claude Code's sandbox, so all of the agent's traffic goes through matched rules.

Suggestion: Scrub only bodies that are valid UTF-8 (or skip scrubbing when no secret was sent to that host – the docs say scrubbing is scoped to values a rule sends to the host), and otherwise pass the raw bytes through.

Activity

  1. pullfrog commented on Oct 30, 2026

    @pullfrog
    Contributor
  2. theoephraim commented on Oct 30, 2026

    @theoephraim
    Member

    thanks for the report! Will get it sorted asap.

  3. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    ✅ A fix has been merged to main in #1265 and will ship in the next release. GitHub auto-closed this issue on merge, but the change isn't published yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions