@@ -5,16 +5,9 @@ import {
55} from '@sim/testing/mocks/input-validation.mock'
66import { beforeEach , describe , expect , it , vi } from 'vitest'
77
8- const { mockResolveHost } = vi . hoisted ( ( ) => ( { mockResolveHost : vi . fn ( ) } ) )
9-
108vi . mock ( '@/lib/core/security/input-validation.server' , ( ) => inputValidationMock )
11- vi . mock ( '@sim/security/dns' , async ( importOriginal ) => ( {
12- ...( await importOriginal < typeof import ( '@sim/security/dns' ) > ( ) ) ,
13- resolveHostAddresses : mockResolveHost ,
14- } ) )
159
1610import { EgressRefusedError } from '@/lib/core/network/transport.server'
17- import type * as InputValidation from '@/lib/core/security/input-validation.server'
1811import {
1912 normalizeHttpBaseUrl ,
2013 refuseUnsafeTypedUrl ,
@@ -217,24 +210,6 @@ describe('tokenCheckValidator with a typed host', () => {
217210 } )
218211
219212 describe ( 'behind an environment proxy' , ( ) => {
220- it ( 'refuses a host with a private record alongside its public one before sending the token' , async ( ) => {
221- vi . stubEnv ( 'HTTPS_PROXY' , 'http://proxy.internal:3128' )
222- const actual = await vi . importActual < typeof InputValidation > (
223- '@/lib/core/security/input-validation.server'
224- )
225- validateUrl . mockImplementation ( actual . validateUrlWithDNS )
226- mockResolveHost . mockResolvedValue ( {
227- addresses : [ '93.184.216.34' , '10.0.0.5' ] ,
228- preferred : '93.184.216.34' ,
229- } )
230- pinnedFetch . mockResolvedValue ( jsonResponse ( { ok : true } ) )
231-
232- await expect (
233- validateHost ( { apiToken : 'good' , domain : 'split.example.com' } )
234- ) . rejects . toMatchObject ( { code : 'host_not_allowed' , status : 400 } )
235- expect ( pinnedFetch ) . not . toHaveBeenCalled ( )
236- } )
237-
238213 it ( "reports the proxy route's own refusal as the host, not an outage" , async ( ) => {
239214 pinnedFetch . mockRejectedValue ( new EgressRefusedError ( 'url resolves to a private address' ) )
240215
0 commit comments