Skip to content

Commit

Permalink
Merge pull request #2389 from nspcc-dev/oracle/auto-redirect
Browse files Browse the repository at this point in the history
services: forbid https -> http Oracle request auto-redirect
  • Loading branch information
roman-khimov authored May 11, 2022
2 parents d158811 + d88ca10 commit f3802c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/services/oracle/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func getDefaultClient(cfg config.OracleConfiguration) *http.Client {
if len(via) > maxRedirections { // from https://github.com/neo-project/neo-modules/pull/698
return fmt.Errorf("%w: %d redirections are reached", ErrRestrictedRedirect, maxRedirections)
}
if len(via) > 0 && via[0].URL.Scheme == "https" && req.URL.Scheme != "https" {
lastHop := via[len(via)-1].URL
return fmt.Errorf("%w: redirected from secure URL %s to insecure URL %s", ErrRestrictedRedirect, lastHop, req.URL)
}
return nil
}
return &client
Expand Down

0 comments on commit f3802c3

Please sign in to comment.