Check that size is number, not truthiness of size

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal 2022-06-23 17:36:56 -07:00 committed by GitHub
parent a74070f4ed
commit 17ce5ac75f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import Long from 'long';
import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup';
import { isNumber } from 'lodash';
import { assert, strictAssert } from '../util/assert';
import { dropNull, shallowDropNull } from '../util/dropNull';
@ -50,7 +51,7 @@ export function processAttachment(
const hasCdnId = Long.isLong(cdnId) ? !cdnId.isZero() : Boolean(cdnId);
const { contentType, digest, key, size } = attachment;
if (!size) {
if (!isNumber(size)) {
throw new Error('Missing size on incoming attachment!');
}