Skip to content

Bound local mode config before Zod validation - #174

Merged
w4ffl35 merged 3 commits into
masterfrom
codex/headlesscode-zod-input-bounds-20261023
Oct 23, 2026
Merged

w4ffl35 merged 3 commits into
masterfrom
codex/headlesscode-zod-input-bounds-20261023

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Bound local custom-mode configuration before YAML and Zod validation. The loader streams at most 1 MB, then checks limits of 100 custom modes, 100 group entries per mode, and 32 allowedMcpServers entries per mode before schema parsing. These bounds cover local project and global mode files only; they do not update Zod or address the separate MCP StreamableHTTP ingestion path.

Verification

  • Four new synthetic boundary tests passed; existing prompt, global-mode, and switch-mode suites passed (27 focused tests total).
  • Typecheck, code standards, and architecture checks passed.
  • bash scripts/e2e/run.sh passed 9/9.
  • Exact-head GitHub Actions run 40010281884 passed all steps, including the full test suite and E2E.

Security impact

This limits the size and collection counts reaching Zod when HeadlessCode reads local mode files. It is a bounded-input mitigation for this parse path, not a claim that GHSA-mrhx-c7xc-m3w5 is fully resolved. The separate MCP StreamableHTTP path remains outside this change.

Test plan

Review src/engine/__tests__/mode-config-bounds.test.ts and run the focused mode tests, npm run typecheck, npm run check-standards, npm run check-architecture, npm test, and bash scripts/e2e/run.sh.

@w4ffl35
w4ffl35 marked this pull request as ready for review October 23, 2026 19:36
@w4ffl35
w4ffl35 merged commit 3b3d032 into master Oct 23, 2026
2 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.

1 participant