feat: add config option for special character handling (#795)

This commit is contained in:
Tom Keller
2023-08-24 13:05:29 -07:00
committed by GitHub
parent ef93a73b13
commit fbbf385657
6 changed files with 105 additions and 74 deletions
+6 -3
View File
@@ -93,18 +93,21 @@ export function reset() {
export function verifyKeys(creds: Partial<Credentials> | undefined) {
if (!creds) {
return;
return false;
}
if (creds.AccessKeyId) {
if (SPECIAL_CHARS_REGEX.test(creds.AccessKeyId)) {
throw new Error('AccessKeyId contains special characters.');
core.debug('AccessKeyId contains special characters.');
return false;
}
}
if (creds.SecretAccessKey) {
if (SPECIAL_CHARS_REGEX.test(creds.SecretAccessKey)) {
throw new Error('SecretAccessKey contains special characters.');
core.debug('SecretAccessKey contains special characters.');
return false;
}
}
return true;
}
// Retries the promise with exponential backoff if the error isRetryable up to maxRetries time.