3x-ui/web/controller
Sanaei ea53da9341
Add SSRF protection (#4044)
* Add SSRF protection for custom geo downloads

Introduce SSRF-safe HTTP transport for custom geo operations by adding ssrfSafeTransport and isBlockedIP helpers. The transport resolves hosts and blocks loopback, private, link-local and unspecified addresses, returning ErrCustomGeoSSRFBlocked on violations. Update probeCustomGeoURLWithGET, probeCustomGeoURL and downloadToPathOnce to use the safe transport. Also add the new error ErrCustomGeoSSRFBlocked and necessary imports. Minor whitespace/formatting adjustments in subClashService.go, web/entity/entity.go and web/service/setting.go.

* Add path traversal protection for custom geo

Prevent path traversal when handling custom geo downloads by adding ErrCustomGeoPathTraversal and a validateDestPath() helper that ensures destination paths stay inside the bin folder. Call validateDestPath from downloadToPathOnce, Update and Delete paths and wrap errors appropriately. Reconstruct sanitized URLs in sanitizeURL to break taint propagation before use. Map the new path-traversal error to a user-facing i18n message in the controller.

* fix
2026-04-20 00:18:20 +02:00
..
api.go Add custom geosite/geoip URL sources (#3980) 2026-04-19 21:24:24 +02:00
base.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
custom_geo.go Add SSRF protection (#4044) 2026-04-20 00:18:20 +02:00
inbound.go bug fix #3785 2026-02-11 22:21:09 +01:00
index.go Add Go code analyzer workflow 2026-03-17 23:01:15 +01:00
server.go Refactor code and fix linter warnings (#3627) 2026-01-05 05:54:56 +01:00
setting.go docs: add comments for all functions 2025-09-20 09:35:50 +02:00
util.go Add custom geosite/geoip URL sources (#3980) 2026-04-19 21:24:24 +02:00
websocket.go fix: enhance WebSocket stability, resolve XHTTP configurations and fix UI loading shifts (#3997) 2026-04-19 21:01:00 +02:00
xray_setting.go fix security issue 2026-02-09 23:36:10 +01:00
xui.go API improve security: returns 404 for unauthenticated API requests 2025-09-24 11:29:55 +02:00