Fix signature verification GPG homes on long runner paths

This commit is contained in:
copilot-swe-agent[bot]
2026-09-09 04:53:15 +00:00
committed by GitHub
parent d8572d4b37
commit 7f2b3ca2cf
6 changed files with 165 additions and 87 deletions
+7 -3
View File
@@ -35747,6 +35747,8 @@ __nccwpck_require__.d(__webpack_exports__, {
var cleanup_java_core = __nccwpck_require__(3838);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(9896);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(857);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(6928);
// EXTERNAL MODULE: external "crypto"
@@ -35767,6 +35769,7 @@ var src_util = __nccwpck_require__(4527);
const GPG_HOME_PREFIX = 'setup-java-gpg-';
const VERIFY_GPG_HOME_PREFIX = 'verify-signature-gpg-home-';
async function isGpgAvailable() {
@@ -35783,8 +35786,8 @@ function toGpgPath(p) {
.replace(/\\/g, '/')
.replace(/^([A-Za-z]):\//, (_, drive) => `/${drive.toLowerCase()}/`);
}
function createGpgHome(prefix) {
const gpgHome = fs.mkdtempSync(path.join(util.getTempDir(), prefix));
function createGpgHome(prefix, tempDir = util.getTempDir()) {
const gpgHome = fs.mkdtempSync(path.join(tempDir, prefix));
if (process.platform !== 'win32') {
fs.chmodSync(gpgHome, 0o700);
}
@@ -35843,7 +35846,8 @@ async function verifyPackageSignature(archivePath, signatureUrl, publicKeyConten
const signaturePath = await tc.downloadTool(signatureUrl);
let gpgHome;
try {
gpgHome = createGpgHome(VERIFY_GPG_HOME_PREFIX);
// Long RUNNER_TEMP paths can exceed macOS's 104-byte gpg-agent socket limit.
gpgHome = createGpgHome(VERIFY_GPG_HOME_PREFIX, os.tmpdir());
}
catch (error) {
try {