-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
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>
813c008
to
331e786
Compare
Codecov ReportPatch coverage:
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
☔ View full report in Codecov by Sentry. |
@@ -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}) |
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.
use componenttest to create the TelemetrySettings?
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.
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>
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.