Security: Division-by-zero panic when computing EventHub partition key#4240
Security: Division-by-zero panic when computing EventHub partition key#4240tomaioo wants to merge 1 commit into
Conversation
`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>
|
|
|
Summary
Security: Division-by-zero panic when computing EventHub partition key
Problem
Severity:
Medium| File:flow/connectors/eventhub/partition_hash.go:L17HashedPartitionKeyperformshash % numPartitionswithout validatingnumPartitions. IfnumPartitionsis 0 (from bad config or upstream input), this will panic and can crash the process (DoS).Solution
Validate
numPartitions > 0before modulo. Prefer changing the function signature to return(string, error)and return a validation error for zero partitions.Changes
flow/connectors/eventhub/partition_hash.go(modified)