diff --git a/lib/config/decrypt.ts b/lib/config/decrypt.ts index 86a51a435b78c7ec2ae8632101b35cf45fc9175c..547f7b47e7b400ebd2d22a45c456fe6fa0419da8 100644 --- a/lib/config/decrypt.ts +++ b/lib/config/decrypt.ts @@ -99,7 +99,7 @@ export async function tryDecrypt( const orgName = org.replace(regEx(/\/$/), ''); // Strip trailing slash if (is.nonEmptyString(repo)) { const scopedRepository = `${orgName}/${repo}`; - if (scopedRepository === repository) { + if (scopedRepository.toLowerCase() === repository.toLowerCase()) { decryptedStr = value; } else { logger.debug( @@ -107,12 +107,14 @@ export async function tryDecrypt( 'Secret is scoped to a different repository' ); const error = new Error('config-validation'); - error.validationError = `Encrypted secret is scoped to a different repository: ${scopedRepository}.`; + error.validationError = `Encrypted secret is scoped to a different repository: "${scopedRepository}".`; throw error; } } else { const scopedOrg = `${orgName}/`; - if (repository.startsWith(scopedOrg)) { + if ( + repository.toLowerCase().startsWith(scopedOrg.toLowerCase()) + ) { decryptedStr = value; } else { logger.debug( @@ -120,7 +122,7 @@ export async function tryDecrypt( 'Secret is scoped to a different org' ); const error = new Error('config-validation'); - error.validationError = `Encrypted secret is scoped to a different org" ${scopedOrg}.`; + error.validationError = `Encrypted secret is scoped to a different org: "${scopedOrg}".`; throw error; } }