Skip to content

Commit

Permalink
If the API Secret is NOT valid, log its first and last few characters
Browse files Browse the repository at this point in the history
This should help us confirm whether, for instance, and equals sign has
been dropped from the end of the string.
  • Loading branch information
forevermatt committed May 6, 2024
1 parent e265811 commit 92fab81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/api-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ const isValidApiSecret = (apiKeyRecord, apiSecret = '') => {
const isValid = password.compare(apiSecret, apiKeyRecord.hashedApiSecret);
if (isValid !== true) {
console.log('The given API Secret is NOT valid for the given API Key record.');
const redactedApiSecret = apiSecret.substring(0, 3) + '...[snip]...' + apiSecret.substring(apiSecret.length - 3);
console.log(redactedApiSecret);
return false;
}

Expand Down

0 comments on commit 92fab81

Please sign in to comment.