From 7fba8922e1540741240555560cc9504342bdb091 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 18 Mar 2026 19:16:02 -0500 Subject: Guard authenticated text fetches to sr.ht hosts and add regression test --- Hutch/Networking/SRHTError.swift | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Hutch/Networking/SRHTError.swift') diff --git a/Hutch/Networking/SRHTError.swift b/Hutch/Networking/SRHTError.swift index f148c00..f2da408 100644 --- a/Hutch/Networking/SRHTError.swift +++ b/Hutch/Networking/SRHTError.swift @@ -6,6 +6,8 @@ enum SRHTError: LocalizedError, Sendable { case graphQLErrors([GraphQLError]) /// The HTTP response had a non-2xx status code. case httpError(Int) + /// The client refused to send credentials to an unexpected URL. + case invalidAuthenticatedURL(URL) /// The response data could not be decoded. case decodingError(any Error) /// A networking error from URLSession (timeout, DNS, connectivity, etc.). @@ -20,6 +22,8 @@ enum SRHTError: LocalizedError, Sendable { return "GraphQL error: \(messages)" case .httpError(let code): return "Server returned HTTP \(code)." + case .invalidAuthenticatedURL(let url): + return "Refused to authenticate request to unexpected URL: \(url.absoluteString)" case .decodingError(let error): return "Failed to decode response: \(error.localizedDescription)" case .networkError(let error): -- cgit v1.2.3