Skip to content

Commit 1fea1ed

Browse files
fix(pyroscope): url.PathEscape build ID in debuginfo upload URL
Addresses review comment on PR #6037: escape the build_id path segment as a safeguard when constructing the Upload URL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 61eee87 commit 1fea1ed

File tree

1 file changed

+7
-7
lines changed
  • internal/component/pyroscope/write

1 file changed

+7
-7
lines changed

internal/component/pyroscope/write/write.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ type EndpointOptions struct {
8282

8383
func GetDefaultEndpointOptions() EndpointOptions {
8484
defaultEndpointOptions := EndpointOptions{
85-
RemoteTimeout: 10 * time.Second,
86-
DebugInfoUploadTimeout: 2 * time.Minute,
87-
MinBackoff: 500 * time.Millisecond,
88-
MaxBackoff: 5 * time.Minute,
89-
MaxBackoffRetries: 10,
90-
HTTPClientConfig: config.CloneDefaultHTTPClientConfig(),
85+
RemoteTimeout: 10 * time.Second,
86+
DebugInfoUploadTimeout: 2 * time.Minute,
87+
MinBackoff: 500 * time.Millisecond,
88+
MaxBackoff: 5 * time.Minute,
89+
MaxBackoffRetries: 10,
90+
HTTPClientConfig: config.CloneDefaultHTTPClientConfig(),
9191
}
9292

9393
return defaultEndpointOptions
@@ -763,7 +763,7 @@ func (c *DebugInfoClient) Upload(ctx context.Context, buildID string, body io.Re
763763
ctx, cancel := context.WithTimeout(ctx, c.UploadTimeout)
764764
defer cancel()
765765
t1 := time.Now()
766-
uploadURL := strings.TrimRight(c.BaseURL, "/") + "/debuginfo.v1alpha1.DebuginfoService/Upload/" + buildID
766+
uploadURL := strings.TrimRight(c.BaseURL, "/") + "/debuginfo.v1alpha1.DebuginfoService/Upload/" + url.PathEscape(buildID)
767767
req, err := http.NewRequestWithContext(ctx, "POST", uploadURL, body)
768768
if err != nil {
769769
return err

0 commit comments

Comments
 (0)