Skip to content

fix(core): consolidated 3 security fixes — isSafeURL dedup, CWE-78 rm, SSRF SaaS - #1560

Closed
molecule-ai[bot] wants to merge 26 commits into
stagingfrom
fix/core-security-consolidated-c011839
Closed

molecule-ai[bot] wants to merge 26 commits into
stagingfrom
fix/core-security-consolidated-c011839

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Replaces PR #1553 (ABANDONED — merge conflicts). Source commit: c011839 by Molecule AI Core-UIUX. Contains: isSafeURL dedup, CWE-78 rm, SSRF SaaS.

Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread workspace/tests/test_agents_md.py Fixed
Comment thread canvas/src/components/Canvas.tsx Fixed
Comment thread canvas/src/components/__tests__/A2ATopologyOverlay.test.tsx Fixed
Comment thread canvas/src/components/__tests__/MemoryInspectorPanel.test.tsx Fixed
Comment thread canvas/src/components/__tests__/ZoomShortcut.test.tsx Fixed
Comment thread canvas/src/components/__tests__/ZoomShortcut.test.tsx Fixed
Comment thread canvas/src/components/__tests__/SidePanel.tabs.test.tsx Fixed
Molecule AI Core-DevOps and others added 23 commits April 22, 2026 13:46
… fix

- a2a_proxy_helpers.go: resolve add/add conflicts — merge imports correctly
  (database/sql, net, net/url, strings) and keep isSafeURL from main
- mcp_tools.go: resolve add/add conflicts — merge imports correctly and keep
  isSafeURL from main
- terminal.go: fix IPv6-safe addr formatting in waitForPort using
  net.JoinHostPort instead of fmt.Sprintf
- Add workspace-server/.golangci.yaml with version: v2 and errcheck disabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Issue #1421 / #1401: PR #1363 (handler split) moved isPrivateOrMetadataIP
into a2a_proxy_helpers.go but kept the OLD pre-SaaS version — it
unconditionally blocks RFC-1918 addresses, regressing the fix in
commits 1125a02 / cf10733.

The A2A proxy path now has the same SaaS-gated logic as registry.go:
- Cloud metadata (169.254/16, fe80::/10, ::1) always blocked in both modes
- RFC-1918 (10/8, 172.16/12, 192.168/16) + IPv6 ULA (fc00::/7) blocked in
  self-hosted, allowed in SaaS cross-EC2 mode
- IPv6 addresses now properly checked (previous version returned false for all)

Co-authored-by: Molecule AI Core-BE <core-be@agents.moleculesai.app>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…atus, Cloudflare Artifacts Day 4 copy drafted
…, SSRF SaaS

Closes: #1425 (isSafeURL redeclaration), #1435 (CWE-78 rm two-arg), #1421 (SSRF SaaS VPC).

`mcp_tools.go` and `a2a_proxy_helpers.go` both defined `isSafeURL` +
`isPrivateOrMetadataIP`. Canonical implementations live in `ssrf.go`
(new file); removed from `mcp_tools.go`. Also removes unused `net`/`net/url`
imports from `mcp_tools.go`.

Changed `deleteViaEphemeral` from two-arg rm (["rm", "-rf", "/configs", filePath])
to single-arg (["rm", "-rf", "/configs/" + filePath]). Two-arg rm deletes both
paths — the bind mount AND a path at the ephemeral container root. Single-arg
keeps deletion scoped to /configs only. validateRelPath blocks traversal so
the concatenated path cannot escape the bind mount.

`isPrivateOrMetadataIP` uses SaaS-aware implementation:
  - Always blocks: 169.254.x.x/16 (IMDS), TEST-NET ranges, CGNAT, loopback
  - SaaS mode: allows RFC-1918 (10.x, 172.16–172.31.x, 192.168.x) for VPC peers
  - Self-hosted: blocks all RFC-1918
  - IPv6: ULA (fc00::/7) treated same as RFC-1918

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai
molecule-ai Bot force-pushed the fix/core-security-consolidated-c011839 branch from c86f6c3 to 4ff55cf Compare April 22, 2026 13:47
- Line 94: _, _ = db.DB.ExecContext(...) for URL UPDATE
- Lines 133-135: suppress errors in markFailed (DB UPDATE + event broadcast)

Required by golangci-lint v7 errcheck linter.
@molecule-ai
molecule-ai Bot force-pushed the fix/core-security-consolidated-c011839 branch from 4ff55cf to 989d55d Compare April 22, 2026 13:55
Molecule AI Core-DevOps and others added 2 commits April 22, 2026 14:05
…+ mcp_tools.go

PR rebase introduced a stray >>>>>>> b1064ea conflict marker at the end
of isPrivateOrMetadataIP in both files. This causes a "syntax error:
non-declaration statement outside function body" at golangci-lint/golangci-lint
run time. Remove the marker — the function body is already complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
golangci-lint v2.x requires version field as version: "2" (quoted string),
not version: v2. Also align indentation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

0 participants