mirror of
https://github.com/actions/setup-java.git
synced 2026-09-04 18:09:33 +00:00
Fix alpine failures by switching default back to only warn on verification failures. To prevent build failures due to missing GPG or rotated vendor keys. (#1262)
Also allow multiple GPG keys to be provided. Co-authored-by: John <1615532+johnoliver@users.noreply.github.com>
This commit is contained in:
Vendored
+15
-6
@@ -122,16 +122,25 @@ function getInstallationIdentity(jdkPath, architecture) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function getJdkVerificationIdentity(verifySignature, publicKey) {
|
||||
function getJdkVerificationIdentity(verifySignature, enforceSignatureVerification, publicKey) {
|
||||
if (!verifySignature) {
|
||||
return 'unverified';
|
||||
return 'disabled';
|
||||
}
|
||||
const verificationPolicy = enforceSignatureVerification
|
||||
? 'enforced'
|
||||
: 'check-and-warn';
|
||||
if (!publicKey) {
|
||||
return 'verified:bundled';
|
||||
return `${verificationPolicy}:bundled`;
|
||||
}
|
||||
const normalizedKey = publicKey.replace(/\r\n?/g, '\n').trim();
|
||||
const fingerprint = createHash('sha256').update(normalizedKey).digest('hex');
|
||||
return `verified:custom:sha256:${fingerprint}`;
|
||||
const publicKeys = Array.isArray(publicKey) ? publicKey : [publicKey];
|
||||
const normalizedKeys = publicKeys.map(key => key.replace(/\r\n?/g, '\n').trim());
|
||||
const fingerprintSource = Array.isArray(publicKey)
|
||||
? normalizedKeys.map(key => `${Buffer.byteLength(key)}:${key}`).join('')
|
||||
: normalizedKeys[0];
|
||||
const fingerprint = createHash('sha256')
|
||||
.update(fingerprintSource)
|
||||
.digest('hex');
|
||||
return `${verificationPolicy}:custom:sha256:${fingerprint}`;
|
||||
}
|
||||
async function saveJdkCaches() {
|
||||
const state = lib_core/* getState */.Gu(STATE_JDK_CACHES);
|
||||
|
||||
Reference in New Issue
Block a user