Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the API Secret is NOT valid, log its first and last few characters #151

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Comment on lines +185 to +186
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ends up logging a message like this (which you can see during tests):
tTi...[snip]...4c=

Note that the specific value I pasted isn't used anywhere, it's just from my running make test locally in this repo.

return false;
}

Expand Down