fix: remove open SSRF proxy and add auth to govtool endpoints#344
Open
zeroknowledge0x wants to merge 1 commit into
Open
fix: remove open SSRF proxy and add auth to govtool endpoints#344zeroknowledge0x wants to merge 1 commit into
zeroknowledge0x wants to merge 1 commit into
Conversation
Remove the generic POST /proxy endpoint (forward handler) which was an unauthenticated open SSRF proxy allowing any caller to make the server fetch arbitrary URLs, including cloud metadata and internal services. Changes: - Remove forward() handler from proxy controller - Remove POST /proxy route from routes config - Add authentication requirement (auth: true) to govtool proxy endpoints - Add URL validation to prevent path traversal attacks - Add GOVTOOL_API_BASE_URL configuration check The frontend only uses /api/proxy/govtool/... endpoints, confirming the generic /api/proxy was dead code that shipped to production. Fixes #4168
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.
Fixes IntersectMBO/govtool#4168
Problem
The
POST /api/proxyendpoint was an unauthenticated open SSRF proxy. Any anonymous caller could make the server fetch arbitrary URLs, including:The endpoint was dead code — the frontend only uses
/api/proxy/govtool/...endpoints.Changes
forward()handler — the generic POST /proxy endpoint that was the SSRF vectorPOST /proxyroute — from routes configurationauth: trueon govtool proxy endpoints (previouslyauth: false).., leading/, or://to prevent traversalGOVTOOL_API_BASE_URLis not configuredTesting
POST /api/proxyreturns 404 (route removed)GET /api/proxy/govtool/testrequires authenticationPOST /api/proxy/govtool/testrequires authentication../../etc/passwd) are rejected