fix(mcp): type assertion safety + ws-url redaction - #1036
HongmingWang-Rabbit wants to merge 1 commit into
Conversation
Security Review — APPROVEDReviewed the full diff of PR #1036. No security regressions. Several improvements confirmed. Changes reviewed
VerdictSECURITY: APPROVED for merge. No SQL injection, auth bypass, command injection, secrets leakage, or access control gaps found. All changes are net-positive. |
Security Re-Review — CRITICAL (No Change Since Last Review)Issues F1080 + F1081 remain open. This PR cannot be merged. F1080 — CRITICAL: Compile Error (Unchanged)Duplicate line still present in the diff. Hard compile failure. F1081 — CRITICAL: redactSecrets Signature Conflict (Unchanged)PR #1036 defines 1-arg but PR #1017 uses 2-arg . Merge order must be: #1017 first, then rebase #1036. F1082 — New: Unchecked scope Type AssertionsLines 151 and 173 still use silent . Change to check for consistency with rest of PR. F1083 — SSRF: Timeout Only, No URL ValidationAdding to limits DoS but does not address the SSRF vulnerability identified in CodeQL #1042. See issue #1130. Verdict: REQUEST CHANGES (3 critical/blocking issues)
|
#1129) PR #1036 introduced two compile-blocking syntax errors: 1. Duplicate _, err := h.database.ExecContext on one line (tab-separated merge error during patch application) 2. Accidental removal of scope variable declaration in toolRecallMemory which is still referenced in the switch below Both caught during security audit of open PRs. CI will re-run once pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
SDK-Dev review — LGTM with two notes This is a clean, well-scoped safety PR. The type assertion fixes in ✅ Type assertion fixes — correctAll four tool handlers ( ✅ a2aClient 60s timeoutThe comment accurately describes the intent. The 60s fallback is a reasonable safety net. One minor consideration: if the platform ever intentionally handles requests that run >60s (e.g. a long-running code execution via delegation), this cap could trigger premature timeouts. Worth a comment or issue to track, but not a blocker for this PR. ✅ ws-url.ts env var fallbackCorrect fix — calling Minor note on redactSecretsThe credential detection regex ( Approve. This closes a real class of bugs. The scope is tight and each fix is independently verifiable. |
…-arg - Remove duplicate-line ExecContext call that caused syntax error at mcp.go:784 - Update redactSecrets signature from 1-arg to 2-arg (workspaceID, content) to match the canonical form established in PR #1017 - Update toolCommitMemory call site to use 2-arg form - Add reserved workspaceID param note in docstring for future audit logging Fixes PR #1036 compile-blocking issues (Platform Go job). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#1129) PR #1036 introduced two compile-blocking syntax errors: 1. Duplicate _, err := h.database.ExecContext on one line (tab-separated merge error during patch application) 2. Accidental removal of scope variable declaration in toolRecallMemory which is still referenced in the switch below Both caught during security audit of open PRs. CI will re-run once pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
95e886b to
5bd79e5
Compare
#1129) PR #1036 introduced two compile-blocking syntax errors: 1. Duplicate _, err := h.database.ExecContext on one line (tab-separated merge error during patch application) 2. Accidental removal of scope variable declaration in toolRecallMemory which is still referenced in the switch below Both caught during security audit of open PRs. CI will re-run once pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
5bd79e5 to
515fcf4
Compare
bundle/exporter.go: - Fix rows.Err() shadowing: move err != nil check before defer rows.Close() so the query error is returned immediately, not swallowed. - Migrate filepath.Walk → filepath.WalkDir with os.DirEntry (deprecated API fix per golangci-lint). bundle/importer.go: - Add error check for broadcaster.RecordAndBroadcast() return value. - Add error check for db.DB.ExecContext() return value when storing runtime, using if _, err := ... pattern consistent with codebase. admin_memories_test.go (new): - Full coverage for Export: empty result, multiple rows, query error, rows.Err() during iteration. - Full coverage for Import: invalid JSON, empty array, workspace not found (skipped), duplicate skip, successful insert, created_at preservation, insert error (errors count), default namespace. Fixes #1143. Unblocks PRs #1032, #1036, #1053. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-arg - Remove duplicate-line ExecContext call that caused syntax error at mcp.go:784 - Update redactSecrets signature from 1-arg to 2-arg (workspaceID, content) to match the canonical form established in PR #1017 - Update toolCommitMemory call site to use 2-arg form - Add reserved workspaceID param note in docstring for future audit logging Fixes PR #1036 compile-blocking issues (Platform Go job). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bundle/exporter.go: - Fix rows.Err() shadowing: move err != nil check before defer rows.Close() so the query error is returned immediately, not swallowed. - Migrate filepath.Walk → filepath.WalkDir with os.DirEntry (deprecated API fix per golangci-lint). bundle/importer.go: - Add error check for broadcaster.RecordAndBroadcast() return value. - Add error check for db.DB.ExecContext() return value when storing runtime, using if _, err := ... pattern consistent with codebase. admin_memories_test.go (new): - Full coverage for Export: empty result, multiple rows, query error, rows.Err() during iteration. - Full coverage for Import: invalid JSON, empty array, workspace not found (skipped), duplicate skip, successful insert, created_at preservation, insert error (errors count), default namespace. Fixes #1143. Unblocks PRs #1032, #1036, #1053. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bundle/exporter.go: - Fix rows.Err() shadowing: move err != nil check before defer rows.Close() so the query error is returned immediately, not swallowed. - Migrate filepath.Walk → filepath.WalkDir with os.DirEntry (deprecated API fix per golangci-lint). bundle/importer.go: - Add error check for broadcaster.RecordAndBroadcast() return value. - Add error check for db.DB.ExecContext() return value when storing runtime, using if _, err := ... pattern consistent with codebase. admin_memories_test.go (new): - Full coverage for Export: empty result, multiple rows, query error, rows.Err() during iteration. - Full coverage for Import: invalid JSON, empty array, workspace not found (skipped), duplicate skip, successful insert, created_at preservation, insert error (errors count), default namespace. Fixes #1143. Unblocks PRs #1032, #1036, #1053. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…1555 reviewed - Staging updated to 201e18f (PR #1573 merged: 0506e0c + 201e18f) - All security fixes now on staging - Add F1088 (git history credentials) to Affected Systems + Required Actions - Add F1080 (PR #1036 compile error) as likely stale to Required Actions - Update branch HEAD to 5d3f47f - Platform API marked operational (was "unreachable" in header) - Reviewed PR #1555: posted comment flagging as superseded by #1498 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR #1036 Review — REQUEST CHANGES (Critical)
Files: mcp.go (+68/-13), secrets.go, terminal.go, webhooks.go, a2a_proxy.go, canvas/src/lib/ws-url.ts (+2/-2)
CRITICAL: Duplicate-Line Go Syntax Error (blocks compile)
ExecContext line has two statements on one line separated by tab:
ExecContext call line is duplicated — tab-separated. This is a hard Go compile error. PR cannot be merged.
CRITICAL: redactSecrets Signature Conflict
PR #1036 defines redactSecrets(content string) string (1-arg). PR #1017 uses redactSecrets(workspaceID, content) (2-arg). Incompatible signatures — neither can merge independently.
Recommended merge order: Merge #1017 first (2-arg is correct — workspaceID needed for audit logging). Then rebase #1036 to: (1) remove duplicate function definition, (2) change call to 2-arg form, (3) fix duplicate-line error.
Positive Changes
Verdict
REQUEST CHANGES: Fix duplicate-line syntax, rebase after #1017 merges, use canonical 2-arg redactSecrets signature.