Skip to content

Commit

Permalink
Merge pull request #151 from silinternational/feature/log-redacted-ap…
Browse files Browse the repository at this point in the history
…iSecret-if-incorrect

If the API Secret is NOT valid, log its first and last few characters
  • Loading branch information
forevermatt authored May 6, 2024
2 parents e265811 + 92fab81 commit 5347736
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 5347736

Please sign in to comment.