fix(mcp): sanitize validate-config terminal output#4090
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 49644df | Commit Preview URL Branch Preview URL |
Jul 08 2026, 12:05 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4090 +/- ##
=======================================
Coverage 93.63% 93.63%
=======================================
Files 384 384
Lines 35822 35822
Branches 13146 13146
=======================================
Hits 33543 33543
Misses 1618 1618
Partials 661 661 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-08 00:14:44 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Motivation
validate-configCLI printed parser warnings from untrusted repository manifests directly to stdout, allowing ANSI/OSC and C0/C1 control bytes from manifest values to reach a user's terminal and potentially manipulate terminal state or clipboard.Description
sanitizePlainTextTerminalOutputinpackages/gittensory-mcp/bin/gittensory-mcp.jsand apply it to plain-text warning output emitted by thevalidate-configCLI so ANSI/OSC and C0/C1 control bytes are stripped before writing to stdout.--jsonoutput untouched (the raw warnings remain in JSON responses).test/unit/support/mcp-cli-harness.tswith avalidateConfigWarningsinjection point so tests can exercise API-returned warnings.test/unit/mcp-cli-validate-config.test.tsthat asserts terminal sequences (OSC 52, BEL, ANSI) are removed from plain output but preserved in--jsonoutput.Testing
npx vitest run test/unit/mcp-cli-validate-config.test.ts, which passed (3 tests passed).npm run build:mcp, which completed successfully (node --checkverification passed).npm run command-reference:checkandnpm run typecheck, both of which completed successfully.npm run test:ci, which did not complete becausecf-typegendrift was detected by the local check (generated Cloudflare types reported stale), preventing the full suite from finishing.npm audit --audit-level=moderate, which could not complete due to the registry audit endpoint returning403 Forbiddenin this environment.Codex Task