Repository navigation
fix(mcp): stop scanning wrapped execute code for capability secret names - #129
Conversation
rewriteCapabilitySecretError merged secret names from the error and the full wrapped bundle; regex matched unrelated Secret "…" text in user strings and ExecuteResult.error strings were never parsed (instanceof Error). - Collect names only from the capability denial message (string or Error) - Add regression test for false-positive extraSecret in user code Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (6)
📝 WalkthroughWalkthroughUpdated docs and runtime text to forbid embedding literal secret placeholders ( Changes
Sequence Diagram(s)sequenceDiagram
participant Runner as runCodemodeWithRegistry
participant Registry as CapabilityRegistry
participant Secrets as SecretResolver
participant Executor as Executor
participant Errors as ErrorParser
Runner->>Registry: fetch capability registry
Runner->>Secrets: resolve required secrets (stubbed in tests)
Runner->>Executor: execute wrapped code
Executor-->>Runner: returns capability secret access-denied error (structured)
Runner->>Errors: collectSecretNamesFromCapabilityError(error)
Errors-->>Runner: extracted secret names (from structured message only)
Runner->>Runner: createCapabilitySecretAccessDeniedBatchMessage(extracted)
Runner-->>Client: return batch error (no plaintext copied from wrapped code)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://kody-pr-129.kentcdodds.workers.dev Worker: Mocks:
|
CI uses a 20s per-test limit while startCloudflareMock can wait up to 25s for the mock worker; slow cold starts push integration cases over the limit. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Summary
rewriteCapabilitySecretErrorfrom scraping secret names out of the full wrapped execute bundlestringorError.message)Secret "..."text inside user code does not inflate approval errors{{secret:...}}placeholder text into visible content such as issue bodies, comments, prompts, logs, or returned stringsusageoutputValidation
npm exec vitest run packages/worker/src/mcp/run-codemode-registry.node.test.tsnpm exec vitest run packages/worker/src/mcp/fetch-gateway.node.test.tsnpm exec vitest run packages/worker/src/mcp/tools/execute.node.test.tsnpm exec vitest run packages/worker/src/mcp/capabilities/unified-search.workers.test.tsNotes
fetch-gateway.tsdocs/contributing/testing-principles.mdnow explicitly tells contributors not to add tests whose only value is pinning tool descriptions, usage hints, warnings, or other instructional copyusagefieldSummary by CodeRabbit
Documentation
Bug Fixes
Tests