Skip to content

fix(kafka): ignore unrelated binary header values - #308

Merged
PlugaruT merged 1 commit into
cloudevents:mainfrom
zhanghao0806:fix/kafka-ignore-unrelated-binary-headers
Nov 1, 2026
Merged

PlugaruT merged 1 commit into
cloudevents:mainfrom
zhanghao0806:fix/kafka-ignore-unrelated-binary-headers

Conversation

@zhanghao0806

Copy link
Copy Markdown
Contributor

Description

Ignore unrelated Kafka header values when reading binary CloudEvents. Previously the reader decoded every header as UTF-8 before checking its name, so an application header such as correlation-bin: b'\xff\x00\xfe' prevented a valid event from being read.

Only ce_* and content-type values are decoded. Invalid UTF-8 in those CloudEvents headers still raises an error.

Fixes #306.

Validation

  • Regression before the fix: 2 failed, 54 passed in the Kafka binding tests.
  • Complete pytest -q: 879 passed, 18 xfailed.
  • Ruff lint/format, source MyPy, and git diff --check: passed.
  • MyPy including the existing Kafka test file reports the same six pre-existing errors on the base and patched versions; these are outside the added tests.
  • Tests exercise both from_binary and from_kafka; no live broker required or used.

Prepared with AI assistance; commits are signed off.

Signed-off-by: zhanghao <112082360+zhanghao0806@users.noreply.github.com>

@PlugaruT PlugaruT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM. Thanks

@PlugaruT
PlugaruT merged commit adfe3df into cloudevents:main Nov 1, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core Kafka binary reader decodes unrelated binary headers as UTF-8

2 participants