Skip to content

Conversation

@bfivelson0101
Copy link

@bfivelson0101 bfivelson0101 commented Jan 16, 2026

This pr adds an option to inject custom grpc transport credentials into the connection. The primary reason for this is to provide a way to trust certificates that were issued by a custom ca. The current implementation allowed for the SystemCertPool or insecureSkipVerify as the only transport options.

Definition of Ready

  • I am happy with the code
  • Short description of the feature/issue is added in the pr description
  • PR is linked to the corresponding user story
  • Acceptance criteria are met
  • All open todos and follow ups are defined in a new ticket and justified
  • Deviations from the acceptance criteria and design are agreed with the PO and documented.
  • No debug or dead code
  • My code has no repetitions
  • Critical parts are tested automatically
  • Where possible E2E tests are implemented
  • Documentation/examples are up-to-date
  • All non-functional requirements are met
  • Functionality of the acceptance criteria is checked manually on the dev system.

@hifabienne hifabienne added the os-contribution This is a contribution from our open-source community label Jan 16, 2026
@bfivelson0101 bfivelson0101 changed the title Custom transport WithTransportCredentials Jan 16, 2026
@bfivelson0101 bfivelson0101 marked this pull request as ready for review January 16, 2026 14:33
Copilot AI review requested due to automatic review settings January 16, 2026 14:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for injecting custom gRPC transport credentials to enable connections with certificates issued by custom certificate authorities. Previously, only the system certificate pool or insecure skip verify were supported as transport options.

Changes:

  • Added WithTransportCredentials option to both pkg/client/zitadel and pkg/client packages
  • Modified transport option logic to prioritize custom credentials over default options
  • Added example implementations demonstrating custom CA usage with both admin and management APIs

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/client/zitadel/client.go Added transportCredentials field to Connection struct and WithTransportCredentials option function; modified transportOption to check for custom credentials first
pkg/client/client.go Added transportCredentials field to clientOptions, WithTransportCredentials option function, and modified newConnection to accept and use custom credentials
example/customCA/middleware/tokenTools.go Helper functions for creating JWT profile token sources with custom HTTP clients for CA trust
example/customCA/admin/admin.go Example demonstrating admin API usage with custom CA certificate
example/customCA/Management/management.go Example demonstrating management API usage with custom CA certificate

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ctx := context.Background()

//build tls config with custom CA
var tlsConfig = &tls.Config{}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tls.Config is initialized with default values, which may not enforce minimum TLS version requirements. For production use, consider explicitly setting MinVersion (e.g., tls.VersionTLS12 or tls.VersionTLS13) to ensure secure TLS connections. While this is example code, it sets a pattern that users might follow.

Suggested change
var tlsConfig = &tls.Config{}
var tlsConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
}

Copilot uses AI. Check for mistakes.
bfivelson0101 and others added 6 commits January 16, 2026 07:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mridang mridang self-assigned this Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

os-contribution This is a contribution from our open-source community

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants