Skip to content
Snippets Groups Projects
Unverified Commit 36e8a3ec authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(config): compare scopes lowercase (#12740)

parent cfc4c48a
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment