[codex] validate v1 compat attribute names#301
Draft
MickeyWzt wants to merge 1 commit into
Draft
Conversation
Signed-off-by: MickeyWzt <289528356+MickeyWzt@users.noreply.github.com>
xSAVIKx
reviewed
Jul 3, 2026
xSAVIKx
left a comment
Member
There was a problem hiding this comment.
@MickeyWzt thank you for the PR!
Your change only covers the v1 compatibility layer. Do you mind tackling the the cloudevents.core implementation as well? cloudevents.core is the v2 SDK rollout that we will keep moving forward while dropping the cloudevents.v1 package soon.
| _attribute_name_pattern = re.compile(r"^[a-z0-9]+$") | ||
|
|
||
|
|
||
| def _validate_attribute_name(name: str) -> None: |
Member
There was a problem hiding this comment.
Please add a link to the spec reference here to support this validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloudevents.v1.http.CloudEventcompatibility classInvalidAttributeNameexception for the legacy v1 APIWhy
CloudEvents attribute names must only contain lowercase ASCII letters and digits. The core v1 event model already rejects invalid extension names such as
example-extension, but the deprecatedcloudevents.v1.http.CloudEventcompatibility class accepted them and could serialize an invalid structured CloudEvent.Fixes #300.
Tests
uv run --with-editable . pytest tests/test_v1_compat/test_event_extensions.py -quv run --with-editable . pytest tests/test_core/test_v1/test_event.py tests/test_core/test_v03/test_event.py -quv run --with-editable . pytest tests/test_v1_compat -quv run ruff check src/cloudevents/v1/http/event.py src/cloudevents/v1/exceptions.py tests/test_v1_compat/test_event_extensions.pyuv run ruff format --check src/cloudevents/v1/http/event.py src/cloudevents/v1/exceptions.py tests/test_v1_compat/test_event_extensions.pyuv run --with-editable . pytest -q