@@ -255,11 +255,10 @@ func TestDiscoverAuth_AuthConfigNotFound(t *testing.T) {
255255ctx := context .Background ()
256256backend , err := discoverer .GetWorkloadAsVMCPBackend (ctx , "test-server" )
257257
258- // Should still return the backend but without auth (logs warning)
258+ // Should return nil backend when auth config is referenced but not found
259+ // This is security-critical: fail closed rather than allowing unauthorized access
259260require .NoError (t , err )
260- require .NotNil (t , backend )
261- assert .Empty (t , backend .AuthStrategy )
262- assert .Nil (t , backend .AuthMetadata )
261+ require .Nil (t , backend , "Should return nil backend when auth config is missing" )
263262}
264263
265264func TestDiscoverAuth_SecretNotFound (t * testing.T ) {
@@ -312,11 +311,10 @@ func TestDiscoverAuth_SecretNotFound(t *testing.T) {
312311ctx := context .Background ()
313312backend , err := discoverer .GetWorkloadAsVMCPBackend (ctx , "test-server" )
314313
315- // Should still return the backend but without auth (logs warning)
314+ // Should return nil backend when secret is missing
315+ // This is security-critical: fail closed rather than allowing unauthorized access
316316require .NoError (t , err )
317- require .NotNil (t , backend )
318- assert .Empty (t , backend .AuthStrategy )
319- assert .Nil (t , backend .AuthMetadata )
317+ require .Nil (t , backend , "Should return nil backend when secret is missing" )
320318}
321319
322320func TestMCPServerToBackend_BasicFields (t * testing.T ) {
0 commit comments