mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 20:25:19 +00:00
Remove stale message-type whitelist from InputValidator: rely on MessageType/NoisePayloadType at decode to prevent drift
This commit is contained in:
@@ -81,17 +81,8 @@ struct InputValidator {
|
||||
|
||||
// MARK: - Protocol Field Validation
|
||||
|
||||
/// Validates message type is within valid range
|
||||
static func validateMessageType(_ type: UInt8) -> Bool {
|
||||
// Check against known message types
|
||||
let validTypes: Set<UInt8> = [
|
||||
0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0A, 0x0B, 0x0C,
|
||||
0x10, 0x11, 0x12, 0x13,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
||||
0x30, 0x31
|
||||
]
|
||||
return validTypes.contains(type)
|
||||
}
|
||||
// Note: Message type validation is performed closer to decoding using
|
||||
// MessageType/NoisePayloadType enums; keeping validator free of stale lists.
|
||||
|
||||
/// Validates hop count is reasonable
|
||||
static func validateHopCount(_ hopCount: UInt8) -> Bool {
|
||||
@@ -139,4 +130,4 @@ private extension Character {
|
||||
var isHexDigit: Bool {
|
||||
return "0123456789abcdefABCDEF".contains(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user