Recaptcha without allowing entire google.com domain

Ask for help about NoScript, no registration needed to post
ultramage
Posts: 9
Joined: Thu May 23, 2013 3:12 pm

Recaptcha without allowing entire google.com domain

Post by ultramage »

A lot of sites include the google recaptcha script. Unfortunately, it does not have its own subdomain, but is hosted directly on google.com. Whitelisting the whole google.com domain is not funny. Can this be sorted out somehow within the current NoScript framework?
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Recaptcha without allowing entire google.com domain

Post by barbaz »

Allow google.com in script blocking, then use ABE to allow only select google scripts -

Code: Select all

Site <whatever-google.com-stuff-recaptcha-needs>
Accept

Site .google.com
Deny INC(SCRIPT, OBJ, FONT, XHR, MEDIA)
Sandbox
Replace <whatever-google.com-stuff-recaptcha-needs> with the scripts you want to allow. See ABE Rules .pdf for how to specify it.
*Always* check the changelogs BEFORE updating that important software!
-
ultramage
Posts: 9
Joined: Thu May 23, 2013 3:12 pm

Re: Recaptcha without allowing entire google.com domain

Post by ultramage »

I only spent a few minutes on it, but "Site ^https://www.google.com/recaptcha/" is good enough for me. Thank you very much for this info.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
barbaz
Senior Member
Posts: 10847
Joined: Sat Aug 03, 2013 5:45 pm

Re: Recaptcha without allowing entire google.com domain

Post by barbaz »

You're welcome.
ultramage wrote:"Site ^https://www.google.com/recaptcha/"
In regex, a plain . means 'any character', so your Site line would match e.g. "https://www-google.com/recaptcha/". So you might want to change it to this -

Code: Select all

Site ^https://www\.google\.com/recaptcha/
*Always* check the changelogs BEFORE updating that important software!
-
ultramage
Posts: 9
Joined: Thu May 23, 2013 3:12 pm

Re: Recaptcha without allowing entire google.com domain

Post by ultramage »

I have a followup to this. Whenever a captcha loads, the firefox debugger reports

Code: Select all

CustomError: Jsloader error (code #0): Error while loading script //www.google.com/js/bg/<long string that triggers forum antispam>.js
Failing to load this out-of-scope script causes the google server to request 5+ valid answers before accepting, compared to the usual 1-2 if the script is allowed.
I wish NoScript would ship with a narrowly scoped surrogate-like thing that deals with these sorts of shenanigans. Or that google made their recaptcha easier to whitelist.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Post Reply