Skip to content
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

Fix: Prevent unintended use of proxy authorization when no command is provided #4217

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

fg91
Copy link
Member

@fg91 fg91 commented Oct 13, 2023

Describe your changes

@andrewwdye noticed that the newly introduced proxy authorization in the admin client breaks propeller, see #4216 (comment).

I ran flytepropeller locally in a debugger (with the flyte-core helm chart deployed in the cluster and flyteadmin and datacatalog port-forwarded).

With the debugger, I confirmed that this if statement which adds proxy authorization is hit even if no proxy command is provided in the platform config.

The reason is that I check for cfg.ProxyCommand != nil but the default value of proxy command is empty string slice so it is never nil.

With flytepropeller running locally in my IDE, I confirmed that:

  1. with the fix introduced by this PR, the error reported by @andrewwdye is gone and that workflows can be executed again
  2. that if one does configure a proxy command, that the proxy auth interceptor is still added to the dial options

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (da77476) 59.04% compared to head (97e7792) 78.41%.
Report is 1 commits behind head on master.

❗ Current head 97e7792 differs from pull request most recent head 196b71b. Consider uploading reports for the commit 196b71b to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4217       +/-   ##
===========================================
+ Coverage   59.04%   78.41%   +19.36%     
===========================================
  Files         621       18      -603     
  Lines       53091     1297    -51794     
===========================================
- Hits        31348     1017    -30331     
+ Misses      19244      217    -19027     
+ Partials     2499       63     -2436     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
flyteidl/clients/go/admin/auth_interceptor.go 73.75% <100.00%> (ø)
flyteidl/clients/go/admin/client.go 84.68% <0.00%> (ø)

... and 637 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fg91 fg91 self-assigned this Oct 13, 2023
@fg91 fg91 added the bug Something isn't working label Oct 13, 2023
@fg91 fg91 marked this pull request as ready for review October 13, 2023 02:10
Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

actually can we make this

@@ -109,7 +109,7 @@ func setHTTPClientContext(ctx context.Context, cfg *Config, proxyCredentialsFutu
transport.Proxy = http.ProxyURL(&cfg.HTTPProxyURL.URL)
}

if cfg.ProxyCommand != nil {
if len(cfg.ProxyCommand) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if len(cfg.ProxyCommand) > 0 {
if cfg.ProxyCommand != nil && len(cfg.ProxyCommand) > 0 {

Copy link
Member Author

Choose a reason for hiding this comment

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

@fg91 fg91 requested a review from wild-endeavor October 13, 2023 03:16
Copy link
Contributor

@andrewwdye andrewwdye left a comment

Choose a reason for hiding this comment

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

I was able to build an image and verify this addressed the original problem. Thanks!

@fg91
Copy link
Member Author

fg91 commented Oct 13, 2023

I was able to build an image and verify this addressed the original problem. Thanks!

Thanks for verifying!

@fg91 fg91 merged commit 2edc3bd into master Oct 13, 2023
@fg91 fg91 deleted the fg91/fix/accidental-proxy-auth-use branch October 13, 2023 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants