From ebbe050cf6090b744ca704c8ba29835e5078c42b Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 11 Nov 2024 15:04:30 +0000 Subject: [PATCH 1/2] Do not pass undefined authorization header --- lib/tools-download.js | 2 +- lib/tools-download.js.map | 2 +- src/tools-download.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/tools-download.js b/lib/tools-download.js index d20a58be21..d99e637e72 100644 --- a/lib/tools-download.js +++ b/lib/tools-download.js @@ -98,7 +98,7 @@ async function downloadAndExtract(codeqlURL, authorization, headers, tarVersion, }; } async function downloadAndExtractZstdWithStreaming(codeqlURL, authorization, headers, tarVersion, logger) { - headers = Object.assign({ "User-Agent": "CodeQL Action", authorization }, headers); + headers = Object.assign({ "User-Agent": "CodeQL Action" }, authorization ? { authorization } : {}, headers); const response = await new Promise((resolve) => follow_redirects_1.https.get(codeqlURL, { headers, highWaterMark: exports.STREAMING_HIGH_WATERMARK_BYTES, diff --git a/lib/tools-download.js.map b/lib/tools-download.js.map index 9788635a3e..13d2aea75a 100644 --- a/lib/tools-download.js.map +++ b/lib/tools-download.js.map @@ -1 +1 @@ -{"version":3,"file":"tools-download.js","sourceRoot":"","sources":["../src/tools-download.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,gDAkGC;AAzKD,2CAA6B;AAC7B,2CAAyC;AAEzC,+DAAiD;AACjD,uDAAyC;AACzC,+BAAoC;AAEpC,uCAAmD;AACnD,2CAA6B;AAC7B,iCAAqC;AAErC;;GAEG;AACU,QAAA,8BAA8B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAavE,SAAS,uCAAuC,CAC9C,kBAA0B,EAC1B,oBAA4B;IAE5B,OAAO;QACL,kBAAkB,EAAE,kBAAkB,GAAG,oBAAoB;QAC7D,kBAAkB;QAClB,oBAAoB;QACpB,gBAAgB,EAAE,KAAK;KACxB,CAAC;AACJ,CAAC;AAaD,SAAS,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AY,EAAE,eAAe,EAAE,aAAa,EAAE,EAChD,OAAO,CACR,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,EAAE,CAC9D,wBAAK,CAAC,GAAG,CACP,SAAS,EACT;QACE,OAAO;QACP,aAAa,EAAE,sCAA8B;KACjB,EAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,yCAAyC,SAAS,uBAAuB,QAAQ,CAAC,UAAU,GAAG,CAChG,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAC7C,OAAO,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,CAAC,IAAI,CACtE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,sBAAsB,IAAI,qBAAqB,CAAC,CAC1E;QACC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,iBAAiB,CAAC;AACxB,CAAC"} \ No newline at end of file +{"version":3,"file":"tools-download.js","sourceRoot":"","sources":["../src/tools-download.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,gDAkGC;AAzKD,2CAA6B;AAC7B,2CAAyC;AAEzC,+DAAiD;AACjD,uDAAyC;AACzC,+BAAoC;AAEpC,uCAAmD;AACnD,2CAA6B;AAC7B,iCAAqC;AAErC;;GAEG;AACU,QAAA,8BAA8B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAavE,SAAS,uCAAuC,CAC9C,kBAA0B,EAC1B,oBAA4B;IAE5B,OAAO;QACL,kBAAkB,EAAE,kBAAkB,GAAG,o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,aAAiC,EACjC,OAA4B,EAC5B,UAA0B,EAC1B,MAAc;IAEd,OAAO,GAAG,MAAM,CAAC,MAAM,CACrB,EAAE,YAAY,EAAE,eAAe,EAAE,EACjC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,EACtC,OAAO,CACR,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,EAAE,CAC9D,wBAAK,CAAC,GAAG,CACP,SAAS,EACT;QACE,OAAO;QACP,aAAa,EAAE,sCAA8B;KACjB,EAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,yCAAyC,SAAS,uBAAuB,QAAQ,CAAC,UAAU,GAAG,CAChG,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAC7C,OAAO,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,CAAC,IAAI,CACtE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,sBAAsB,IAAI,qBAAqB,CAAC,CAC1E;QACC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,iBAAiB,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/src/tools-download.ts b/src/tools-download.ts index 86ddbdffd0..8dfedabc3f 100644 --- a/src/tools-download.ts +++ b/src/tools-download.ts @@ -178,7 +178,8 @@ async function downloadAndExtractZstdWithStreaming( logger: Logger, ): Promise { headers = Object.assign( - { "User-Agent": "CodeQL Action", authorization }, + { "User-Agent": "CodeQL Action" }, + authorization ? { authorization } : {}, headers, ); const response = await new Promise((resolve) => From d899314bed376e0b7cf92316b22d1567caea9165 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 11 Nov 2024 15:06:49 +0000 Subject: [PATCH 2/2] Add changelog note --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index effd4bd290..2e4327cc68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Note that the only difference between `v2` and `v3` of the CodeQL Action is the ## [UNRELEASED] -No user facing changes. +- Fixed an issue where setting up the CodeQL tools would sometimes fail with the message "Invalid value 'undefined' for header 'authorization'". [#2590](https://github.com/github/codeql-action/pull/2590) ## 3.27.1 - 08 Nov 2024