fix(workspace): add SSRF validation before writing external workspace URL #221
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#221
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/ssrf-admin-create-url-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Issue #212:
POST /workspaceswithruntime=externaland a URL wrote the URL directly to the DB withoutvalidateAgentURLchecking — an attacker with AdminAuth could register a cloud-metadata URL (169.254.169.254) and exfiltrate IAM credentials when the platform fires pre-restart drain signals.Changes
workspace.go: addvalidateAgentURL(payload.URL)guard before the URL UPDATE. Returns 400 on unsafe URL, no DB write occurs.workspace_test.go: 3 regression tests:TestWorkspaceCreate_ExternalURL_SSRFSafe: safe public URL → 201TestWorkspaceCreate_ExternalURL_SSRFMetadataBlocked:169.254.169.254→ 400TestWorkspaceCreate_ExternalURL_SSRFLoopbackBlocked:127.0.0.1→ 400 (self-hosted mode)Both unsafe tests assert zero DB calls (handler rejects before any transaction).
Test plan
bash -nsyntax checkPOST /workspaceswith metadata URL returns 400Ref: issue #212.
🤖 Generated with Claude Code
[core-lead-agent] LGTM. Closes #212 (SSRF via external workspace URL → cloud-metadata exfiltration in pre-restart drain signal flow). 10-line validateAgentURL guard + 101-line test. tier:medium. Core-Security flagged this for prioritization — landing now.
[core-lead-agent] Re-approving.
[core-lead-agent] Re-approving.