@@ -380,32 +380,61 @@ describe('verifyAndBuildServiceAccountSecret', () => {
380380 expect ( result . principal ) . toBeNull ( )
381381 } )
382382
383- it ( 'refuses a keyless credential on a deployment without workload identity, with its code' , async ( ) => {
384- await expect (
385- verifyAndBuildServiceAccountSecret ( 'snowflake-service-account' , {
386- serviceAccountJson : JSON . stringify ( {
387- authType : 'workload_identity' ,
388- host : 'myorg-myaccount.snowflakecomputing.com' ,
389- } ) ,
390- owner : { workspaceId : 'ws-1' , actorUserId : 'user-1' } ,
391- } )
392- ) . rejects . toMatchObject ( {
393- code : 'validation' ,
394- detailCode : 'WORKLOAD_IDENTITY_NOT_CONFIGURED' ,
395- } )
396- } )
397-
398- it ( 'passes a keyless refusal through with its code rather than as a verification failure' , async ( ) => {
399- await expect (
400- verifyAndBuildServiceAccountSecret ( 'aws-service-account' , {
401- serviceAccountJson : JSON . stringify ( {
402- authType : 'oidc_role' ,
403- roleArn : 'arn:aws:iam::123456789012:role/SimWorkflows' ,
404- } ) ,
405- owner : { workspaceId : 'ws-1' , actorUserId : 'user-1' } ,
383+ it . each ( [
384+ [
385+ 'aws-service-account' ,
386+ { authType : 'oidc_role' , roleArn : 'arn:aws:iam::123456789012:role/SimWorkflows' } ,
387+ 'Use access keys.' ,
388+ ] ,
389+ [
390+ 'databricks-service-account' ,
391+ {
392+ authType : 'oidc_federation' ,
393+ host : 'dbc-abc123.cloud.databricks.com' ,
394+ clientId : '11111111-2222-3333-4444-555555555555' ,
395+ } ,
396+ 'Use a personal access token or a service principal OAuth secret.' ,
397+ ] ,
398+ [
399+ 'snowflake-service-account' ,
400+ { authType : 'workload_identity' , host : 'myorg-myaccount.snowflakecomputing.com' } ,
401+ 'Use a programmatic access token.' ,
402+ ] ,
403+ [
404+ 'microsoft-app-service-account' ,
405+ {
406+ authType : 'federated' ,
407+ tenantId : '11111111-2222-3333-4444-555555555555' ,
408+ clientId : '66666666-7777-8888-9999-000000000000' ,
409+ } ,
410+ 'Use a client secret or certificate.' ,
411+ ] ,
412+ [
413+ 'google-service-account' ,
414+ {
415+ authType : 'workload_identity' ,
416+ projectNumber : '123456789012' ,
417+ poolId : 'sim-pool' ,
418+ providerId : 'sim-provider' ,
419+ serviceAccountEmail : 'sim-workflows@my-project.iam.gserviceaccount.com' ,
420+ } ,
421+ 'Use a JSON key.' ,
422+ ] ,
423+ ] ) (
424+ 'refuses a keyless %s credential where this deployment cannot sign' ,
425+ async ( providerId , configuration , remedy ) => {
426+ await expect (
427+ verifyAndBuildServiceAccountSecret ( providerId , {
428+ serviceAccountJson : JSON . stringify ( configuration ) ,
429+ owner : { workspaceId : 'ws-1' , actorUserId : 'user-1' } ,
430+ } )
431+ ) . rejects . toMatchObject ( {
432+ code : 'validation' ,
433+ detailCode : 'WORKLOAD_IDENTITY_NOT_CONFIGURED' ,
434+ message : `Keyless connections are not available on this deployment. ${ remedy } ` ,
406435 } )
407- ) . rejects . toMatchObject ( { detailCode : 'WORKLOAD_IDENTITY_SUBJECT_REQUIRED' } )
408- } )
436+ }
437+ )
409438
410439 it ( 'throws when client-credential required fields are missing, without minting' , async ( ) => {
411440 await expect (
0 commit comments