Merged
Conversation
Contributor
Greptile SummaryThis PR adds TLS support to the gRPC client by detecting whether the target address ends with
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: "use tls on port 443" |
Comment on lines
+61
to
+65
| if strings.HasSuffix(grpcAddress, ":443") { | ||
| transportCreds = credentials.NewTLS(&tls.Config{}) | ||
| } else { | ||
| transportCreds = insecure.NewCredentials() | ||
| } |
Contributor
There was a problem hiding this comment.
Port-only TLS detection is fragile
TLS detection is keyed exclusively on :443 as a suffix. This means:
- Any gRPC endpoint using TLS on a non-standard port (e.g.,
8443) will silently fall back to an insecure connection. - Conversely, if a caller legitimately runs plaintext gRPC on port 443, the code will forcibly apply TLS and fail at connection time.
A more robust approach would be to accept an explicit TLS flag or infer it from the scheme prefix (e.g., https://):
// Option 1: accept a bool from the caller
func NewClient(ctx context.Context, rpcAddress, grpcAddress, chainID string, tlsEnabled bool) (*Chain, error) { ... }
// Option 2: scheme-based detection
useTLS := strings.HasPrefix(grpcAddress, "https://") || strings.HasSuffix(grpcAddress, ":443")At minimum, a comment explaining the convention would help future maintainers.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
mattac21
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.