-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: disable grpc reflection configuration #3550
base: main
Are you sure you want to change the base?
feat: disable grpc reflection configuration #3550
Conversation
d186ea6
to
3cf50f7
Compare
This change should not be made as it affects forward compatibility. It should be registered by default and optional not to register |
I see, but we should also ensure that users are not unknowingly enabling this feature and potentially exposing themselves to security risks without their consent. |
3cf50f7
to
7995a04
Compare
transport/grpc/server.go
Outdated
@@ -113,6 +113,13 @@ func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption { | |||
} | |||
} | |||
|
|||
// DisuseReflection disuse reflection. | |||
func DisuseReflection(enable bool) ServerOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need to pass the enable
parameter when the method is called Disuse
Also, usually disable
is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's my mistake
transport/grpc/server.go
Outdated
} | ||
|
||
// NewServer creates a gRPC server by options. | ||
// By default, it will register gRPC reflection and gRPC admin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This annotation should not be added here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where to add annotations properly, please guide me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be placed on the newly added method or in the document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add an annotation in kratos-layout about that grpc admin and grpc reflection are registered.
7995a04
to
84eb06b
Compare
transport/grpc/server.go
Outdated
@@ -113,6 +113,13 @@ func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption { | |||
} | |||
} | |||
|
|||
// DisuseReflection disuse reflection. | |||
func DisuseReflection() ServerOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually use Disable
84eb06b
to
b4fed5e
Compare
b4fed5e
to
90a5088
Compare
90a5088
to
77ff1c1
Compare
Description (what this PR does / why we need it):
For security reasons, grpc reflection should not be registered directly by default