Enforce a configurable max envelope size.

This commit is contained in:
Greyson Parrelli
2020-10-22 16:01:52 -04:00
committed by Cody Henthorne
parent ac54b5cbdf
commit f676d1c61c
4 changed files with 30 additions and 8 deletions

View File

@@ -99,7 +99,8 @@ public class ApplicationDependencyProvider implements ApplicationDependencies.Pr
Optional.fromNullable(IncomingMessageObserver.getUnidentifiedPipe()),
Optional.of(new SecurityEventListener(context)),
provideClientZkOperations().getProfileOperations(),
SignalExecutors.newCachedBoundedExecutor("signal-messages", 1, 16));
SignalExecutors.newCachedBoundedExecutor("signal-messages", 1, 16),
FeatureFlags.maxEnvelopeSize());
}
@Override

View File

@@ -60,6 +60,7 @@ public final class FeatureFlags {
public static final String RESEARCH_MEGAPHONE_1 = "research.megaphone.1";
public static final String MODERN_PROFILE_SHARING = "android.modernProfileSharing";
private static final String VIEWED_RECEIPTS = "android.viewed.receipts";
private static final String MAX_ENVELOPE_SIZE = "android.maxEnvelopeSize";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -77,7 +78,8 @@ public final class FeatureFlags {
CLIENT_EXPIRATION,
RESEARCH_MEGAPHONE_1,
MODERN_PROFILE_SHARING,
VIEWED_RECEIPTS
VIEWED_RECEIPTS,
MAX_ENVELOPE_SIZE
);
/**
@@ -245,13 +247,16 @@ public final class FeatureFlags {
return getBoolean(MODERN_PROFILE_SHARING, false);
}
/**
* Whether the user should display the content revealed dot in voice notes.
*/
/** Whether the user should display the content revealed dot in voice notes. */
public static boolean viewedReceipts() {
return getBoolean(VIEWED_RECEIPTS, false);
}
/** The max size envelope that is allowed to be sent. */
public static int maxEnvelopeSize() {
return getInteger(MAX_ENVELOPE_SIZE, 0);
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);