How do you mask sensitive request params in gqlgen?

102 views Asked by At

I am currently using gqlgen and would like to log request parameters for error investigation purposes.

While I know how to access request parameters like below, I am concerned that this way may log sensitive information such as email addresses or passwords.

srv.SetErrorPresenter(func(ctx context.Context, err error) *gqlerror.Error {
    goc := graphql.GetOperationContext(ctx)

    fmt.Println(goc.Variables) // i can access request params here, but these might include sensitive data

    gqlErr := graphql.DefaultErrorPresenter(ctx, err)
    return gqlErr
})

Therefore, I believe data masking is necessary. What would be a good approach to handle this?

0

There are 0 answers