{"record":{"id":"e04afe13f2f2f62e","repo":"gravitational/teleport","slug":"proto-createregisterchallengerequest-wiretype-en","errorCode":null,"errorMessage":"proto: CreateRegisterChallengeRequest: wiretype end group for non-group","messagePattern":"proto: CreateRegisterChallengeRequest: wiretype end group for non-group","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/client/proto/authservice.pb.go","lineNumber":60505,"sourceCode":"\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowAuthservice\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: CreateRegisterChallengeRequest: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: CreateRegisterChallengeRequest: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field TokenID\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowAuthservice\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]","sourceCodeStart":60487,"sourceCodeEnd":60523,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/api/client/proto/authservice.pb.go#L60487-L60523","documentation":"The generated Unmarshal for CreateRegisterChallengeRequest encountered an END_GROUP wire type (4) with no preceding START_GROUP. Since this message schema contains no groups, such bytes are structurally invalid and decoding aborts. This is generated-code protection against corrupt or mismatched wire data.","triggerScenarios":"Passing bytes containing a stray wire-type-4 tag to CreateRegisterChallengeRequest Unmarshal — from stream desync, corrupted frames, or a nonstandard encoder emitting proto2 group markers.","commonSituations":"Reading a payload from the middle of a multiplexed stream; truncated/reassembled TCP frames; fuzz testing; decoding another message type's serialized bytes as this request.","solutions":["Ensure Unmarshal receives exactly one complete message starting at byte 0 of the buffer","Use proper gRPC framing instead of manual stream slicing","Verify both endpoints run matching generated proto code","Re-produce the payload with proto.Marshal to replace suspect bytes"],"exampleFix":"// before: wrong offset into a framed stream\nerr := proto.Unmarshal(buf[3:], req)\n// after: frame with length prefixes\nmsgLen, n := binary.Uvarint(hdr)\nerr = proto.Unmarshal(buf[n:n+int(msgLen)], req)","handlingStrategy":"validation","validationCode":"func alignedMessageBoundary(b []byte) error {\n    if len(b) == 0 { return errors.New(\"empty payload\") }\n    tag, n := binary.Uvarint(b)\n    if n <= 0 { return errors.New(\"cannot decode leading tag: not at a message boundary\") }\n    if tag&0x7 == 4 { return errors.New(\"payload starts with END_GROUP; misaligned\") }\n    return nil\n}","typeGuard":"func isEndGroupError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"end group for non-group\")\n}","tryCatchPattern":"if err := proto.Unmarshal(buf, req); err != nil {\n    if isEndGroupError(err) {\n        return trace.BadParameter(\"stream framing desync detected; reset connection\")\n    }\n    return trace.Wrap(err)\n}","preventionTips":["Never slice into a stream at arbitrary offsets; use length-prefix framing","Reset the stream/connection after any decode error to avoid desync cascades","Ensure proxies preserve gRPC framing bytes untouched","Fuzz decoders with stray group tags in CI"],"tags":["protobuf","wire-format","malformed-data","deserialization"],"backgroundTag":"proto-malformed-wire-data","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}