security: Phase 1 critical fixes (C-1 through C-7)#34
Merged
initializ-mk merged 2 commits intomainfrom Mar 20, 2026
Merged
Conversation
- C-1/C-2/C-7: Add strict IPv4 parsing to reject octal/hex/packed SSRF bypass vectors, SafeDialer with post-DNS-resolution IP validation, IPv6 transition address detection (NAT64, 6to4, Teredo), and container-aware allowPrivateIPs for K8s inter-service communication - C-3: Strip Authorization/Cookie headers on cross-origin redirects in http_request and webhook_call tools - C-4: Replace wildcard CORS with origin allowlist (localhost defaults), configurable via --cors-origins flag, FORGE_CORS_ORIGINS env, or forge.yaml cors_origins field - C-6: Add X-Content-Type-Options, Referrer-Policy, X-Frame-Options, and Content-Security-Policy headers to all A2A server responses
Sync documentation to reflect IP validation, SafeDialer, CORS restriction, security headers, redirect credential stripping, and container-aware allowPrivateIPs across 6 doc files.
Closed
25 tasks
Closed
25 tasks
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
Fixes #30 — Phase 1 Critical SSRF Bypasses, Missing Auth & Security Headers (C-1 through C-6).
http_requestandwebhook_callstripAuthorization,Cookie,Proxy-Authorizationheaders on cross-origin redirects.Access-Control-Allow-Originto localhost by default. Configurable via--cors-originsflag,FORGE_CORS_ORIGINSenv var, orcors_originsinforge.yaml.X-Content-Type-Options: nosniff,Referrer-Policy: no-referrer,X-Frame-Options: DENY,Content-Security-Policy: default-src 'none'.Container/K8s Awareness
allowPrivateIPsauto-detects container environments — allows RFC 1918 in Docker/K8s (needed for pod-to-pod comms) while always blocking cloud metadata (169.254.169.254) and loopback bypass vectors.New Files
forge-core/security/ip_validator.goforge-core/security/safe_dialer.goforge-core/security/redirect.goforge-cli/server/a2a_server_test.goModified Files (22 total, +1324 -67 lines)
Egress enforcer, egress proxy, domain matcher, types, config, runner, A2A server, serve/run commands, http_request, webhook_call, and all related tests.
Test plan
cd forge-core && go test ./security/... -v -count=1— IP validator, safe dialer, redirect, enforcer, proxy testscd forge-core && go test ./tools/... -v -count=1— http_request and webhook_call with redirect policycd forge-cli && go test ./server/... -v -count=1— A2A server CORS and security header testscurl -i -H "Origin: https://evil.com" http://127.0.0.1:8080/returns no CORS headersX-Content-Type-Options,X-Frame-Optionsheaders on all responses