user.js icon indicating copy to clipboard operation
user.js copied to clipboard

Wiki: Conceal window.name has syntax error

Open quistor opened this issue 6 years ago • 9 comments

Look like Conceal window.name script from https://github.com/ghacksuserjs/ghacks-user.js/wiki/4.2.1-User-Scripts) has error which doesn't allow to enable it. Error located in: // @exclude /^https://www\.google\.com/recaptcha/api2/(?:anchor|frame)\?.+$/

According to it, template for excluding link is incorrectly done. Script manager ask it to follow pattern of /^(https?|wss?file|ftp|\*):\/\/(\^*|\*.[^*/]+|[^*/]+)\/.*$/

I am attaching error message error

Steps to reproduce rather simple:

  • Install script manager(tested with last version of Firemonkey and Tapermonkey)
  • Copy script from wiki page
  • Save script
  • try to enable it

quistor avatar Feb 10 '20 05:02 quistor

looking an old revision of that wiki page

this is what used to be in the script

if(/^https:\/\/www\.google\.com\/recaptcha\/api2\/(?:anchor|frame)\?.+$/.test(window.location.href)&&/^I[0-1]_[1-9][0-9]+$/.test(_window.name))

@earthlng wrote version 2.0, so I'll let him sort this out. This isn't my area, so I'd be useless anyway :) Thanks for reporting

Thorin-II avatar Feb 10 '20 11:02 Thorin-II

That script wouldn't work with Firemonkey even if I changed that exclude line because FM doesn't support exportFunction(). I'm not familiar with Tampermonkey. The script works fine with Greasemonkey but it's still easily detectable. I only wrote it because Pants felt that it's better than nothing but then he removed all his comments and now we're left with a subpar userscript and no explanation why it exists in the 1st place. If you want a more robust window.name protection you can use CanvasBlocker.

earthlng avatar Feb 10 '20 11:02 earthlng

I've edited the top line to say "tested in GM only"

Thorin-II avatar Feb 10 '20 11:02 Thorin-II

I removed the window.name script from the wiki page

earthlng avatar Feb 12 '20 12:02 earthlng

Why? The script works. The onus is on users to test the script (if it isn't GM). I'd rather it was put back (not everyone uses CanvasBlocker as an alternative). Please advise

Thorin-II avatar Feb 12 '20 12:02 Thorin-II

Before you edited your previous comment you said you'd rather remove that whole page. ??

Yes the script obviously works or I wouldn't have posted it but it only offers the most basic level of protection ie it's still easily detectable and a site can get the window.name if it looks in the right place. Why provide a half-baked userscript when there are better ways to get real window.name protection, like CB or hardened TC ?! AFAIK you can use CB and disable everything except the window.(name|opener) protection if you like. CB's window.opener uses a different method than my script but the end-result is probably the same

In the other issue you said you had problems with the window.opener script and that it didn't run correctly at document-start but never followed up or figured out why that was the case. If that's indeed still an issue (for some people) then that turns a more elaborate script like the window.name one from mostly useless to potentially dangerous!

earthlng avatar Feb 12 '20 13:02 earthlng

and a site can get the window.name if it looks in the right place

OK. Didn't know that. So, good, one less script and less shit for me/you to deal with 👍

Although we could just state that it's not perfect and only offers some protection - but fuck all that shit: been down that road of TMI


Yes, I don't want any scripts page TBH. I think the potential banana skins are legion (also another reason I removed GM/VM/FM from the extensions list)

Thorin-II avatar Feb 12 '20 14:02 Thorin-II

In the other issue you said you had problems with the window.opener script and that it didn't run correctly at document-start but never followed up or figured out why that was the case.

You closed the issue, which was my way of reminding myself. But I decided I didn't have time to work out why, and I'm using your extension: so in the end I'm not affected and I'm getting very selfish (no fucks given) and decided that it's not my problem. If you want me to troubleshoot why it fails in my FF setup, then open a ticket to remind me, and I'll do it: for all I know the cause could be a common combo

Thorin-II avatar Feb 12 '20 16:02 Thorin-II

If you want me to troubleshoot why it fails in my FF setup

that'd be great. I'll open that other issue again which served as your reminder

earthlng avatar Feb 12 '20 16:02 earthlng