Page MenuHomePhabricator

D12785.id42389.diff
No OneTemporary

D12785.id42389.diff

diff --git a/keyserver/src/push/crypto.js b/keyserver/src/push/crypto.js
--- a/keyserver/src/push/crypto.js
+++ b/keyserver/src/push/crypto.js
@@ -44,7 +44,6 @@
encryptedNotification.payload.blobHolder = blobHolder;
}
- encryptedNotification.payload.keyserverID = notification.payload.keyserverID;
encryptedNotification.topic = notification.topic;
encryptedNotification.sound = notification.aps.sound;
encryptedNotification.pushType = 'alert';
@@ -112,8 +111,10 @@
encryptedNotification.payload = {
...encryptedNotification.payload,
...notification.payload,
- encryptionFailed: 1,
+ ...senderDeviceDescriptor,
+ encryptionFailed: '1',
};
+
return {
notification: encryptedNotification,
payloadSizeExceeded: notificationSizeValidator
diff --git a/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java
--- a/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java
+++ b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java
@@ -132,10 +132,13 @@
Log.w("COMM", "Notification decryption failure.", e);
return;
}
- } else if ("1".equals(message.getData().get(ENCRYPTION_FAILED_KEY))) {
- Log.w(
- "COMM",
- "Received unencrypted notification for client with existing olm session for notifications");
+ } else if (
+ "1".equals(message.getData().get(ENCRYPTION_FAILED_KEY)) &&
+ StaffUtils.isStaffRelease()) {
+ displayErrorMessageNotification(
+ "Notification encryption failed on the keyserver. Please investigate",
+ "Unencrypted notification",
+ null);
}
String rescind = message.getData().get(RESCIND_KEY);
diff --git a/native/ios/NotificationService/NotificationService.mm b/native/ios/NotificationService/NotificationService.mm
--- a/native/ios/NotificationService/NotificationService.mm
+++ b/native/ios/NotificationService/NotificationService.mm
@@ -13,7 +13,7 @@
NSString *const backgroundNotificationTypeKey = @"backgroundNotifType";
NSString *const messageInfosKey = @"messageInfos";
NSString *const encryptedPayloadKey = @"encryptedPayload";
-NSString *const encryptionFailureKey = @"encryptionFailure";
+NSString *const encryptionFailedKey = @"encryptionFailed";
NSString *const collapseIDKey = @"collapseID";
NSString *const keyserverIDKey = @"keyserverID";
NSString *const blobHashKey = @"blobHash";
@@ -140,14 +140,16 @@
withPublicUserContent:[[UNNotificationContent alloc] init]];
return;
}
- } else if ([self shouldAlertUnencryptedNotification:content.userInfo]) {
- // In future this will be replaced by notification content
- // modification for DEV environment and staff members
- comm::Logger::log("NSE: Received erroneously unencrypted notitication.");
}
NSMutableArray *errorMessages = [[NSMutableArray alloc] init];
+ if ([self shouldAlertUnencryptedNotification:content.userInfo]) {
+ [errorMessages addObject:
+ @"Notification encryption failed on the keyserver. "
+ @"Please investigate!"];
+ }
+
// Step 2: notification persistence in a temporary storage
std::string persistErrorMessage;
try {
@@ -594,8 +596,8 @@
}
- (BOOL)shouldAlertUnencryptedNotification:(NSDictionary *)payload {
- return payload[encryptionFailureKey] &&
- [payload[encryptionFailureKey] isEqualToNumber:@(1)];
+ return comm::StaffUtils::isStaffRelease() && payload[encryptionFailedKey] &&
+ [payload[encryptionFailedKey] isEqualToString:@"1"];
}
- (std::unique_ptr<comm::NotificationsCryptoModule::BaseStatefulDecryptResult>)
diff --git a/web/cpp/SQLiteQueryExecutorBindings.cpp b/web/cpp/SQLiteQueryExecutorBindings.cpp
--- a/web/cpp/SQLiteQueryExecutorBindings.cpp
+++ b/web/cpp/SQLiteQueryExecutorBindings.cpp
@@ -312,8 +312,7 @@
"removeInboundP2PMessages",
&SQLiteQueryExecutor::removeInboundP2PMessages)
.function(
- "getRelatedMessagesWeb",
- &SQLiteQueryExecutor::getRelatedMessagesWeb);
+ "getRelatedMessagesWeb", &SQLiteQueryExecutor::getRelatedMessagesWeb);
}
} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 7:21 AM (21 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610814
Default Alt Text
D12785.id42389.diff (4 KB)

Event Timeline