improve: environment variables interpolation#457
Conversation
Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
tofu apply -chdir=tests/pass_one -refresh=false tfplan -workspace=devDiff of 1 change.+ random_pet.name[0] will be createdApply complete! Resources: 1 added, 0 changed, 0 destroyed.
|
tofu fmt -chdir=tests/fail_format_diff -check -diff -recursive -workspace=devView output.
|
tofu validate -chdir=tests/fail_data_source_error -workspace=devSuccess! The configuration is valid.
|
tofu validate -chdir=tests/fail_invalid_resource_type -workspace=devError: Invalid resource type
|
tofu apply -chdir=tests/pass_character_limit -refresh=false tfplan -workspace=devDiff of 10000 changes.+ random_pet.name[0] will be created
+ random_pet.name[1] will be created
+ random_pet.name[2] will be created
+ random_pet.name[3] will be created
+ random_pet.name[4] will be created
+ random_pet.name[5] will be created
+ random_pet.name[6] will be created
+ random_pet.name[7] will be created
+ random_pet.name[8] will be created
+ random_pet.name[9] will be created
+ random_pet.name[10] will be created
+ random_pet.name[11] will be created
+ random_pet.name[12] will be created
+ random_pet.name[13] will be created
+ random_pet.name[14] will be created
+ random_pet.name[15] will be created
+ random_pet.name[16] will be created
+ random_pet.name[17] will be created
+ random_pet.name[18] will be created
+ random_pet.name[19] will be created
+ random_pet.name[20] will be created
+ random_pet.name[21] will be created
+ random_pet.name[22] will be created
+ random_pet.name[23] will be created
+ random_pet.name[24] will be created
+ random_pet.name[25] will be created
+ random_pet.name[26] will be created
+ random_pet.name[27] will be created
+ random_pet.name[28] will be created
+ random_pet.name[29] will be created
+ random_pet.name[30] will be created
+ random_pet.name[31] will be created
+ random_pet.name[32] will be created
+ random_pet.name[33] will be created
+ random_pet.name[34] will be created
+ random_pet.name[35] will be created
+ random_pet.name[36] will be created
+ random_pet.name[37] will be created
+ random_pet.name[38] will be created
+ random_pet.name[39] will be created
+ random_pet.name[40] will be created
+ random_pet.name[41] will be created
+ random_pet.name[42] will be created
+ random_pet.name[43] will be created
+ random_pet.name[44] will be created
+ random_pet.name[45] will be created
+ random_pet.name[46] will be created
+ random_pet.name[47] will be created
+ random_pet.name[48] will be created
+ random_pet.name[49] will be created
+ random_pet.name[50] will be created
+ random_pet.name[51] will be created
+ random_pet.name[52] will be created
+ random_pet.name[53] will be created
+ random_pet.name[54] will be created
+ random_pet.name[55] will be created
+ random_pet.name[56] will be created
+ random_pet.name[57] will be created
+ random_pet.name[58] will be created
+ random_pet.name[59] will be created
+ random_pet.name[60] will be created
+ random_pet.name[61] will be created
+ random_pet.name[62] will be created
+ random_pet.name[63] will be created
+ random_pet.name[64] will be created
+ random_pet.name[65] will be created
+ random_pet.name[66] will be created
+ random_pet.name[67] will be created
+ random_pet.name[68] will be created
+ random_pet.name[69] will be created
+ random_pet.name[70] will be created
+ random_pet.name[71] will be created
+ random_pet.name[72] will be created
+ random_pet.name[73] will be created
+ random_pet.name[74] will be created
+ random_pet.name[75] will be created
+ random_pet.name[76] will be created
+ random_pet.name[77] will be created
+ random_pet.name[78] will be created
+ random_pet.name[79] will be created
+ random_pet.name[80] will be created
+ random_pet.name[81] will be created
+ random_pet.name[82] will be created
+ random_pet.name[83] will be created
+ random_pet.name[84] will be created
+ random_pet.name[85] will be created
+ random_pet.name[86] will be created
+ random_pet.name[87] will be created
+ random_pet.name[88] will be created
+ random_pet.name[89] will be created
+ random_pet.name[90] will be created
+ random_pet.name[91] will be created
+ random_pet.name[92] will be created
+ random_pet.name[93] will be created
+ random_pet.name[94] will be created
+ random_pet.name[95] will be created
+ random_pet.name[96] will be created
+ random_pet.name[97] will be created
+ random_pet.name[98] will be created
+ random_pet.name[99] will be created
+ random_pet.name[100] will be created
+ random_pet.name[101] will be created
+ random_pet.name[102] will be created
+ random_pet.name[103] will be created
+ random_pet.name[104] will be created
+ random_pet.name[105] will be created
+ random_pet.name[106] will be created
+ random_pet.name[107] will be created
+ random_pet.name[108] will be created
+ random_pet.name[109] will be created
+ random_pet.name[110] will be created
+ random_pet.name[111] will be created
+ random_pet.name[112] will be created
+ random_pet.name[113] will be created
+ random_pet.name[114] will be created
+ random_pet.name[115] will be created
+ random_pet.name[116] will be created
+ random_pet.name[117] will be created
+ random_pet.name[118] will be created
+ random_pet.name[119] will be created
+ random_pet.name[120] will be created
+ random_pet.name[121] will be created
+ random_pet.name[122] will be created
+ random_pet.name[123] will be created
+ random_pet.name[124] will be created
+ random_pet.name[125] will be created
+ random_pet.name[126] will be created
+ random_pet.name[127] will be created
+ random_pet.name[128] will be created
+ random_pet.name[129] will be created
+ random_pet.name[130] will be created
+ random_pet.name[131] will be created
+ random_pet.name[132] will be created
+ random_pet.name[133] will be created
+ random_pet.name[134] will be created
+ random_pet.name[135] will be created
+ random_pet.name[136] will be created
+ random_pet.name[137] will be created
+ random_pet.name[138] will be created
+ random_pet.name[139] will be created
+ random_pet.name[140] will be created
+ random_pet.name[141] will be created
+ random_pet.name[142] will be created
+ random_pet.name[143] will be created
+ random_pet.name[144] will be created
+ random_pet.name[145] will be created
+ random_pet.name[146] will be created
+ random_pet.name[147] will be created
+ random_pet.name[148] will be created
+ random_pet.name[149] will be created
+ random_pet.name[150] will be created
+ random_pet.name[151] will be created
+ random_pet.name[152] will be created
+ random_pet.name[153] will be created
+ random_pet.name[154] will be created
+ random_pet.name[155] will be created
+ random_pet.name[156] will be created
+ random_pet.name[157] will be created
+ random_pet.name[158] will be created
+ random_pet.name[159] will be created
+ random_pet.name[160] will be created
+ random_pet.name[161] will be created
+ random_pet.name[162] will be created
+ random_pet.name[163] will be created
+ random_pet.name[164] will be created
+ random_pet.name[165] will be created
+ random_pet.name[166] will be created
+ random_pet.name[167] will be created
+ random_pet.name[168] will be created
+ random_pet.name[169] will be created
+ random_pet.name[170] will be created
+ random_pet.name[171] will be created
+ random_pet.name[172] will be created
+ random_pet.name[173] will be created
+ random_pet.name[174] will be created
+ random_pet.name[175] will be created
+ random_pet.name[176] will be created
+ random_pet.name[177] will be created
+ random_pet.name[178] will be created
+ random_pet.name[179] will be created
+ random_pet.name[180] will be created
+ random_pet.name[181] will be created
+ random_pet.name[182] will be created
+ random_pet.name[183] will be created
+ random_pet.name[184] will be created
+ random_pet.name[185] will be created
+ random_pet.name[186] will be created
+ random_pet.name[187] will be created
+ random_pet.name[188] will be created
+ random_pet.name[189] will be created
+ random_pet.name[190] will be created
+ random_pet.name[191] will be created
+ random_pet.name[192] will be created
+ random_pet.name[193] will be created
+ random_pet.name[194] will be created
+ random_pet.name[195] will be created
+ random_pet.name[196] will be created
+ random_pet.name[197] will be created
+ random_pet.name[198] will be created
+ random_pet.name[199] will be created
+ random_pet.name[200] will be created
+ random_pet.name[201] will be created
+ random_pet.name[202] will be created
+ random_pet.name[203] will be created
+ random_pet.name[204] will be created
+ random_pet.name[205] will be created
+ random_pet.name[206] will be created
+ random_pet.name[207] will be created
+ random_pet.name[208] will be created
+ random_pet.name[209] will be created
+ random_pet.name[210] will be created
+ random_pet.name[211] will be created
+ random_pet.name[212] will be created
+ random_pet.name[213] will be created
+ random_pet.name[214] will be created
+ random_pet.name[215] will be created
+ random_pet.name[216] will be created
+ random_pet.name[217] will be created
+ random_pet.name[218] will be created
+ random_pet.name[219] will be created
+ random_pet.name[220] will be created
+ random_pet.name[221] will be created
+ random_pet.name[222] will be created
+ random_pet.name[223] will be created
+ random_pet.name[224] will be created
+ random_pet.name[225] will be created
+ random_pet.name[226] will be created
+ random_pet.name[227] will be created
+ random_pet.name[228] will be created
+ random_pet.name[229] will be created
+ random_pet.name[230] will be created
+ random_pet.name[231] will be created
+ random_pet.name[232] will be created
+ random_pet.name[233] will be created
+ random_pet.name[234] will be created
+ random_pet.name[235] will be created
+ random_pet.name[236] will be created
+ random_pet.name[237] will be created
+ random_pet.name[238] will be created
+ random_pet.name[239] will be created
+ random_pet.name[240] will be created
+ random_pet.name[241] will be created
+ random_pet.name[242] will be created
+ random_pet.name[243] will be created
+ random_pet.name[244] will be created
+ random_pet.name[245] will be created
+ random_pet.name[246] will be created
+ random_pet.name[247] will be created
+ random_pet.name[248] will be created
+ random_pet.name[249] will be created
+ random_pet.name[250] will be created
+ random_pet.name[251] will be created
+ random_pet.name[252] will be created
+ random_pet.name[253] will be created
+ random_pet.name[254] will be created
+ random_pet.name[255] will be created
+ random_pet.name[256] will be created
+ random_pet.name[257] will be created
+ random_pet.name[258] will be created
+ random_pet.name[259] will be created
+ random_pet.name[260] will be created
+ random_pet.name[261] will be created
+ random_pet.name[262] will be created
+ random_pet.name[263] will be created
+ random_pet.name[264] will be created
+ random_pet.name[265] will be created
+ random_pet.name[266] will be created
+ random_pet.name[267] will be created
+ random_pet.name[268] will be created
+ random_pet.name[269] will be created
+ random_pet.name[270] will be created
+ random_pet.name[271] will be created
+ random_pet.name[272] will be created
+ random_pet.name[273] will be created
+ random_pet.name[274] will be created
+ random_pet.name[275] will be created
+ random_pet.name[276] will be created
+ random_pet.name[277] will be created
+ random_pet.name[278] will be created
+ random_pet.name[279] will be created
+ random_pet.name[280] will be created
+ random_pet.name[281] will be created
+ random_pet.name[282] will be created
+ random_pet.name[283] will be created
+ random_pet.name[284] will be created
+ random_pet.name[285] will be created
+ random_pet.name[286] will be created
+ random_pet.name[287] will be created
+ random_pet.name[288] will be created
+ random_pet.name[289] will be created
+ random_pet.name[290] will be created
+ random_pet.name[291] will be created
+ random_pet.name[292] will be created
+ random_pet.name[293] will be created
+ random_pet.name[294] will be created
+ random_pet.name[295] will be created
+ random_pet.name[296] will be created
+ random_pet.name[297] will be created
+ random_pet.name[298] will be created
+ random_pet.name[299] will be created
+ random_pet.name[300] will be created
+ random_pet.name[301] will be created
+ random_pet.name[302] will be created
+ random_pet.name[303] will be created
+ random_pet.name[304] will be created
+ random_pet.name[305] will be created
+ random_pet.name[306] will be created
+ random_pet.name[307] will be created
+ random_pet.name[308] will be created
+ random_pet.name[309] will be created
+ random_pet.name[310] will be created
+ random_pet.name[311] will be created
+ random_pet.name[312] will be created
+ random_pet.name[313] will be created
+ random_pet.name[314] will be created
+ random_pet.name[315] will be created
+ random_pet.name[316] will be created
+ random_pet.name[317] will be created
+ random_pet.name[318] will be created
+ random_pet.name[319] will be created
+ random_pet.name[320] will be created
+ random_pet.name[321] will be created
+ random_pet.name[322] will be created
+ random_pet.name[323] will be created
+ random_pet.name[324] will be created
+ random_pet.name[325] will be created
+ random_pet.name[326] will be created
+ random_pet.name[327] will be created
+ random_pet.name[328] will be created
+ random_pet.name[329] will be created
+ random_pet.name[330] will be created
+ random_pet.name[331] will be created
+ random_pet.name[332] will be created
+ random_pet.name[333] will be created
+ random_pet.name[334] will be created
+ random_pet.name[335] will be created
+ random_pet.name[336] will be created
+ random_pet.name[337] will be created
+ random_pet.name[338] will be created
+ random_pet.name[339] will be created
+ random_pet.name[340] will be created
+ random_pet.name[341] will be created
+ random_pet.name[342] will be created
+ random_pet.name[343] will be created
+ random_pet.name[344] will be created
+ random_pet.name[345] will be created
+ random_pet.name[346] will be created
+ random_pet.name[347] will be created
+ random_pet.name[348] will be created
+ random_pet.name[349] will be created
+ random_pet.name[350] will be created
+ random_pet.name[351] will be created
+ random_pet.name[352] will be created
+ random_pet.name[353] will be created
+ random_pet.name[354] will be created
+ random_pet.name[355] will be created
+ random_pet.name[356] will be created
+ random_pet.name[357] will be created
+ random_pet.name[358] will be created
+ random_pet.name[359] will be created
+ random_pet.name[360] will be created
+ random_pet.name[361] will be created
+ random_pet.name[362] will be created
+ random_pet.name[363] will be created
+ random_pet.name[364] will be created
+ random_pet.name[365] will be created
+ random_pet.name[366] will be created
+ random_pet.name[367] will be created
+ random_pet.name[368] will be created
+ random_pet.name[369] will be created
+ random_pet.name[370] will be created
+ random_pet.name[371] will be created
+ random_pet.name[372] will be created
+ random_pet.name[373] will be created
+ random_pet.name[374] will be created
+ random_pet.name[375] will be created
+ random_pet.name[376] will be created
+ random_pet.name[377] will be created
+ random_pet.name[378] will be created
+ random_pet.name[379] will be created
+ random_pet.name[380] will be created
+ random_pet.name[381] will be created
+ random_pet.name[382] will be created
+ random_pet.name[383] will be created
+ random_pet.name[384] will be created
+ random_pet.name[385] will be created
+ random_pet.name[386] will be created
+ random_pet.name[387] will be created
+ random_pet.name[388] will be created
+ random_pet.name[389] will be created
+ random_pet.name[390] will be created
+ random_pet.name[391] will be created
+ random_pet.name[392] will be created
+ random_pet.name[393] will be created
+ random_pet.name[394] will be created
+ random_pet.name[395] will be created
+ random_pet.name[396] will be created
+ random_pet.name[397] will be created
+ random_pet.name[398] will be created
+ random_pet.name[399] will be created
+ random_pet.name[400] will be created
+ random_pet.name[401] will be created
+ random_pet.name[402] will be created
+ random_pet.name[403] will be created
+ random_pet.name[404] will be created
+ random_pet.name[405] will be created
+ random_pet.name[406] will be created
+ random_pet.name[407] will be created
+ random_pet.name[408] will be created
+ random_pet.name[409] will be created
+ random_pet.name[410] will be created
+ random_pet.name[411] will be created
+ random_pet.name[412] will be created
+ random_pet.name[413] will be created
+ random_pet.name[414] will be created
+ random_pet.name[415] will be created
+ random_pet.name[416] will be created
+ random_pet.name[417] will be created
+ random_pet.name[418] will be created
+ random_pet.name[419] will be created
+ random_pet.name[420] will be created
+ random_pet.name[421] will be created
+ random_pet.name[422] will be created
+ random_pet.name[423] will be created
+ random_pet.name[424] will be created
+ random_pet.name[425] will be created
+ random_pet.name[426] will be created
+ random_pet.name[427] will be created
+ random_pet.name[428] will be created
+ random_pet.name[429] will be created
+ random_pet.name[430] will be created
+ random_pet.name[431] will be created
+ random_pet.name[432] will be created
+ random_pet.name[433] will be created
+ random_pet.name[434] will be created
+ random_pet.name[435] will be created
+ random_pet.name[436] will be created
+ random_pet.name[437] will be created
+ random_pet.name[438] will be created
+ random_pet.name[439] will be created
+ random_pet.name[440] will be created
+ random_pet.name[441] will be created
+ random_pet.name[442] will be created
+ random_pet.name[443] will be created
+ random_pet.name[444] will be created
+ random_pet.name[445] will be created
+ random_pet.name[446] will be created
+ random_pet.name[447] will be created
+ random_pet.name[448] will be created
+ random_pet.name[449] will be created
+ random_pet.name[450] will be created
+ random_pet.name[451] will be created
+ random_pet.name[452] will be created
+ random_pet.name[453] will be created
+ random_pet.name[454] will be created
+ random_pet.name[455] will be created
+ random_pet.name[456] will be created
+ random_pet.name[457] will be created
+ random_pet.name[458] will be created
+ random_pet.name[459] will be created
+ random_pet.name[460] will be created
+ random_pet.name[461] will be created
+ random_pet.name[462] will be created
+ random_pet.name[463] will be created
+ random_pet.name[464] will be created
+ random_pet.name[465] will be created
+ random_pet.name[466] will be created
+ random_pet.name[467] will be created
+ random_pet.name[468] will be created
+ random_pet.name[469] will be created
+ random_pet.name[470] will be created
+ random_pet.name[471] will be created
+ random_pet.name[472] will be created
+ random_pet.name[473] will be created
+ random_pet.name[474] will be created
+ random_pet.name[475] will be created
+ random_pet.name[476] will be created
+ random_pet.name[477] will be created
+ random_pet.name[478] will be created
+ random_pet.name[479] will be created
+ random_pet.name[480] will be created
+ random_pet.name[481] will be created
+ random_pet.name[482] will be created
+ random_pet.name[483] will be created
+ random_pet.name[484] will be created
+ random_pet.name[485] will be created
+ random_pet.name[486] will be created
+ random_pet.name[487] will be created
+ random_pet.name[488] will be created
+ random_pet.name[489] will be created
+ random_pet.name[490] will be created
+ random_pet.name[491] will be created
+ random_pet.name[492] will be created
+ random_pet.name[493] will be created
+ random_pet.name[494] will be created
+ random_pet.name[495] will be created
+ random_pet.name[496] will be created
+ random_pet.name[497] will be created
+ random_pet.name[498] will be created
+ random_pet.name[499] will be created
+ random_pet.name[500] will be created
+ random_pet.name[501] will be created
+ random_pet.name[502] will be created
+ random_pet.name[503] will be created
+ random_pet.name[504] will be created
+ random_pet.name[505] will be created
+ random_pet.name[506] will be created
+ random_pet.name[507] will be created
+ random_pet.name[508] will be created
+ random_pet.name[509] will be created
+ random_pet.name[510] will be created
+ random_pet.name[511] will be created
+ random_pet.name[512] will be created
+ random_pet.name[513] will be created
+ random_pet.name[514] will be created
+ random_pet.name[515] will be created
+ random_pet.name[516] will be created
+ random_pet.name[517] will be created
+ random_pet.name[518] will be created
+ random_pet.name[519] will be created
+ random_pet.name[520] will be created
+ random_pet.name[521] will be created
+ random_pet.name[522] will be created
+ random_pet.name[523] will be created
+ random_pet.name[524] will be created
+ random_pet.name[525] will be created
+ random_pet.name[526] will be created
+ random_pet.name[527] will be created
+ random_pet.name[528] will be created
+ random_pet.name[529] will be created
+ random_pet.name[530] will be created
+ random_pet.name[531] will be created
+ random_pet.name[532] will be created
+ random_pet.name[533] will be created
+ random_pet.name[534] will be created
+ random_pet.name[535] will be created
+ random_pet.name[536] will be created
+ random_pet.name[537] will be created
+ random_pet.name[538] will be created
+ random_pet.name[539] will be created
+ random_pet.name[540] will be created
+ random_pet.name[541] will be created
+ random_pet.name[542] will be created
+ random_pet.name[543] will be created
+ random_pet.name[544] will be created
+ random_pet.name[545] will be created
+ random_pet.name[546] will be created
+ random_pet.name[547] will be created
+ random_pet.name[548] will be created
+ random_pet.name[549] will be created
+ random_pet.name[550] will be created
+ random_pet.name[551] will be created
+ random_pet.name[552] will be created
+ random_pet.name[553] will be created
+ random_pet.name[554] will be created
+ random_pet.name[555] will be created
+ random_pet.name[556] will be created
+ random_pet.name[557] will be created
+ random_pet.name[558] will be created
+ random_pet.name[559] will be created
+ random_pet.name[560] will be created
+ random_pet.name[561] will be created
+ random_pet.name[562] will be created
+ random_pet.name[563] will be created
+ random_pet.name[564] will be created
+ random_pet.name[565] will be created
+ random_pet.name[566] will be created
+ random_pet.name[567] will be created
+ random_pet.name[568] will be created
+ random_pet.name[569] will be created
+ random_pet.name[570] will be created
+ random_pet.name[571] will be created
+ random_pet.name[572] will be created
+ random_pet.name[573] will be created
+ random_pet.name[574] will be created
+ random_pet.name[575] will be created
+ random_pet.name[576] will be created
+ random_pet.name[577] will be created
+ random_pet.name[578] will be created
+ random_pet.name[579] will be created
+ random_pet.name[580] will be created
+ random_pet.name[581] will be created
+ random_pet.name[582] will be created
+ random_pet.name[583] will be created
+ random_pet.name[584] will be created
+ random_pet.name[585] will be created
+ random_pet.name[586] will be created
+ random_pet.name[587] will be created
+ random_pet.name[588] will be created
+ random_pet.name[589] will be created
+ random_pet.name[590] will be created
+ random_pet.name[591] will be created
+ random_pet.name[592] will be created
+ random_pet.name[593] will be created
+ random_pet.name[594] will be created
+ random_pet.name[595] will be created
+ random_pet.name[596] will be created
+ random_pet.name[597] will be created
+ random_pet.name[598] will be created
+ random_pet.name[599] will be created
+ random_pet.name[600] will be created
+ random_pet.name[601] will be created
+ random_pet.name[602] will be created
+ random_pet.name[603] will be created
+ random_pet.name[604] will be created
+ random_pet.name[605] will be created
+ random_pet.name[606] will be created
+ random_pet.name[607] will be created
+ random_pet.name[608] will be created
+ random_pet.name[609] will be created
+ random_pet.name[610] will be created
+ random_pet.name[611] will be created
+ random_pet.name[612] will be created
+ random_pet.name[613] will be created
+ random_pet.name[614] will be created
+ random_pet.name[615] will be created
+ random_pet.name[616] will be created
+ random_pet.name[617] will be created
+ random
…Apply complete! Resources: 10000 added, 0 changed, 0 destroyed.
|
| echo TF_WORKSPACE="$TF_WORKSPACE" >> "$GITHUB_ENV" | ||
| if [[ "$GITHUB_SERVER_URL" != "https://github.com" ]]; then echo GH_HOST=$(echo "$GITHUB_SERVER_URL" | sed 's/.*:\/\///') >> "$GITHUB_ENV"; fi | ||
| echo "GH_API=X-GitHub-Api-Version:2022-11-28" >> "$GITHUB_ENV" | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" |
Check warning
Code scanning / CodeQL
Code injection Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the issue, the untrusted input ${{ inputs.token }} should be assigned to an intermediate environment variable and referenced using shell syntax ($VAR) instead of expression syntax (${{ env.VAR }}). This approach ensures that the input is treated as a literal string by the shell, mitigating the risk of code injection.
Specifically:
- Assign
${{ inputs.token }}to an environment variable in theenvsection of the step. - Reference the environment variable using
$TOKENin the shell script.
This change ensures that the input is handled securely and prevents any malicious input from being executed as a shell command.
| @@ -22,2 +22,3 @@ | ||
| TF_WORKSPACE: ${{ env.TF_WORKSPACE || inputs.arg-workspace }} | ||
| TOKEN: ${{ inputs.token }} | ||
| shell: bash | ||
| @@ -27,3 +28,3 @@ | ||
| echo "GH_API=X-GitHub-Api-Version:2022-11-28" >> "$GITHUB_ENV" | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" | ||
| echo "GH_TOKEN=$TOKEN" >> "$GITHUB_ENV" | ||
| echo "TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color")" >> "$GITHUB_ENV" |
| if [[ "$GITHUB_SERVER_URL" != "https://github.com" ]]; then echo GH_HOST=$(echo "$GITHUB_SERVER_URL" | sed 's/.*:\/\///') >> "$GITHUB_ENV"; fi | ||
| echo "GH_API=X-GitHub-Api-Version:2022-11-28" >> "$GITHUB_ENV" | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" | ||
| echo "TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color")" >> "$GITHUB_ENV" |
Check warning
Code scanning / CodeQL
Code injection Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the issue, the value of ${{ env.TF_CLI_ARGS }} should be assigned to an intermediate environment variable and referenced using native shell syntax ($VAR) instead of ${{ ... }}. This approach ensures that the input is treated as a literal value and prevents code injection. Specifically, the line should be modified to safely handle env.TF_CLI_ARGS by assigning it to an environment variable and using it in the shell script.
| @@ -28,3 +28,4 @@ | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" | ||
| echo "TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color")" >> "$GITHUB_ENV" | ||
| TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color") | ||
| echo "TF_CLI_ARGS=$TF_CLI_ARGS" >> "$GITHUB_ENV" | ||
| echo "TF_IN_AUTOMATION=true" >> "$GITHUB_ENV" |
| if [[ "$GITHUB_SERVER_URL" != "https://github.com" ]]; then echo GH_HOST=$(echo "$GITHUB_SERVER_URL" | sed 's/.*:\/\///') >> "$GITHUB_ENV"; fi | ||
| echo "GH_API=X-GitHub-Api-Version:2022-11-28" >> "$GITHUB_ENV" | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" | ||
| echo "TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color")" >> "$GITHUB_ENV" |
Check warning
Code scanning / CodeQL
Code injection Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the issue, the untrusted input ${{ env.TF_CLI_ARGS }} should be assigned to an intermediate environment variable and referenced using shell-safe syntax. This approach prevents direct interpolation of potentially malicious input into the shell command. Specifically, the value of TF_CLI_ARGS should be safely echoed or assigned using double quotes to avoid unintended command execution.
| @@ -28,3 +28,7 @@ | ||
| echo "GH_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV" | ||
| echo "TF_CLI_ARGS=$([[ -n "${{ env.TF_CLI_ARGS }}" ]] && echo "${{ env.TF_CLI_ARGS }} -no-color" || echo "-no-color")" >> "$GITHUB_ENV" | ||
| if [[ -n "${{ env.TF_CLI_ARGS }}" ]]; then | ||
| echo "TF_CLI_ARGS=\"${{ env.TF_CLI_ARGS }} -no-color\"" >> "$GITHUB_ENV" | ||
| else | ||
| echo "TF_CLI_ARGS=\"-no-color\"" >> "$GITHUB_ENV" | ||
| fi | ||
| echo "TF_IN_AUTOMATION=true" >> "$GITHUB_ENV" |
No description provided.