Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Added `x-sf-meta` header to pass arbitrary metadata as trusted headers.

### Changed

* Demote the `non-gRPC error` auth-middleware log from `Error` to `Debug` in both `middleware/connect` and `middleware/grpc` — a client failing to authenticate is not a server error, and at `Error` it flooded logs and error-rate alerts. Genuine auth-service failures (`Internal`, `Unavailable`, `Unknown`) still log at `Error`.

## 2020-03-21

### Changed
Expand Down
5 changes: 4 additions & 1 deletion middleware/connect/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ func obfuscateErrorMessage(ctx context.Context, err error, logger *zap.Logger) e
}
return connect.NewError(connect.Code(st.Code()), errors.New(msg))
} else {
logger.Check(level, "authentication service via Connect-Web middleware non-gRPC error").Write(zap.Error(err))
// A non-gRPC error here means the authenticator rejected the request itself (missing/malformed
// credentials, expired token, unknown API key). That's a client-side condition, not a server
// fault, so it must not pollute error logs nor error-rate alerting.
logger.Debug("authentication service via Connect-Web middleware non-gRPC error", zap.Error(err))

if v := (*dauth.ErrInvalidAuthentication)(nil); errors.As(err, &v) {
return connect.NewError(connect.Code(codes.Unauthenticated), errors.New(v.Error()))
Expand Down
5 changes: 4 additions & 1 deletion middleware/grpc/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func obfuscateErrorMessage(err error, logger *zap.Logger) error {
}
return status.Error(st.Code(), msg)
} else {
logger.Error("authentication service via gRPC middleware non-gRPC error", zap.Error(err))
// A non-gRPC error here means the authenticator rejected the request itself (missing/malformed
// credentials, expired token, unknown API key). That's a client-side condition, not a server
// fault, so it must not pollute error logs nor error-rate alerting.
logger.Debug("authentication service via gRPC middleware non-gRPC error", zap.Error(err))
}

return status.Errorf(codes.Unauthenticated, "authentication: %s", err.Error())
Expand Down
Loading