CloudEvent serializes invalid extension attribute names without validation
Repro:
from cloudevents.v1.http import CloudEvent
from cloudevents.v1.conversion import to_structured
event = CloudEvent(
{
"type": "example.event",
"source": "/test",
"example-extension": "123",
},
{"ok": True},
)
_, body = to_structured(event)
print(body)
Expected: construction or serialization rejects example-extension, because CloudEvents attribute names must only contain lowercase ASCII letters and digits.
Actual: the SDK serializes it successfully, producing an invalid CloudEvent. This can fail at runtime with stricter receivers such as Knative Eventing, which rejects the request with 400 Bad Request.
CloudEvent serializes invalid extension attribute names without validation
Repro:
Expected: construction or serialization rejects example-extension, because CloudEvents attribute names must only contain lowercase ASCII letters and digits.
Actual: the SDK serializes it successfully, producing an invalid CloudEvent. This can fail at runtime with stricter receivers such as Knative Eventing, which rejects the request with
400 Bad Request.