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

[config/confighttp] Ensure Auth happens after compression #7574

Merged
merged 2 commits into from
May 2, 2023

Conversation

Aneurysm9
Copy link
Member

When request signing-based authentication extensions are used it is necessary to ensure that the Auth RoundTripper is the innermost as changes to the request by other RoundTrippers (such as compression or headers) may invalidate the request signature. This change will ensure that the Auth RoundTripper is invoked after all others and is followed directly by the http.Transport.

@Aneurysm9 Aneurysm9 requested review from a team and mx-psi April 26, 2023 16:23
When request signing-based authentication extensions are
used it is necessary to ensure that the Auth RoundTripper
is the innermost as changes to the request by other
RoundTrippers (such as compression or headers) may invalidate
the request signature.  This change will ensure that the Auth
RoundTripper is invoked after all others and is followed directly
by the http.Transport.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9257d7f) 91.19% compared to head (cc1ed64) 91.20%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7574   +/-   ##
=======================================
  Coverage   91.19%   91.20%           
=======================================
  Files         296      296           
  Lines       14441    14445    +4     
=======================================
+ Hits        13170    13174    +4     
  Misses       1006     1006           
  Partials      265      265           
Impacted Files Coverage Δ
config/confighttp/confighttp.go 88.95% <100.00%> (+0.27%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -336,15 +366,34 @@ func TestHTTPClientSettingWithAuthConfig(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
client, err := test.settings.ToClient(test.host, componenttest.NewNopTelemetrySettings())
// Omit TracerProvider and MeterProvider in TelemetrySettings as otelhttp.Transport cannot be introspected
client, err := test.settings.ToClient(test.host, component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone})
Copy link
Member

Choose a reason for hiding this comment

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

use componenttest to create the TelemetrySettings?

Copy link
Member Author

Choose a reason for hiding this comment

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

As noted in the comment the otelhttp.Transport doesn't export the RoundTripper that it wraps and so there would be no way to test the containment order beyond that transport if the componenttest.NewNopTelemetrySettings() were used.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
@codeboten codeboten merged commit 4df4437 into open-telemetry:main May 2, 2023
@github-actions github-actions bot added this to the next release milestone May 2, 2023
@Aneurysm9 Aneurysm9 deleted the fix/configHTTPAuth branch May 3, 2023 17:17
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.

3 participants