Categorygithub.com/tumelohq/grpc-middleware
modulepackage
0.0.0-20220713174212-f65aa10d749a
Repository: https://github.com/tumelohq/grpc-middleware.git
Documentation: pkg.go.dev

# README

grpc-mask

GoDoc

A gRPC interceptor to mask errors.

This piece of middleware intends to stop sensitive information from being returned to calling services. Pass in a list of codes you wish to mask, and they shall all be returned as internal server errors, with no further information.

Go get

go get github.com/tumelohq/grpc-middleware/...

Usage

Have a look at the test, we spin up an entire client and server, and plug the middleware in.

Masking

This masks all internal and unknown errors, hiding potentially damaging and sensitive information.

interceptor := grpc.UnaryInterceptor(
    grpcmask.UnaryServerInterceptor(
        codes.Internal,
        codes.Unknown,
    ),
)

Mapping

This maps from one error to another. In this snippet we are mapping Unknown errors to Internal.

interceptor := grpc.UnaryInterceptor(
    grpcmap.UnaryServerInterceptor(map[codes.Code]codes.Code{
        codes.Unknown: codes.Internal,
    }),
)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author