Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions oauth2/oidc_endpoint_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ func GetOIDCWellKnownEndpointsFromIssuerURL(issuerURL string) (*OIDCWellKnownEnd
if err != nil {
return nil, errors.Wrap(err, "could not parse issuer url to build well known endpoints")
}

// Validate URL scheme - only allow HTTPS to prevent SSRF attacks
if u.Scheme != "https" {
return nil, errors.New("issuer URL must use HTTPS scheme")
}

// Validate host is not empty
if u.Host == "" {
return nil, errors.New("issuer URL must have a host")
}

u.Path = path.Join(u.Path, ".well-known/openid-configuration")

r, err := http.Get(u.String())
Expand Down
7 changes: 3 additions & 4 deletions pulsar/negative_backoff_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ func (nbp *defaultNackBackoffPolicy) Next(redeliveryCount uint32) time.Duration
minNackTime := 1 * time.Second // 1sec
maxNackTime := 10 * time.Minute // 10min

backoff := float64(minNackTime << redeliveryCount)
if backoff == 0 {
// Overflow so we assign the maximum value of the backoff.
backoff = float64(maxNackTime)
if redeliveryCount >= 63 {
return maxNackTime
}

backoff := float64(minNackTime << redeliveryCount)
return time.Duration(math.Min(backoff, float64(maxNackTime)))
}