Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Be more defensive when creating a buffer #155

Merged
merged 5 commits into from
Jun 4, 2019
Merged
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion src/tools/create-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ const makeSensitiveBank = (event, data) => {
const censored = hashing.snipify(val);
bank[val] = censored;
bank[encodeURIComponent(val)] = censored;
bank[Buffer.from(val).toString('base64')] = censored;
try {
bank[Buffer.from(val).toString('base64')] = censored;
} catch (e) {
if (e.name !== 'TypeError') {
throw e;
}
// ignore; Buffer is semi-selective about what types it takes
// not sure why we get non-strings here, but we do occasionally.
}
}
return bank;
},
Expand Down