@@ -149,19 +149,12 @@ describe("resolveGatewayClientBootstrap", () => {
149149 expect ( mockState . loadGatewayTlsRuntime ) . not . toHaveBeenCalled ( ) ;
150150 } ) ;
151151
152- it . each ( [
153- {
154- label : "CLI URL overrides" ,
155- url : "wss://override.example/ws" ,
152+ it ( "does not inherit the configured remote pin for CLI URL overrides" , async ( ) => {
153+ const url = "wss://override.example/ws" ;
154+ mockState . buildGatewayConnectionDetails . mockReturnValue ( {
155+ url,
156156 urlSource : "cli --url" ,
157- } ,
158- {
159- label : "plaintext remote URLs" ,
160- url : "ws://gateway.example/ws" ,
161- urlSource : "config gateway.remote.url" ,
162- } ,
163- ] ) ( "does not inherit the configured remote pin for $label" , async ( { url, urlSource } ) => {
164- mockState . buildGatewayConnectionDetails . mockReturnValue ( { url, urlSource } ) ;
157+ } ) ;
165158
166159 const result = await resolveGatewayClientBootstrap ( {
167160 config : {
@@ -173,14 +166,38 @@ describe("resolveGatewayClientBootstrap", () => {
173166 } ,
174167 } ,
175168 } as never ,
176- gatewayUrl : urlSource === "cli -- url" ? url : undefined ,
169+ gatewayUrl : url ,
177170 env : process . env ,
178171 } ) ;
179172
180173 expect ( result . tlsFingerprint ) . toBeUndefined ( ) ;
181174 expect ( mockState . loadGatewayTlsRuntime ) . not . toHaveBeenCalled ( ) ;
182175 } ) ;
183176
177+ it ( "preserves the configured remote pin so plaintext targets fail closed" , async ( ) => {
178+ const url = "ws://127.0.0.1:18789" ;
179+ mockState . buildGatewayConnectionDetails . mockReturnValue ( {
180+ url,
181+ urlSource : "config gateway.remote.url" ,
182+ } ) ;
183+
184+ const result = await resolveGatewayClientBootstrap ( {
185+ config : {
186+ gateway : {
187+ mode : "remote" ,
188+ remote : {
189+ url,
190+ tlsFingerprint : "sha256:remote" ,
191+ } ,
192+ } ,
193+ } as never ,
194+ env : process . env ,
195+ } ) ;
196+
197+ expect ( result . tlsFingerprint ) . toBe ( "sha256:remote" ) ;
198+ expect ( mockState . loadGatewayTlsRuntime ) . not . toHaveBeenCalled ( ) ;
199+ } ) ;
200+
184201 it ( "uses the local pin when remote mode falls back to the configured local gateway" , async ( ) => {
185202 const tlsConfig = { enabled : true } ;
186203 mockState . buildGatewayConnectionDetails . mockReturnValue ( {
0 commit comments