Fix uncaught error in AttachmentCrypto

This commit is contained in:
Fedor Indutny
2025-10-29 12:39:37 -07:00
committed by GitHub
parent 363aff5330
commit 06448ea80e
4 changed files with 20 additions and 18 deletions

View File

@@ -9836,7 +9836,7 @@ DEALINGS IN THE SOFTWARE.
```
## gimli 0.31.1, heck 0.5.0, unicode-xid 0.2.6
## gimli 0.31.1, heck 0.5.0, unicode-segmentation 1.12.0, unicode-xid 0.2.6
```
Copyright (c) 2015 The Rust Project Developers

View File

@@ -132,7 +132,7 @@
"@react-aria/utils": "3.25.3",
"@react-spring/web": "9.7.5",
"@react-types/shared": "3.27.0",
"@signalapp/libsignal-client": "0.83.0",
"@signalapp/libsignal-client": "0.85.1",
"@signalapp/minimask": "1.0.1",
"@signalapp/mute-state-change": "workspace:1.0.0",
"@signalapp/quill-cjs": "2.1.2",

10
pnpm-lock.yaml generated
View File

@@ -129,8 +129,8 @@ importers:
specifier: 3.27.0
version: 3.27.0(react@18.3.1)
'@signalapp/libsignal-client':
specifier: 0.83.0
version: 0.83.0
specifier: 0.85.1
version: 0.85.1
'@signalapp/minimask':
specifier: 1.0.1
version: 1.0.1
@@ -3492,8 +3492,8 @@ packages:
'@signalapp/libsignal-client@0.76.7':
resolution: {integrity: sha512-iGWTlFkko7IKlm96Iy91Wz5sIN089nj02ifOk6BWtLzeVi0kFaNj+jK26Sl1JRXy/VfXevcYtiOivOg43BPqpg==}
'@signalapp/libsignal-client@0.83.0':
resolution: {integrity: sha512-QaXviPAvj4PA2QDmN6YyPnlkp699BE3fIgaJmKrfvZMsvBfMGeJ3H3BHFt0CV2vUWMbc3oEgxbwdXu//f6oTrA==}
'@signalapp/libsignal-client@0.85.1':
resolution: {integrity: sha512-AXOug/lcEQOgKt46VOfL9yE+3V8kRKggscORytIImT/F4qehsGNgHwJjpi+bwFbw2dEhBCqEoDu8m1n96WZ7Gg==}
'@signalapp/minimask@1.0.1':
resolution: {integrity: sha512-QAwo0joA60urTNbW9RIz6vLKQjy+jdVtH7cvY0wD9PVooD46MAjE40MLssp4xUJrph91n2XvtJ3pbEUDrmT2AA==}
@@ -14290,7 +14290,7 @@ snapshots:
type-fest: 4.26.1
uuid: 11.0.2
'@signalapp/libsignal-client@0.83.0':
'@signalapp/libsignal-client@0.85.1':
dependencies:
node-gyp-build: 4.8.4
type-fest: 4.26.1

View File

@@ -387,17 +387,6 @@ export async function decryptAttachmentV2ToSink(
const hmac = createHmac(HashType.size256, macKey);
const plaintextHash = createHash(HashType.size256);
const incrementalDigestValidator =
options.type === 'standard' &&
options.theirIncrementalMac &&
options.theirChunkSize
? new ValidatingPassThrough(
Buffer.from(macKey),
everyNthByte(options.theirChunkSize),
Buffer.from(options.theirIncrementalMac)
)
: undefined;
let theirMac: Uint8Array | undefined;
// When downloading from backup there is an outer encryption layer; in that case we
@@ -436,6 +425,19 @@ export async function decryptAttachmentV2ToSink(
throw missingCaseError(options);
}
// Initializing `ValidatingPassThrough` might throw on invalid parameters so
// it is important to do it within `try {} catch {}`
const incrementalDigestValidator =
options.type === 'standard' &&
options.theirIncrementalMac &&
options.theirChunkSize
? new ValidatingPassThrough(
Buffer.from(macKey),
everyNthByte(options.theirChunkSize),
Buffer.from(options.theirIncrementalMac)
)
: undefined;
await pipeline(
[
ciphertextStream,