diff --git a/runtime/query.go b/runtime/query.go index fe634174b85..93fb09922fb 100644 --- a/runtime/query.go +++ b/runtime/query.go @@ -291,7 +291,11 @@ func parseMessage(msgDescriptor protoreflect.MessageDescriptor, value string) (p if err != nil { return protoreflect.Value{}, err } - msg = timestamppb.New(t) + timestamp := timestamppb.New(t) + if ok := timestamp.IsValid(); !ok { + return protoreflect.Value{}, fmt.Errorf("%s before 0001-01-01", value) + } + msg = timestamp case "google.protobuf.Duration": d, err := time.ParseDuration(value) if err != nil { diff --git a/runtime/query_test.go b/runtime/query_test.go index 16c11e946f3..5dfbbf5a34c 100644 --- a/runtime/query_test.go +++ b/runtime/query_test.go @@ -495,6 +495,14 @@ func TestPopulateParameters(t *testing.T) { want: &examplepb.Proto3Message{}, wanterr: errors.New("invalid path: \"repeated_message\" is not a message"), }, + { + values: url.Values{ + "timestampValue": {"0000-01-01T00:00:00.00Z"}, + }, + filter: utilities.NewDoubleArray(nil), + want: &examplepb.Proto3Message{}, + wanterr: errors.New(`parsing field "timestamp_value": 0000-01-01T00:00:00.00Z before 0001-01-01`), + }, } { t.Run(strconv.Itoa(i), func(t *testing.T) { msg := spec.want.ProtoReflect().New().Interface()