bishop icon indicating copy to clipboard operation
bishop copied to clipboard

Add option to not consider redirects as a successful match

Open gsingh93 opened this issue 8 years ago • 5 comments

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.

gsingh93 avatar Sep 24 '15 18:09 gsingh93

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;
}

jkingsman avatar Sep 24 '15 19:09 jkingsman

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.

gsingh93 avatar Sep 25 '15 00:09 gsingh93

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.

jkingsman avatar Sep 25 '15 00:09 jkingsman

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.

gsingh93 avatar Nov 06 '15 08:11 gsingh93

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

jkingsman avatar Nov 06 '15 08:11 jkingsman