pipe-cd / pipe-cd/pipecd

Validate --address flag format in pipectl client options

Open Beginner friendly
#7,089 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.4k
Forks
364
Avg merge
1d 4h
Merged PRs (30d)
84

Description

What would you like to be added:

Add address format validation to Options.Validate() in pkg/app/pipectl/client/client.go to catch malformed --address values before they reach grpc.DialContext().

Proposed approach:

  1. Use net.SplitHostPort to validate standard host:port format (including IPv6 like [::1]:9000).
  2. If that fails, fall back to url.Parse for gRPC resolver URIs (e.g. dns:///localhost:9000).
  3. After both, verify the result has a non-empty host (for host:port) or scheme (for resolver URIs) — rejecting inputs that parse but carry no meaningful address, such as ://bad or localhost (missing port).
  4. Add table-driven unit tests using testify/assert covering valid, invalid, and edge cases.

Why is this needed:

Currently Options.Validate() only checks if --address is empty. Any non-empty malformed input passes through to grpc.DialContext(), producing cryptic multi-line transport errors like:

desc = "transport: Error while dialing: dial tcp: address localhost: missing port in address"

This is confusing for users and makes debugging harder. Since the Options struct is shared by all pipectl subcommands (application, deployment, encrypt, event, planpreview, transfer, plugin), this affects every pipectl user.

If this approach aligns with what you had in mind , I can proceed with the implementation . If you have a different approach in mind, I'm happy to adjust

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/app/pipectl/client/client.go at Options.Validate() and inspect nearby tests before running them. Add table-driven coverage for host:port, IPv6, resolver URIs, and malformed addresses using testify/assert. Done means invalid --address values are rejected before grpc.DialContext(), while valid addresses remain accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
cli, testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.