Skip to content
Open
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
17 changes: 17 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ func (c *httpClient) RequestURL(u *url.URL) (*http.Response, error) {
if err != nil {
return resp, err
}
// Check if we can bypass auth checks via X-Forwarded-For & X-Real-IP
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a flag to enable/disable this, as it could greatly increase number of requests.

if (resp.StatusCode>= 400) && (resp.StatusCode <600){
switch resp.StatusCode{
case 401,403,504,511:
req = c.makeRequest(u, method)
req.Header.Add("X-Forwarded-For","127.0.0.1")
req.Header.Add("X-Real-IP" ,"127.0.0.1")
resp_temp, err := c.Client.Do(req)
if (err == nil) && (resp_temp.StatusCode>=200) && (resp_temp.StatusCode<400){

logging.Logf(logging.LogWarning,"Pontential AUTH BYPASS in " + u.String() + " via X-Forwarded-For/X-Real-IP: 127.0.0.1")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential.

}

default:

}
}
// Handle an authentication required response
if resp.StatusCode == 401 {
authHeader := resp.Header.Get("WWW-Authenticate")
Expand Down