Skip to content

Commit bce0bd5

Browse files
committed
fix: throw on invalid base64, default unknown filter ops to false
1 parent 6b47b0e commit bce0bd5

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Plugins/DynamoDBDriverPlugin/DynamoDBConnection.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ extension DynamoDBAttributeValue: Codable {
3434
} else if let value = try container.decodeIfPresent(String.self, forKey: .n) {
3535
self = .number(value)
3636
} else if let value = try container.decodeIfPresent(String.self, forKey: .b) {
37-
self = .binary(Data(base64Encoded: value) ?? Data())
37+
guard let data = Data(base64Encoded: value) else {
38+
throw DecodingError.dataCorruptedError(forKey: .b, in: container, debugDescription: "Invalid base64 string")
39+
}
40+
self = .binary(data)
3841
} else if let value = try container.decodeIfPresent(Bool.self, forKey: .bool) {
3942
self = .bool(value)
4043
} else if let value = try container.decodeIfPresent(Bool.self, forKey: .null), value {

Plugins/DynamoDBDriverPlugin/DynamoDBPluginDriver.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,8 @@ final class DynamoDBPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
12271227
if let d1 = Double(str), let d2 = Double(value) { return d1 <= d2 }
12281228
return str <= value
12291229
default:
1230-
return true
1230+
Self.logger.warning("Unknown filter operator: \(op)")
1231+
return false
12311232
}
12321233
}
12331234

0 commit comments

Comments
 (0)