fix(security): close IPv6 SSRF gap in validateAgentURL (C6) - #112
Closed
HongmingWang-Rabbit wants to merge 1 commit into
Closed
fix(security): close IPv6 SSRF gap in validateAgentURL (C6)#112HongmingWang-Rabbit wants to merge 1 commit into
HongmingWang-Rabbit wants to merge 1 commit into
Conversation
PR #94 blocked 169.254.0.0/16 but left IPv6 equivalents fully open. Go's (*IPNet).Contains() does not match pure IPv6 addresses against IPv4 CIDRs, so ::1, fe80::*, and fc00::/7 all bypassed the check. Add three explicit IPv6 entries to blockedRanges: - fe80::/10 (IPv6 link-local — cloud metadata analogue) - ::1/128 (IPv6 loopback) - fc00::/7 (IPv6 ULA — RFC-4193 private) IPv4-mapped IPv6 (::ffff:169.254.x.x) is already safe: Go normalises these to IPv4 via To4() before Contains() runs. Tests: four new cases in TestValidateAgentURL covering all three blocked IPv6 ranges plus the IPv4-mapped IPv6 auto-normalisation path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
molecule-ai Bot
pushed a commit
that referenced
this pull request
Apr 20, 2026
…owlist Fixes audit #125 findings for CWE-639: 1. admin_test_token.go — CRITICAL IDOR (finding #112) When ADMIN_TOKEN is set in production, require it explicitly on GET /admin/workspaces/:id/test-token. The original gap: AdminAuth accepted any valid org-scoped token, letting an Org A token holder mint workspace bearer tokens for ANY workspace UUID they could enumerate. Now requires ADMIN_TOKEN when it's configured; MOLECULE_ENV!=production path still requires a valid bearer (any org token works for local dev). 2. org_plugin_allowlist.go — HIGH IDOR (finding #112) GET and PUT /orgs/:id/plugins/allowlist: add requireOrgOwnership() check after org existence verification. Org-token holders can only read/write their own org's allowlist. Session and ADMIN_TOKEN callers bypass the check (they have platform-wide access via the session cookie path, not org tokens). Closes: #112 (CWE-639 IDOR — tenant config access) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 21, 2026
molecule-ai Bot
pushed a commit
that referenced
this pull request
Apr 21, 2026
…owlist Fixes audit #125 findings for CWE-639: 1. admin_test_token.go — CRITICAL IDOR (finding #112) When ADMIN_TOKEN is set in production, require it explicitly on GET /admin/workspaces/:id/test-token. The original gap: AdminAuth accepted any valid org-scoped token, letting an Org A token holder mint workspace bearer tokens for ANY workspace UUID they could enumerate. Now requires ADMIN_TOKEN when it's configured; MOLECULE_ENV!=production path still requires a valid bearer (any org token works for local dev). 2. org_plugin_allowlist.go — HIGH IDOR (finding #112) GET and PUT /orgs/:id/plugins/allowlist: add requireOrgOwnership() check after org existence verification. Org-token holders can only read/write their own org's allowlist. Session and ADMIN_TOKEN callers bypass the check (they have platform-wide access via the session cookie path, not org tokens). Closes: #112 (CWE-639 IDOR — tenant config access) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validateAgentURLinregistry.goonly blocked169.254.0.0/16. Go's(*IPNet).Contains()does not match pure IPv6 addresses against IPv4 CIDRs, leaving three IPv6 ranges fully open as SSRF vectors.http://[::1]:8080,http://[fe80::1]:8080, andhttp://[fd00::1]:8080all passed through without error.blockedRangesloop and added three IPv6 entries:fe80::/10— IPv6 link-local (same threat class as169.254.0.0/16; cloud metadata analogue)::1/128— IPv6 loopbackfc00::/7— IPv6 ULA (RFC-4193 private)::ffff:169.254.169.254) requires no extra range: Go normalises these to IPv4 viaTo4()beforeContains()runs, so they're already caught by the169.254.0.0/16entry. Documented in both code comment and a test case.127.0.0.1and RFC-1918 ranges remain permitted (Docker networking requirement).Test plan
go test -race -run TestValidateAgentURL ./platform/internal/handlers/— 4 new cases added:[::1],[fe80::1],[fd00::1],[::ffff:169.254.169.254]all expectwantErr: true172.18.0.5,127.0.0.1,10.x,192.168.x) remainwantErr: falsego test -race ./...inplatform/platform-buildgate🤖 Generated with Claude Code