mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 02:25:20 +00:00
Prevent spoofable plaintext messages from sliding into private chats (#428)
This commit is contained in:
@@ -3374,7 +3374,7 @@ class BluetoothMeshService: NSObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleReceivedPacket(_ packet: BitchatPacket, from peerID: String, peripheral: CBPeripheral? = nil) {
|
private func handleReceivedPacket(_ packet: BitchatPacket, from peerID: String, peripheral: CBPeripheral? = nil, decrypted: Bool = false) {
|
||||||
messageQueue.async(flags: .barrier) { [weak self] in
|
messageQueue.async(flags: .barrier) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
@@ -3688,6 +3688,11 @@ class BluetoothMeshService: NSObject {
|
|||||||
|
|
||||||
} else if isPeerIDOurs(recipientID.hexEncodedString()) {
|
} else if isPeerIDOurs(recipientID.hexEncodedString()) {
|
||||||
// PRIVATE MESSAGE FOR US
|
// PRIVATE MESSAGE FOR US
|
||||||
|
if (decrypted == false) {
|
||||||
|
//spoofing detected!!
|
||||||
|
SecureLogger.log("YIKES spoofing detected from \(senderID)", category: SecureLogger.encryption, level: .warning)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// No signature verification - broadcasts are not authenticated
|
// No signature verification - broadcasts are not authenticated
|
||||||
@@ -6888,7 +6893,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
|
|||||||
// The packet will be handled according to its recipient ID
|
// The packet will be handled according to its recipient ID
|
||||||
// If it's for us, it won't be relayed
|
// If it's for us, it won't be relayed
|
||||||
// Pass the peripheral context for proper ACK routing
|
// Pass the peripheral context for proper ACK routing
|
||||||
handleReceivedPacket(innerPacket, from: peerID, peripheral: peripheral)
|
handleReceivedPacket(innerPacket, from: peerID, peripheral: peripheral, decrypted: true)
|
||||||
} else {
|
} else {
|
||||||
SecureLogger.log("Failed to parse inner packet from decrypted data", category: SecureLogger.encryption, level: .warning)
|
SecureLogger.log("Failed to parse inner packet from decrypted data", category: SecureLogger.encryption, level: .warning)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user