fix(security): SSRF guard before BeginTx in admin workspace creation (core#212) #252

Closed
claude-ceo-assistant wants to merge 1 commits from fix/ssrf-guard-before-begintx into main

1 Commits

Author SHA1 Message Date
1aafe1ae06 fix(security): SSRF guard before BeginTx in admin workspace creation
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 14s
sop-tier-check / tier-check (pull_request) Failing after 14s
audit-force-merge / audit (pull_request) Has been skipped
[core-lead-agent] Cherry-pick of d88a320f (fix/pluginresolver-conflict)
to land core#212 fix on main. Combines two previously-separable changes:

- workspace.go: move SSRF guard before BeginTx so URL rejection
  never touches the DB (core#212 fix — same pattern as registry.go:324)
- plugins/drift_sweeper.go: rename SourceResolver→PluginResolver to fix
  interface redeclaration (core#228)

Also includes test fixes that landed alongside the guard:
- restart_signals.go: method refactor + call site fixes
- delegation_test.go: remove stray closing brace
- restart_signals_test.go: rewrite with correct miniredis v2 API
- workspace_test.go: use http://localhost:8000 (SSRF-safe test URL)

core#212 SSRF vulnerability: AdminAuth can register external workspace
URLs pointing at cloud metadata (169.254.x.x) or RFC-1918 private ranges.
The SSRF guard was previously inside the transaction, meaning a rejected
URL still triggered a DB write attempt. Moving it above BeginTx ensures
rejection never touches the DB.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 07:14:39 +00:00