@@ -1382,6 +1382,78 @@ describe('docker-manager', () => {
13821382 expect ( env . ANOTHER_VAR ) . toBe ( 'another_value' ) ;
13831383 } ) ;
13841384
1385+ it ( 'should never pass ACTIONS_RUNTIME_TOKEN to agent container' , ( ) => {
1386+ const originalToken = process . env . ACTIONS_RUNTIME_TOKEN ;
1387+ process . env . ACTIONS_RUNTIME_TOKEN = 'test-runtime-token-value' ;
1388+
1389+ try {
1390+ // Should not be passed in default mode
1391+ const result = generateDockerCompose ( mockConfig , mockNetworkConfig ) ;
1392+ const env = result . services . agent . environment as Record < string , string > ;
1393+ expect ( env . ACTIONS_RUNTIME_TOKEN ) . toBeUndefined ( ) ;
1394+ } finally {
1395+ if ( originalToken !== undefined ) {
1396+ process . env . ACTIONS_RUNTIME_TOKEN = originalToken ;
1397+ } else {
1398+ delete process . env . ACTIONS_RUNTIME_TOKEN ;
1399+ }
1400+ }
1401+ } ) ;
1402+
1403+ it ( 'should never pass ACTIONS_RESULTS_URL to agent container' , ( ) => {
1404+ const originalUrl = process . env . ACTIONS_RESULTS_URL ;
1405+ process . env . ACTIONS_RESULTS_URL = 'https://results-receiver.actions.githubusercontent.com/' ;
1406+
1407+ try {
1408+ // Should not be passed in default mode
1409+ const result = generateDockerCompose ( mockConfig , mockNetworkConfig ) ;
1410+ const env = result . services . agent . environment as Record < string , string > ;
1411+ expect ( env . ACTIONS_RESULTS_URL ) . toBeUndefined ( ) ;
1412+ } finally {
1413+ if ( originalUrl !== undefined ) {
1414+ process . env . ACTIONS_RESULTS_URL = originalUrl ;
1415+ } else {
1416+ delete process . env . ACTIONS_RESULTS_URL ;
1417+ }
1418+ }
1419+ } ) ;
1420+
1421+ it ( 'should exclude ACTIONS_RUNTIME_TOKEN from env-all passthrough' , ( ) => {
1422+ const originalToken = process . env . ACTIONS_RUNTIME_TOKEN ;
1423+ process . env . ACTIONS_RUNTIME_TOKEN = 'test-runtime-token-value' ;
1424+
1425+ try {
1426+ const configWithEnvAll = { ...mockConfig , envAll : true } ;
1427+ const result = generateDockerCompose ( configWithEnvAll , mockNetworkConfig ) ;
1428+ const env = result . services . agent . environment as Record < string , string > ;
1429+ expect ( env . ACTIONS_RUNTIME_TOKEN ) . toBeUndefined ( ) ;
1430+ } finally {
1431+ if ( originalToken !== undefined ) {
1432+ process . env . ACTIONS_RUNTIME_TOKEN = originalToken ;
1433+ } else {
1434+ delete process . env . ACTIONS_RUNTIME_TOKEN ;
1435+ }
1436+ }
1437+ } ) ;
1438+
1439+ it ( 'should exclude ACTIONS_RESULTS_URL from env-all passthrough' , ( ) => {
1440+ const originalUrl = process . env . ACTIONS_RESULTS_URL ;
1441+ process . env . ACTIONS_RESULTS_URL = 'https://results-receiver.actions.githubusercontent.com/' ;
1442+
1443+ try {
1444+ const configWithEnvAll = { ...mockConfig , envAll : true } ;
1445+ const result = generateDockerCompose ( configWithEnvAll , mockNetworkConfig ) ;
1446+ const env = result . services . agent . environment as Record < string , string > ;
1447+ expect ( env . ACTIONS_RESULTS_URL ) . toBeUndefined ( ) ;
1448+ } finally {
1449+ if ( originalUrl !== undefined ) {
1450+ process . env . ACTIONS_RESULTS_URL = originalUrl ;
1451+ } else {
1452+ delete process . env . ACTIONS_RESULTS_URL ;
1453+ }
1454+ }
1455+ } ) ;
1456+
13851457 it ( 'should exclude system variables when envAll is enabled' , ( ) => {
13861458 const originalPath = process . env . PATH ;
13871459 process . env . CUSTOM_HOST_VAR = 'test_value' ;
0 commit comments