Skip to content

Conversation

@THardy98
Copy link
Contributor

@THardy98 THardy98 commented Dec 4, 2025

What was changed

DWISOTT

  1. Part of Assume TLS enabled if API key provided in SDKs features#687

  2. How was this tested:
    internals/credentials_test.go

  3. Any docs updates needed?
    Maybe

@THardy98 THardy98 requested a review from a team as a code owner December 4, 2025 04:54
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

(leaving main review to Go SDK owners, just a couple of notes here)

// TLS configures connection level security credentials.
TLS *tls.Config

// TLSDisabled explicitly disables TLS. When true, TLS will not be used even
Copy link
Member

Choose a reason for hiding this comment

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

When true, TLS will not be used

Reading the code here, this is not true, TLS will still be enable if the TLS field is set. IMO you should either 1) disallow both this being true and the TLS field being set (my preference), or 2) document that this being true means anything in the TLS field is ignored, and then respect that in code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I should've tested this. Added validation to make it mutually exclusive + test


func (apiKeyCredentials) applyToOptions(*ConnectionOptions) error { return nil }
func (apiKeyCredentials) applyToOptions(opts *ConnectionOptions) error {
// Auto-enable TLS when API key is provided and TLS is not explicitly set/disabled
Copy link
Member

Choose a reason for hiding this comment

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

Might as well document to users that we do this where API key is set by users (i.e. in the Godoc on the NewAPIKey* functions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a little line to the new api key methods noting the auto TLS behavior

@Quinn-With-Two-Ns
Copy link
Contributor

I'll note there is another approach where you instead add a method to Credentials like defaultTLS() *tls.Config and then provide different Credentials implementations that enable or disable TLS by default, but what you have here is fine other then @cretz comments.

@THardy98
Copy link
Contributor Author

THardy98 commented Dec 4, 2025

I'll note there is another approach where you instead add a method to Credentials like defaultTLS() *tls.Config and then provide different Credentials implementations that enable or disable TLS by default, but what you have here is fine other then @cretz comments.

Added validation to make TLS/TLSDisabled mutually exclusive + a test

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

LGTM, but would want to wait for Go SDK owner(s) approval. No preference on approach @Quinn-With-Two-Ns said vs what's here (hopefully it's rarely/never used anyways, heh)

@THardy98 THardy98 merged commit 85a0559 into master Dec 10, 2025
62 of 68 checks passed
@THardy98 THardy98 deleted the enable-tls-api-key branch December 10, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants