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

Whitelist: selector middleware doesn't work for bidirectional grpc #3376

Closed
akoserwal opened this issue Jul 19, 2024 · 4 comments
Closed

Whitelist: selector middleware doesn't work for bidirectional grpc #3376

akoserwal opened this issue Jul 19, 2024 · 4 comments
Labels

Comments

@akoserwal
Copy link
Contributor

akoserwal commented Jul 19, 2024

What happened:

As shown for HTTP middleware the selector middleware works, but not the case with grpc
https://github.com/go-kratos/beer-shop/blob/a29eae57a9baeae9969e9a7d418ff677cf494a21/app/shop/interface/internal/server/http.go#L41

How to reproduce it (as minimally and precisely as possible):

Adding selector middleware as shown https://github.com/go-kratos/beer-shop/blob/a29eae57a9baeae9969e9a7d418ff677cf494a21/app/shop/interface/internal/server/http.go#L41
for grpc middleware

Anything else we need to know?:

https://github.com/go-kratos/kratos/blob/main/middleware/selector/selector.go#L92

Selector middleware works for unary, server streaming . but it doesn't work in case of "bidirectional streaming rpc". I was using grpcurl commandline utility which by default uses bidirectional streaming rpc.

operation := info.Operation()
value of the operation in case of grpc would give grpc.reflection.v1.ServerReflection/ServerReflectionInfo
which doesn't give info about method called.

Environment:

  • Kratos version (use kratos -v): v2.7.3
  • Go version (use go version): 1.21
  • OS (e.g: cat /etc/os-release): Darwin
  • Others:
@akoserwal akoserwal added the bug Something isn't working label Jul 19, 2024
@shenqidebaozi
Copy link
Member

@akoserwal grpc.reflection.v1.ServerReflection/ServerReflectionInfo is a streaming RPC that has been previously discussed and cannot be overwritten by middleware at this time. I will also carefully review the previous communication recently.

@shenqidebaozi shenqidebaozi added feature and removed bug Something isn't working labels Jul 22, 2024
Copy link

dosubot bot commented Nov 19, 2024

Hi, @akoserwal. I'm Dosu, and I'm helping the Kratos team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The issue involves the selector middleware in Kratos, which works for HTTP but not for gRPC, particularly in bidirectional streaming RPCs.
  • The middleware does not provide method information for gRPC operations, as observed with grpcurl.
  • The issue is specific to Kratos version v2.7.3 and Go version 1.21 on Darwin OS.
  • @shenqidebaozi noted that grpc.reflection.v1.ServerReflection/ServerReflectionInfo is a streaming RPC that cannot be modified by middleware and suggested reviewing past discussions.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Kratos repository. If so, you can keep the discussion open by commenting on the issue.
  • If there is no further activity, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 19, 2024
@akoserwal akoserwal changed the title Whitelist: selector middleware doesn't work for grpc Whitelist: selector middleware doesn't work for bidirectional grpc Nov 26, 2024
@akoserwal
Copy link
Contributor Author

grpc.reflection.v1.ServerReflection/ServerReflectionInfo is a streaming RPC that has been previously discussed and cannot be overwritten by middleware. Selector works in case of unidirectional gRPC

Copy link

dosubot bot commented Nov 26, 2024

Thank you, akoserwal, for closing the issue! We appreciate your help in keeping the repository tidy.

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants