[RESOLVED] NoScript breaks Web Sockets on Firefox

Ask for help about NoScript, no registration needed to post
bazwal
Posts: 3
Joined: Sat Nov 26, 2016 7:24 pm

[RESOLVED] NoScript breaks Web Sockets on Firefox

Post by bazwal »

I have been using a GreaseMonkey script on Firefox for several years that uses Web Sockets. But after the NoScript v.2.9.5 update, I can no longer connect to Web Sockets. If I downgrade NoScript to v.2.9.0.14, the problem goes away.

I have tried NS v2.9.5.2rc2, and also downgrading to some of the recent rc versions of NS, but they all have the same problem (v2.9.5rc24 was the earliest one I was able to try). I have also created a new Firefox profile with just the GreaseMonkey and NoScript addons installed with default settings - and still the problem persists.

There are no errors when trying to use the Web Socket - it just fails to connect. And it does not matter what website the GM script is loaded on.

The script I am using creates the Web Socket like this:

Code: Select all

    var ws = new WebSocket('ws://localhost:55443/');
    ws.onerror = function (event) {
        var message = 'Web Socket Test\n\n'
        if (event.state !== WebSocket.OPEN) {
            message += 'Could not connect to server'
        } else {
            message += 'Unknown reason'
        }
        window.alert(message)
    }
and it triggers the error handler every time. Using wss:// makes no difference.

I am using Firefox v50.0 and GreaseMonkey v3.9.
Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
barbaz
Senior Member
Posts: 11141
Joined: Sat Aug 03, 2013 5:45 pm

Re: [2.9.5] NoScript breaks Web Sockets on Firefox

Post by barbaz »

I think it's the use of localhost causing the problem. Please check the Browser Console (Ctrl-Shift-J) when this issue happens and post here any messages related to NoScript.
(related messages usually start with either "[NoScript" or "[ABE]"; if you don't know what's related, turn off CSS warnings and post everything else you see)
*Always* check the changelogs BEFORE updating that important software!
-
bazwal
Posts: 3
Joined: Sat Nov 26, 2016 7:24 pm

Re: [2.9.5] NoScript breaks Web Sockets on Firefox

Post by bazwal »

It looks like you might be right. It took me a few tries to get anything useful, but evetually I got this:

Code: Select all

[ABE] < LOCAL> Deny on {GET http://localhost:55443/task <<< http://something.org/task/76247348}
SYSTEM rule:
Site LOCAL
Accept from LOCAL
Deny
Firefox can’t establish a connection to the server at ws://localhost:55443/task.  (unknown)
Is that supposed to happen? Do I need to adjust my NS settings in some way?

PS:

Okay. Disabling ABE makes the problem go away, but I'd rather not have to do that if possible. I had a look at the ABE docs, but I confess it's all a quite baffling to me. Is there some rule I need to define to that will safely allow web sockets to work where I need them to?
Last edited by barbaz on Sat Nov 26, 2016 9:17 pm, edited 2 times in total.
Reason: quote tags to code tags
Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
barbaz
Senior Member
Posts: 11141
Joined: Sat Aug 03, 2013 5:45 pm

Re: [2.9.5] NoScript breaks Web Sockets on Firefox

Post by barbaz »

Moving to NoScript Support.
bazwal wrote:Is that supposed to happen? Do I need to adjust my NS settings in some way?
Yes and yes. You will need to make exception in NoScript Options > Advanced > ABE > SYSTEM, *at the very top* of that ruleset.

If your script needs to be able to run on any site, just use this -

Code: Select all

Site localhost:55443
Accept
If it's only specific sites, follow this template -

Code: Select all

Site localhost:55443
Accept from http://something.org/*
For multiple sites, put them all on that Accept line, separated by a single whitespace.

More information in ABE Rules .pdf.
*Always* check the changelogs BEFORE updating that important software!
-
bazwal
Posts: 3
Joined: Sat Nov 26, 2016 7:24 pm

Re: [2.9.5] NoScript breaks Web Sockets on Firefox

Post by bazwal »

barbaz wrote: If your script needs to be able to run on any site, just use this -

Code: Select all

Site localhost:55443
Accept
If it's only specific sites, follow this template -

Code: Select all

Site localhost:55443
Accept from http://something.org/*
For multiple sites, put them all on that Accept line, separated by a single whitespace.
Okay, thanks for your help - that seems to have fixed the problem.

Sorry about the duff bug report. If I'd persisted with the browser console output, I'd have probably worked it all out for myself eventually...
Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
barbaz
Senior Member
Posts: 11141
Joined: Sat Aug 03, 2013 5:45 pm

Re: [2.9.5] NoScript breaks Web Sockets on Firefox

Post by barbaz »

You're welcome! Image
*Always* check the changelogs BEFORE updating that important software!
-
Post Reply