Skip to content

fix(executor): keep only allowlisted keys from the X-LLM-Env header - #220

Merged
AIWithShrey merged 2 commits into
mainfrom
fix/llm-env-header-allowlist
Nov 3, 2026
Merged

AIWithShrey merged 2 commits into
mainfrom
fix/llm-env-header-allowlist

Conversation

@AIWithShrey

@AIWithShrey AIWithShrey commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

ParseLLMEnvHeader (internal/workflow/executor/exec_handler.go) now keeps only the keys listed in LLMEnvAllowlist and drops the rest. A V(2) log line reports how many keys were dropped, never their names or values.

Why

LLMEnvAllowlist (internal/workflow/executor/exec_client.go) is the list the runner already uses to build the X-LLM-Env header. The agent executor now applies the same list when it reads the header, so both sides use one list.

Compatibility

A runner that sends keys outside the list keeps working, because no receive-side code reads a key outside the list.

Testing

  • go test ./internal/workflow/executor/ passes, and go vet on the package is clean.
  • The existing ParseLLMEnvHeader spec decodes a valid header is now decodes a valid header, dropping keys not in LLMEnvAllowlist. It sends a listed and an unlisted key and expects only the listed one, because an unlisted key such as its old KEY is now dropped.
  • A new ExecHandler spec sends a request carrying a listed and an unlisted key and checks that only the listed one reaches agent.GetLLMEnv.
  • Both specs fail against the current exec_handler.go (run with go test -overlay) and pass with this change.

🤖 Generated with Claude Code

ParseLLMEnvHeader now keeps only the keys named in LLMEnvAllowlist,
the list the runner already uses to build the header, and drops the
rest. The new V(2) line logs the number of dropped keys, never a key
name or value.

Runners that send keys outside the list keep working, because no
receive-side code reads a key outside the list.

Signed-off-by: Shreyas Mocherla <shreyas@shreyasm.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues were identified for the environment-header allowlist change, although tests were not run during this review.

No open issues 🎉

What changed in this PR

Applies the runner’s existing LLMEnvAllowlist when the agent executor reads X-LLM-Env, keeping both sides consistent.

Changes:

  • Drops unlisted header keys and logs only the number dropped, not names or values.
  • Adds parser and handler coverage to verify that listed keys reach the agent while unlisted keys are excluded.

Tests were not run during this review.

File Description
internal/​workflow/​executor/​exec_handler.go Filters decoded header keys against the shared allowlist and logs the dropped count.
internal/​workflow/​executor/​exec_handler_test.go Adds an agent-context recorder and tests allowlist filtering in the parser and handler.

Review effort: Balanced

@AIWithShrey
AIWithShrey requested a review from patelrit November 3, 2026 16:19

@patelrit patelrit left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: Copilot 🟢 on head, no open threads, CI green, unit tests, and E2E passed on the head commit (run 41691312797).

@AIWithShrey
AIWithShrey merged commit f7edebc into main Nov 3, 2026
10 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.

3 participants