Cap the number of incrementalMacs populated in an envelope.

Add a remote config `global.maxIncrementalMacsPerEnvelope` (client
fallback of 10) that limits how many attachment pointers in a single
envelope can have their incrementalMac field populated. Each
incrementalMac can be up to 8 KiB, so having too many risks exceeding
the 96 KiB envelope size threshold. Excess attachment pointers have
their incrementalMac and chunkSize fields stripped.
This commit is contained in:
Greyson Parrelli
2026-03-03 19:41:55 +00:00
committed by jeffrey-signal
parent 6eee4db87b
commit 2bd440e07c
3 changed files with 65 additions and 17 deletions

View File

@@ -176,6 +176,7 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
Optional.of(new SecurityEventListener(context)),
SignalExecutors.newCachedBoundedExecutor("signal-messages", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD, 1, 16, 30),
RemoteConfig.maxEnvelopeSizeBytes(),
RemoteConfig.maxIncrementalMacsPerEnvelope(),
RemoteConfig::useMessageSendRestFallback,
RemoteConfig.useBinaryId(),
BuildConfig.USE_STRING_ID);