Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authz: create interceptors for gRPC security policy API #4664

Merged
merged 14 commits into from Sep 2, 2021
2 changes: 1 addition & 1 deletion authz/sdk_end2end_test.go
Expand Up @@ -295,7 +295,7 @@ func TestSDKEnd2End(t *testing.T) {
Body: []byte("hi"),
},
}
if err := stream.Send(req); err != nil {
if err := stream.Send(req); err != nil && err != io.EOF {
t.Fatalf("failed stream.Send err: %v", err)
}
_, err = stream.CloseAndRecv()
Expand Down
4 changes: 4 additions & 0 deletions internal/xds/rbac/rbac_engine.go
Expand Up @@ -32,12 +32,15 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
)

var logger = grpclog.Component("rbac")

var getConnection = transport.GetConnection

// ChainEngine represents a chain of RBAC Engines, used to make authorization
Expand Down Expand Up @@ -69,6 +72,7 @@ func (cre *ChainEngine) IsAuthorized(ctx context.Context) error {
// and then be used for the whole chain of RBAC Engines.
rpcData, err := newRPCData(ctx)
if err != nil {
logger.Errorf("missing fields in ctx %+v: %v", ctx, err)
return status.Errorf(codes.Internal, "missing fields in ctx %+v: %v", ctx, err)
dfawley marked this conversation as resolved.
Show resolved Hide resolved
}
for _, engine := range cre.chainedEngines {
Expand Down