From c11f07f04b994eec5e3d5fb1f601a8b10a4b4611 Mon Sep 17 00:00:00 2001 From: Akshay2191 Date: Thu, 1 Oct 2026 14:10:26 +0100 Subject: [PATCH] fixed issue flaged by Codeql --- internal/collector/otel_collector_plugin.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/collector/otel_collector_plugin.go b/internal/collector/otel_collector_plugin.go index 51c7fdc94..dd4dfa68e 100644 --- a/internal/collector/otel_collector_plugin.go +++ b/internal/collector/otel_collector_plugin.go @@ -950,7 +950,14 @@ func (oc *Collector) setExporterProxyEnvVars(ctx context.Context) { // setProxyEnvs sets the HTTP_PROXY and HTTPS_PROXY environment variables and logs the action. func setProxyEnvs(ctx context.Context, proxyEnvURL, msg string) { - slog.DebugContext(ctx, msg, "url", proxyEnvURL) + logURL := proxyEnvURL + if u, err := url.Parse(proxyEnvURL); err == nil && u.User != nil { + u.User = nil + logURL = u.String() + } + + slog.DebugContext(ctx, msg, "url", logURL) + if setenvErr := os.Setenv("HTTPS_PROXY", proxyEnvURL); setenvErr != nil { slog.ErrorContext(ctx, "Failed to set OTLP exporter proxy environment variables", "error", setenvErr) }