Skip to content

Fix: Reject URIs with embedded NUL bytes - #98

Merged
pniedzielski merged 2 commits into
bloomberg:mainfrom
pniedzielski:fix/uri-embedded-nul
Sep 4, 2026
Merged

pniedzielski merged 2 commits into
bloomberg:mainfrom
pniedzielski:fix/uri-embedded-nul

Conversation

@pniedzielski

Copy link
Copy Markdown
Contributor

This pull requests adds checks in two places for URI strings with embedded NUL bytes in them: at the Cython layer, and at the Python layer. This ensures that the C++ layer, which traffics in NUL-terminated strings, does not accidentally treat such a string as shorter than the Python code intended. It also includes tests to verify that if embedded NUL bytes are found, exceptions are raised.

This patch adds checks at each place in the Cython layer that accepts
a URI (broker endpoint or queue URI) and verifies that there is no
embedded NUL byte in the the URI string.  If the URI string does
contain an embedded NUL byte, an exception is raised.  This patch also
adds several new tests to verify this.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
This patch adds checks at each place in the Python layer that accepts
a URI (broker endpoint or queue URI) and verifies that there is no
embedded NUL byte in the the URI string.  If the URI string does
contain an embedded NUL byte, an exception is raised.  This patch also
adds several new tests to verify this.

In principle, we are okay to rely on the change in the last patch to
prevent this bug, but it is better to be explicit about what we
consider an error at each layer, in case the code ever changes.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
@pniedzielski
pniedzielski requested a review from a team August 31, 2026 22:00
@pniedzielski pniedzielski added bug Something isn't working skip news No news entry is required labels Aug 31, 2026
@pniedzielski
pniedzielski requested a review from hallfox September 1, 2026 14:15
@pniedzielski
pniedzielski merged commit eaabd7f into bloomberg:main Sep 4, 2026
30 of 31 checks passed
@pniedzielski
pniedzielski deleted the fix/uri-embedded-nul branch September 4, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working skip news No news entry is required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants