-
Notifications
You must be signed in to change notification settings - Fork 21
💥 enable TLS if api key provided #366
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
Changes from all commits
60f9769
a1a4a61
b9c418a
22b9ed8
9f09c3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -154,8 +154,9 @@ class HTTPConnectProxyOptions; end # rubocop:disable Lint/EmptyClass | |||||||||||
| # +localhost:7233+. | ||||||||||||
| # @param api_key [String, nil] API key for Temporal. This becomes the +Authorization+ HTTP header with +"Bearer "+ | ||||||||||||
| # prepended. This is only set if RPC metadata doesn't already have an +authorization+ key. | ||||||||||||
| # @param tls [Boolean, TLSOptions] If false, do not use TLS. If true, use system default TLS options. If TLS | ||||||||||||
| # options are present, those TLS options will be used. | ||||||||||||
| # @param tls [Boolean, TLSOptions, nil] If false, do not use TLS. If true, use system default TLS options. If TLS | ||||||||||||
| # options are present, those TLS options will be used. If nil (the default), TLS will be auto-enabled if | ||||||||||||
| # api_key is provided. | ||||||||||||
| # @param rpc_metadata [Hash<String, String>] Headers to use for all calls to the server. Keys here can be | ||||||||||||
| # overriden by per-call RPC metadata keys. | ||||||||||||
| # @param rpc_retry [RPCRetryOptions] Retry options for direct service calls (when opted in) or all high-level | ||||||||||||
|
|
@@ -173,7 +174,7 @@ class HTTPConnectProxyOptions; end # rubocop:disable Lint/EmptyClass | |||||||||||
| def initialize( | ||||||||||||
| target_host:, | ||||||||||||
| api_key: nil, | ||||||||||||
| tls: false, | ||||||||||||
| tls: nil, | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit surprised/disappointed this didn't require that you change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||||
| rpc_metadata: {}, | ||||||||||||
| rpc_retry: RPCRetryOptions.new, | ||||||||||||
| identity: "#{Process.pid}@#{Socket.gethostname}", | ||||||||||||
|
|
@@ -285,13 +286,17 @@ def new_core_client | |||||||||||
| ), | ||||||||||||
| identity: @options.identity || "#{Process.pid}@#{Socket.gethostname}" | ||||||||||||
| ) | ||||||||||||
| if @options.tls | ||||||||||||
| options.tls = if @options.tls.is_a?(TLSOptions) | ||||||||||||
| # Auto-enable TLS when API key is provided and tls not explicitly set | ||||||||||||
| tls = @options.tls | ||||||||||||
| tls = true if tls.nil? && @options.api_key | ||||||||||||
|
|
||||||||||||
| if tls | ||||||||||||
|
Comment on lines
+290
to
+293
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Reads a bit easier to me, but up to you |
||||||||||||
| options.tls = if tls.is_a?(TLSOptions) | ||||||||||||
| Internal::Bridge::Client::TLSOptions.new( | ||||||||||||
| client_cert: @options.tls.client_cert, # steep:ignore | ||||||||||||
| client_private_key: @options.tls.client_private_key, # steep:ignore | ||||||||||||
| server_root_ca_cert: @options.tls.server_root_ca_cert, # steep:ignore | ||||||||||||
| domain: @options.tls.domain # steep:ignore | ||||||||||||
| client_cert: tls.client_cert, # steep:ignore | ||||||||||||
| client_private_key: tls.client_private_key, # steep:ignore | ||||||||||||
| server_root_ca_cert: tls.server_root_ca_cert, # steep:ignore | ||||||||||||
| domain: tls.domain # steep:ignore | ||||||||||||
| ) | ||||||||||||
| else | ||||||||||||
| Internal::Bridge::Client::TLSOptions.new | ||||||||||||
|
|
||||||||||||
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.
Should also update the YARD docs above the method for this param (and explain the runtime default)
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 seeing this diff
Uh oh!
There was an error while loading. Please reload this page.
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.
Above, there is:
It would change to:
Same as you did in the connection file. But not a big deal.