Skip to content

Validate proxy baseUrl against server security policy - #861

Open
lirenjie95 wants to merge 4 commits into
eclipse-symphony:mainfrom
lirenjie95:fix/proxy-base-url-validation
Open

lirenjie95 wants to merge 4 commits into
eclipse-symphony:mainfrom
lirenjie95:fix/proxy-base-url-validation

Conversation

@lirenjie95

@lirenjie95 lirenjie95 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #849

Validate the proxy stage provider's baseUrl before issuing any request:

  • Scheme must be http or https.
  • Host is validated against the server-wide SecurityPolicy (allowedIPRanges / allowListExclusive), reusing the existing SSRF helpers introduced for script downloads. By default loopback, link-local, and private addresses are rejected.

This is a defense-in-depth measure aligned with the discussion in the issue.

Note: redirect re-validation is not included in this change to avoid broad modifications to the shared callRestAPI/auth path; it can be added as a follow-up if needed.


Review follow-ups (loop-code-review, commit 2bbebde)

Addressed all review nits from independent agent review passes (final score 10/10):

  • Reuse over duplication: validateProxyBaseUrl now delegates to the existing scriptutils.ValidateScriptFolderURL instead of re-implementing the parse + scheme + ValidateURLHost sequence (behavior-identical: same http/https-only scheme rules, BadConfig state preserved).
  • TestNoServer intent restored: whitelists loopback and dials a real closed port, so it exercises the connection-refused path again instead of short-circuiting at host validation.
  • New TestProcessRejectsForbiddenBaseUrl: pins the wiring — Process rejects a forbidden baseUrl (127.0.0.1, nil policy) with BadConfig before any HTTP request is issued.

Verification (Go 1.27): build + vet clean; full proxy/http test suite PASS including an independent rerun of every touched test with log-level confirmation.

Known deferrals (unchanged): redirect re-validation and CRD-side validation remain follow-ups; issue #849 should stay open until those land.

@lirenjie95
lirenjie95 requested a review from Haishi2016 as a code owner August 19, 2026 00:54
@lirenjie95
lirenjie95 force-pushed the fix/proxy-base-url-validation branch from 9bf355c to d6a33a8 Compare August 21, 2026 03:18
- Delegate to scriptutils.ValidateScriptFolderURL instead of
  re-implementing the parse+scheme+ValidateURLHost sequence
- Restore TestNoServer intent: whitelist loopback and use a real
  closed port so it exercises connection-refused again
- Add TestProcessRejectsForbiddenBaseUrl pinning that Process
  rejects a forbidden baseUrl with BadConfig before any request
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.

HTTP proxy stage provider: user-controlled baseUrl enables SSRF

1 participant