Skip to content

Commit

Permalink
PR feedback 1
Browse files Browse the repository at this point in the history
  • Loading branch information
pspieker-stripe committed Feb 15, 2024
1 parent 3216c7b commit 5530680
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/smokescreen/smokescreen.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,9 @@ func handleConnect(config *Config, pctx *goproxy.ProxyCtx) (string, error) {
return "", pctx.Error
}

/*
checkIfRequestShouldBeProxied can return an error if either the resolved address is disallowed,
or if there is a DNS resolution failure, or if the subsequent proxy host (specified by the
X-Https-Upstream-Proxy header in the CONNECT request to _this_ proxy) is disallowed.
*/
// checkIfRequestShouldBeProxied can return an error if either the resolved address is disallowed,
// or if there is a DNS resolution failure, or if the subsequent proxy host (specified by the
// X-Https-Upstream-Proxy header in the CONNECT request to _this_ proxy) is disallowed.
sctx.Decision, sctx.lookupTime, pctx.Error = checkIfRequestShouldBeProxied(config, pctx.Req, destination)
if pctx.Error != nil {
// DNS resolution failure
Expand Down Expand Up @@ -940,10 +938,8 @@ func checkACLsForRequest(config *Config, req *http.Request, destination hostport
// flow as in: client -(TLS)-> smokescreen -(TLS)-> external proxy -(TLS)-> destination.
// Without this header, there's no way for the client to specify a subsequent proxy.
var connectProxyHost string
if len(req.Header["X-Upstream-Https-Proxy"]) > 0 {
connectProxyHost = req.Header["X-Upstream-Https-Proxy"][0]
} else {
connectProxyHost = ""
if connectProxyHostSlice := req.Header.Get("X-Upstream-Https-Proxy"); len(connectProxyHostSlice) > 0 {
connectProxyHost = string(connectProxyHostSlice[0])
}

ACLDecision, err := config.EgressACL.Decide(role, destination.Host, connectProxyHost)
Expand Down

0 comments on commit 5530680

Please sign in to comment.