mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 06:12:17 +03:00
fix(shared): block cloud-metadata hosts under default remote-image guard (#11755)
Boarded in a combined worktree: typecheck:core, check:dashboard-typecheck, check:file-size, check:changelog-integrity, check:complexity, check:cognitive-complexity, check:cycles, check-deps all green; 10/10 focused tests pass. Real SSRF gap confirmed — the default "block-metadata" guard mode fell through to the unchecked parseOutboundUrl() while 3 other call sites of the same guard mode already routed through parseAndValidateNonMetadataUrl(). Good catch that the existing test suite only ever exercised "public-only" explicitly. Retargeted from the stale release/v3.8.50 base to release/v3.8.51. Thanks for closing a real cloud-metadata SSRF exposure.
This commit is contained in:
@@ -4,6 +4,7 @@ import { Agent, fetch as undiciFetch } from "undici";
|
||||
import {
|
||||
type OutboundUrlGuardMode,
|
||||
isPrivateHost,
|
||||
parseAndValidateNonMetadataUrl,
|
||||
parseAndValidatePublicUrl,
|
||||
parseOutboundUrl,
|
||||
} from "@/shared/network/outboundUrlGuard";
|
||||
@@ -51,7 +52,9 @@ export type RemoteMediaFetchOptions = RemoteImageFetchOptions;
|
||||
export type RemoteMediaFetchResult = RemoteImageFetchResult;
|
||||
|
||||
function validateRemoteImageUrl(input: string | URL, guard: OutboundUrlGuardMode) {
|
||||
return guard === "public-only" ? parseAndValidatePublicUrl(input) : parseOutboundUrl(input);
|
||||
if (guard === "public-only") return parseAndValidatePublicUrl(input);
|
||||
if (guard === "block-metadata") return parseAndValidateNonMetadataUrl(input);
|
||||
return parseOutboundUrl(input);
|
||||
}
|
||||
|
||||
function requireHttps(url: URL, enabled: boolean): URL {
|
||||
|
||||
Reference in New Issue
Block a user