-
Notifications
You must be signed in to change notification settings - Fork 0
Add buf.validate constraints for payload sizes and field bounds #4
Copy link
Copy link
Open
Labels
area/protoProto definitions, message design, or wire compatibility work.Proto definitions, message design, or wire compatibility work.good first issueSmall, well-scoped tasks for new contributors.Small, well-scoped tasks for new contributors.help wantedLooking for community contributions.Looking for community contributions.kind/featureNew functionality or enhancement request.New functionality or enhancement request.priority/highImportant issue to schedule soon.Important issue to schedule soon.
Metadata
Metadata
Assignees
Labels
area/protoProto definitions, message design, or wire compatibility work.Proto definitions, message design, or wire compatibility work.good first issueSmall, well-scoped tasks for new contributors.Small, well-scoped tasks for new contributors.help wantedLooking for community contributions.Looking for community contributions.kind/featureNew functionality or enhancement request.New functionality or enhancement request.priority/highImportant issue to schedule soon.Important issue to schedule soon.
Problem statement
The proto definitions contain no validation constraints despite having fields that clearly require bounds checking. No
buf.validateorprotovalidateintegration is present. All validation is deferred to runtime implementations, which may be inconsistent across the SDK, operator, and hub.Key unbounded fields:
AudioFrame.pcm,VideoFrame.payload,BinaryFrame.payload—byteswith no size limitmetadatamaps — no key/value count limittransports,partition_acks— unboundedrepeatedfieldsAudioFrame.sample_rate_hz,AudioFrame.channels— signedint32allowing negative valuesStreamEnvelope.chunk_index— no constraint relative tochunk_countProposed change
buf.validatedependency tobuf.yaml:VideoFrame,BinaryFrame,FlowControl.partition_acks,StreamEnvelopefields.Affected area
Compatibility / migration
Adding validation is additive — existing valid payloads will continue to pass. Payloads that exceed new bounds were never intended to be valid. Downstream consumers need to integrate
protovalidateruntime to enforce constraints.Additional context
The
coretemplating layer enforcesmaxTemplateValidationJSONBytes = 1MB, but the proto layer that feeds data into it has no equivalent limits. Defense-in-depth requires validation at the contract layer. Identified during security review.