From 498e77565b2c9d2a549fb2c2abb85bf27b4ebde2 Mon Sep 17 00:00:00 2001 From: tomaioo Date: Sat, 25 Apr 2026 05:24:06 -0700 Subject: [PATCH] fix(security): division-by-zero panic when computing eventhub par `HashedPartitionKey` performs `hash % numPartitions` without validating `numPartitions`. If `numPartitions` is 0 (from bad config or upstream input), this will panic and can crash the process (DoS). Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com> --- flow/connectors/eventhub/partition_hash.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flow/connectors/eventhub/partition_hash.go b/flow/connectors/eventhub/partition_hash.go index 6445f3281..f8ebe56fa 100644 --- a/flow/connectors/eventhub/partition_hash.go +++ b/flow/connectors/eventhub/partition_hash.go @@ -14,6 +14,10 @@ func hashString(s string) uint32 { } func HashedPartitionKey(s string, numPartitions uint32) string { + if numPartitions == 0 { + return "0" + } + partition := hashString(s) % numPartitions return strconv.FormatUint(uint64(partition), 10) }