Skip to content

Commit 561ae62

Browse files
committed
feat(grpc): add configurable maximum size limit for received gRPC messages
Signed-off-by: Jordan McClintock <jordan@defenseunicorns.com>
1 parent d290a51 commit 561ae62

6 files changed

Lines changed: 41 additions & 16 deletions

File tree

app/controlplane/internal/conf/controlplane/config/v1/conf.pb.go

Lines changed: 21 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/conf/controlplane/config/v1/conf.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ message Server {
174174
string addr = 2 [(buf.validate.field).string.min_len = 1];
175175
google.protobuf.Duration timeout = 3;
176176
TLS tls_config = 4;
177+
// Maximum size in bytes of received gRPC messages.
178+
// Defaults to 4MB (4194304) if not set. Use this to allow larger attestations.
179+
int32 max_recv_msg_size = 5;
177180
}
178181

179182
HTTP http = 1;

app/controlplane/internal/server/grpc.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"github.com/go-kratos/kratos/v2/transport/grpc"
4949
protovalidateMiddleware "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/protovalidate"
5050
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
51+
grpcLib "google.golang.org/grpc"
5152
)
5253

5354
type Opts struct {
@@ -89,14 +90,14 @@ type Opts struct {
8990
GroupSvc *service.GroupService
9091
ProjectSvc *service.ProjectService
9192
// Utils
92-
Logger log.Logger
93-
ServerConfig *conf.Server
94-
AuthConfig *conf.Auth
93+
Logger log.Logger
94+
ServerConfig *conf.Server
95+
AuthConfig *conf.Auth
9596
FederatedConfig *conf.FederatedAuthentication
9697
OperationAuthConfig *conf.OperationAuthorizationProvider
9798
BootstrapConfig *conf.Bootstrap
98-
Credentials credentials.ReaderWriter
99-
Validator protovalidate.Validator
99+
Credentials credentials.ReaderWriter
100+
Validator protovalidate.Validator
100101
}
101102

102103
var (
@@ -146,6 +147,10 @@ func NewGRPCServer(opts *Opts) (*grpc.Server, error) {
146147
}
147148
}
148149

150+
if v := opts.ServerConfig.Grpc.GetMaxRecvMsgSize(); v > 0 {
151+
serverOpts = append(serverOpts, grpc.Options(grpcLib.MaxRecvMsgSize(int(v))))
152+
}
153+
149154
srv := grpc.NewServer(serverOpts...)
150155
v1.RegisterWorkflowServiceServer(srv, opts.WorkflowSvc)
151156
v1.RegisterStatusServiceServer(srv, service.NewStatusService(opts.AuthSvc.AuthURLs.Login, Version, opts.CASClientUseCase, opts.BootstrapConfig))

deployment/chainloop/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Chainloop is an open source software supply chain control plane, a
77

88
type: application
99
# Bump the patch (not minor, not major) version on each change in the Chart Source code
10-
version: 1.369.0
10+
version: 1.369.1
1111
# Do not update appVersion, this is handled automatically by the release process
1212
appVersion: v1.93.2
1313

deployment/chainloop/templates/controlplane/configmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ data:
3131
grpc:
3232
addr: "0.0.0.0:{{ .Values.controlplane.containerPorts.grpc }}"
3333
timeout: 10s
34+
{{- if .Values.controlplane.grpcMaxRecvMsgSize }}
35+
max_recv_msg_size: {{ .Values.controlplane.grpcMaxRecvMsgSize }}
36+
{{- end }}
3437
{{- if include "controlplane.tls-secret-name" . }}
3538
tls_config:
3639
certificate: /data/server-certs/tls.crt

deployment/chainloop/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ controlplane:
141141
tag: "v1.93.2"
142142

143143

144+
## @param controlplane.grpcMaxRecvMsgSize Maximum size in bytes of received gRPC messages. Increase to allow larger attestations. Defaults to the gRPC standard 4MB (4194304) if not set.
145+
grpcMaxRecvMsgSize: ""
146+
144147
## @param controlplane.containerPorts.http controlplane HTTP container port
145148
## @param controlplane.containerPorts.grpc controlplane gRPC container port
146149
## @param controlplane.containerPorts.metrics controlplane prometheus metrics container port

0 commit comments

Comments
 (0)