Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not consider redirects as a successful match #22

Open
gsingh93 opened this issue Sep 24, 2015 · 5 comments
Open

Add option to not consider redirects as a successful match #22

gsingh93 opened this issue Sep 24, 2015 · 5 comments

Comments

@gsingh93
Copy link

I've had multiple false positives because of sites that redirect URLs that don't exist to some default page. There should be an option to not consider redirects (status codes 301/302) to be successful rule matches.

@jkingsman
Copy link
Owner

Could you provide an example of a false matching URL for this, please? Per the code, only 200's should match:

From https://github.com/jkingsman/bishop/blob/master/src/js/content_script/content_script.js#L148:

if (req.status == 200) {
        if (pattern.test(req.responseText)) {
            addSiteAndAlert(url, ruleName);
        }
        return false;
}

@gsingh93
Copy link
Author

I can't give the URL because it's an internal company URL. I opened the dev console, switched to the network tab, went to internal.companywebsite.com/tool/cgi-bin, and it redirected with a 302 to internal.companywebsite.com/tool/prod, which is what it does for all URLs.

@jkingsman
Copy link
Owner

Hm; interesting. I'll do my best to replicate that then. Thanks for the info.

On Sep 24, 2015, at 5:11 PM, Gulshan Singh [email protected] wrote:

I can't give the URL because it's an internal company URL. I opened the dev console, switched to the network tab, went to internal.companywebsite.com/tool/cgi-bin, and it redirected with a 302 to internal.companywebsite.com/tool/prod, which is what it does for all URLs.


Reply to this email directly or view it on GitHub.

@gsingh93
Copy link
Author

gsingh93 commented Nov 6, 2015

I think I found the issue: https://stackoverflow.com/questions/8238727/how-to-prevent-ajax-requests-to-follow-redirects-using-jquery

So you'll never see a redirect with an XMLHttpRequest, only the status code after the redirect. Not sure what the proper workaround is.

@jkingsman
Copy link
Owner

Intriguing; good sleuthing. Not sure if there's a way around that, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants