Skip to content

Commit

Permalink
server: remove support for binary protobuf payloads in the HTTP endpo…
Browse files Browse the repository at this point in the history
…ints

For a couple of releases we've only ever used JSON over the HTTP
protocol. There is no need to support the binary protobuf encoding.

This patch removes that option, which also reduces the opportunity for
bugs in protobuf to be exploited.

Release note: None
  • Loading branch information
knz committed Jan 11, 2021
1 parent bd0ed16 commit 5bcd86f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
3 changes: 0 additions & 3 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,10 @@ func (s *Server) Start(ctx context.Context) error {
EmitDefaults: true,
Indent: " ",
}
protopb := new(protoutil.ProtoPb)
gwMux := gwruntime.NewServeMux(
gwruntime.WithMarshalerOption(gwruntime.MIMEWildcard, jsonpb),
gwruntime.WithMarshalerOption(httputil.JSONContentType, jsonpb),
gwruntime.WithMarshalerOption(httputil.AltJSONContentType, jsonpb),
gwruntime.WithMarshalerOption(httputil.ProtoContentType, protopb),
gwruntime.WithMarshalerOption(httputil.AltProtoContentType, protopb),
gwruntime.WithOutgoingHeaderMatcher(authenticationHeaderMatcher),
gwruntime.WithMetadata(forwardAuthenticationMetadata),
)
Expand Down
4 changes: 0 additions & 4 deletions pkg/util/httputil/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const (
JSONContentType = "application/json"
// AltJSONContentType is the alternate JSON content type.
AltJSONContentType = "application/x-json"
// ProtoContentType is the protobuf content type.
ProtoContentType = "application/x-protobuf"
// AltProtoContentType is the alternate protobuf content type.
AltProtoContentType = "application/x-google-protobuf"
// PlaintextContentType is the plaintext content type.
PlaintextContentType = "text/plain"
// GzipEncoding is the gzip encoding.
Expand Down

0 comments on commit 5bcd86f

Please sign in to comment.