@@ -1197,6 +1197,7 @@ def test_deploy_workflow_passes_shared_auth_contract_through_github_oidc_only():
11971197 assert "sam deploy" in workflow
11981198 oidc = deploy_job .index ("aws-actions/configure-aws-credentials@" )
11991199 for operation in (
1200+ 'echo "AUTH_CLIENT_ID=$(auth_output DataOpsClientId)"' ,
12001201 "make sam-build" ,
12011202 "sam deploy" ,
12021203 "sam package" ,
@@ -1209,7 +1210,10 @@ def test_deploy_workflow_passes_shared_auth_contract_through_github_oidc_only():
12091210 assert oidc < deploy_job .index (operation )
12101211 for parameter , variable in expected .items ():
12111212 assert f"ParameterKey={ parameter } ,ParameterValue=${ variable } " in workflow
1212- assert "dtcdev-shared-auth" not in workflow
1213+ assert "Resolve shared auth client" in deploy_job
1214+ assert "--stack-name dtcdev-shared-auth" in deploy_job
1215+ for auth_output_name in ("DataOpsClientId" , "IssuerUrl" , "JwksUrl" ):
1216+ assert f"auth_output { auth_output_name } " in deploy_job
12131217 assert "GoogleClientSecret" not in workflow
12141218 assert "CognitoClientSecret" not in workflow
12151219
@@ -1218,25 +1222,33 @@ def test_deploy_workflow_keeps_production_auth_out_of_checks_and_scoped_to_deplo
12181222 workflow = DEPLOY_WORKFLOW .read_text (encoding = "utf-8" )
12191223 before_jobs , jobs = workflow .split ("\n jobs:\n " , 1 )
12201224 checks , deploy = jobs .split ("\n deploy:\n " , 1 )
1221- expected_auth = {
1225+ static_auth = {
12221226 "AUTH_BASE_URL" : "https://auth.dtcdev.click" ,
12231227 "AUTH_USER_POOL_ID" : "us-east-1_H7nJu52Bs" ,
1224- "AUTH_ISSUER" : "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_H7nJu52Bs" ,
1225- "AUTH_JWKS_URL" : "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_H7nJu52Bs/.well-known/jwks.json" ,
1226- "AUTH_CLIENT_ID" : "1kjv61esdjs3003s8u42sgr3hf" ,
12271228 "AUTH_CALLBACK_URL" : "https://ops.dtcdev.click/auth/callback" ,
12281229 "AUTH_LOGOUT_URL" : "https://ops.dtcdev.click/" ,
12291230 "AUTH_SESSION_LIFETIME_SECONDS" : "28800" ,
12301231 }
1232+ resolved_auth = ("AUTH_ISSUER" , "AUTH_JWKS_URL" , "AUTH_CLIENT_ID" )
12311233
1232- for variable , value in expected_auth .items ():
1234+ for variable , value in static_auth .items ():
12331235 # Workflow-level env reaches every check and every Playwright child
12341236 # process. Production relying-party config belongs only to deployment.
12351237 assert f"{ variable } :" not in before_jobs
12361238 assert f"{ variable } :" not in checks
12371239 assert f" { variable } : { value } " in deploy
12381240 assert f"ParameterValue=${ variable } " in deploy
12391241
1242+ # Cognito rotates these identifiers when the app client is recreated.
1243+ # They must be read from the shared-auth stack after OIDC and never be
1244+ # pinned as literals that can silently expire.
1245+ for variable in resolved_auth :
1246+ assert f"{ variable } :" not in before_jobs
1247+ assert f"{ variable } :" not in checks
1248+ assert f'echo "{ variable } =$(auth_output ' in deploy
1249+ assert f"ParameterValue=${ variable } " in deploy
1250+ assert "1kjv61esdjs3003s8u42sgr3hf" not in workflow
1251+
12401252
12411253def test_sponsor_communication_table_indexes_ttl_stream_and_default_off_contract ():
12421254 template = TEMPLATE .read_text (encoding = "utf-8" )
0 commit comments