Skip to content

Explicit forward proxy support for HTTP with Basic Auth #1201

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

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

Akshay2191
Copy link
Contributor

Proposed changes

Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords here in this description (not in the title of the PR).

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@Akshay2191 Akshay2191 requested a review from a team as a code owner August 7, 2025 16:26
@github-actions github-actions bot added chore Pull requests for routine tasks documentation Improvements or additions to documentation labels Aug 7, 2025
@dhurley dhurley added the v3.x Issues and Pull Requests related to the major version v3 label Aug 8, 2025
@Akshay2191 Akshay2191 requested review from dhurley and aphralG August 11, 2025 11:13
@Akshay2191 Akshay2191 requested a review from dhurley August 20, 2025 13:46

// Test missing username/password
proxyMissing := &config.Proxy{URL: "http://localhost:8080"}
setProxyWithBasicAuth(ctx, proxyMissing, u) // Should not panic
Copy link
Contributor

Choose a reason for hiding this comment

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

Could a check be added to this test to check that we get the log output we expect if its not set ?

Suggested change
setProxyWithBasicAuth(ctx, proxyMissing, u) // Should not panic
logBuf := &bytes.Buffer{}
stub.StubLoggerWith(logBuf)
// Test missing username/password
proxyMissing := &config.Proxy{URL: "http://localhost:8080"}
setProxyWithBasicAuth(ctx, proxyMissing, u)
helpers.ValidateLog(t, "Unable to configure OTLP exporter proxy, "+
"username or password missing for basic auth", logBuf)

return tlsConf, nil
}

//nolint:lll //This needs to be in a single line.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add more detail to the comment about why it needs to be a single line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I break this line into 2 either I am getting gofumpt error or compiler error.

}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
_, _ = DialViaHTTPProxy(ctx, proxyConf, "example.com:443")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the error returned here be checked ?

return false
}

func TestDialViaHTTPProxy_InvalidCAPath(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could TestDialViaHTTPProxy_InvalidCAPath TestDialViaHTTPProxy_MissingCertKey & TestDialViaHTTPProxy_InvalidProxyURL be one test with different test parameters in a struct ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks documentation Improvements or additions to documentation v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants