Cut short all tokens that are not 32 chars long in TokenStorage (#600)

This commit is contained in:
Kamil Kisiela 2022-11-04 13:45:47 +01:00 committed by GitHub
parent d5c9a8fad5
commit 849da7bc53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,6 +127,11 @@ export class TokenStorage {
@atomic<TokenSelector>(({ token }) => token)
async getToken({ token }: TokenSelector) {
// Tokens are MD5 hashes, so they are always 32 characters long
if (token.length !== 32) {
throw new HiveError('Invalid token provided!');
}
this.logger.debug('Fetching token (token=%s)', maskToken(token));
try {