Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 5347736

Browse files
authored
Merge pull request #151 from silinternational/feature/log-redacted-apiSecret-if-incorrect
If the API Secret is NOT valid, log its first and last few characters
2 parents e265811 + 92fab81 commit 5347736

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

models/api-key.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ const isValidApiSecret = (apiKeyRecord, apiSecret = '') => {
182182
const isValid = password.compare(apiSecret, apiKeyRecord.hashedApiSecret);
183183
if (isValid !== true) {
184184
console.log('The given API Secret is NOT valid for the given API Key record.');
185+
const redactedApiSecret = apiSecret.substring(0, 3) + '...[snip]...' + apiSecret.substring(apiSecret.length - 3);
186+
console.log(redactedApiSecret);
185187
return false;
186188
}
187189

0 commit comments

Comments
 (0)