Skip to content

Security: Division-by-zero panic when computing EventHub partition key#4240

Open
tomaioo wants to merge 1 commit into
PeerDB-io:mainfrom
tomaioo:fix/security/division-by-zero-panic-when-computing-ev
Open

Security: Division-by-zero panic when computing EventHub partition key#4240
tomaioo wants to merge 1 commit into
PeerDB-io:mainfrom
tomaioo:fix/security/division-by-zero-panic-when-computing-ev

Conversation

@tomaioo

@tomaioo tomaioo commented Apr 25, 2026

Copy link
Copy Markdown

Summary

Security: Division-by-zero panic when computing EventHub partition key

Problem

Severity: Medium | File: flow/connectors/eventhub/partition_hash.go:L17

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).

Solution

Validate numPartitions > 0 before 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)

`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>
@tomaioo
tomaioo had a problem deploying to external-contributor April 25, 2026 12:24 — with GitHub Actions Failure
@tomaioo
tomaioo had a problem deploying to external-contributor April 25, 2026 12:24 — with GitHub Actions Failure
@tomaioo
tomaioo had a problem deploying to external-contributor April 25, 2026 12:24 — with GitHub Actions Failure
@tomaioo
tomaioo had a problem deploying to external-contributor April 25, 2026 12:24 — with GitHub Actions Failure
@tomaioo
tomaioo had a problem deploying to external-contributor April 25, 2026 12:24 — with GitHub Actions Failure
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecated destination connector

This issue or pull request relates to a deprecated destination connector (Snowflake, BigQuery, ElasticSearch, Kafka, Redpanda, Confluent, Azure Event Hubs, Google Pub/Sub, or S3).

These destinations are no longer actively maintained, but remain functional. We are unlikely to prioritize new work here.

Note: BigQuery is deprecated only as a destination — it remains a supported source.

If you depend on one of these connectors, we recommend:

  • Pin to a known-good PeerDB version so behavior stays stable.
  • Fork the repository if you need to carry your own changes.

See the deprecated connectors documentation for details and migration guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants