Page 1 of 2

ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 1:57 pm
by erosman
Hi everyone

I am testing a CSS for a site that is on the internet
I use GreaseMonkey to replace the CSS link with a file on my local computer/server for testing

ABE is blocking the inclusion

Code: Select all

[ABE] <LOCAL> Deny on {GET http://ip:8000/*****/style.css <<< http://target/ - 4}
SYSTEM rule:
Site LOCAL
Accept from LOCAL
Deny
What would be the rule to allow it?
Thank you
:)

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 2:15 pm
by barbaz
You would be better off having Greasemonkey use its privileged position to read the file contents into a data: URI, then replacing the site style with that data: URI. However, if that's not possible, add this above the default SYSTEM rule

Code: Select all

Site http://ip:8000
Accept INCLUSION(CSS) from target

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 2:26 pm
by Guest
Thank you barbaz

Because of another problem (relative URLs in the CSS), at the moment I am getting the file with GM_xml http Request and fixing the relative URLs before inserting it into the document with GM_add Style

Is that what you were referring to?
Are there any other/better ways of ding it?

Thanks
:)

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 2:35 pm
by erosman
BTW.. I tried the rule in both system and user and it did not have any effect.
I switched the site & target but no effect either.

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 3:08 pm
by barbaz
I was actually thinking it might be possible for Greasemonkey to fetch the stylesheet from chrome and not the webpage context...
If your stylesheet includes other resources loaded from http://ip:8000, try instead this more generic rule, above the default SYSTEM rule

Code: Select all

Site http://ip:8000
Accept GET from target

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 3:13 pm
by barbaz
And a better way to go about testing stylesheets would be to have Greasemonkey simply *remove* the webpage's current stylesheet, and use Stylish to apply your new style.

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 3:43 pm
by erosman
Thank you :)

Sadly, that rule does work either :(

I have Stylish. Problem with Stylish is that it doesn't allow external editor and its own editor is limited.
Anyway, it would be better to work in one environment instead of 2 (GreaseMonkey + Stylish)

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 4:34 pm
by barbaz
Can you please post here the message from the Browser Console after adding the second rule?

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 4:47 pm
by erosman
barbaz wrote:Can you please post here the message from the Browser Console after adding the second rule?
The exact same message that I posted in my first post.

I also tried

Code: Select all

Site http://ip:8000
Accept 

Code: Select all

Site target
Accept 
I put it BEFORE the standard local rule in SYSTEM, also tried in USER

Code: Select all

# Prevent Internet sites from requesting LAN resources.
Site LOCAL
Accept from LOCAL
Deny
Here is the message again

Code: Select all

[ABE] <LOCAL> Deny on {GET http://localip/localhost:8000/*****/style.css <<< http://web-target/ - 4}
SYSTEM rule:
Site LOCAL
Accept from LOCAL
Deny

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 5:31 pm
by barbaz
erosman wrote:I also tried

Code: Select all

Site http://ip:8000
Accept 
Weird, that really should have worked...

If all else fails, you could try using only the builtin SYSTEM rule, modified as follows: (this is a bad idea, it would be better to figure out the actual problem)

Code: Select all

# Prevent Internet sites from requesting LAN resources.
Site LOCAL
Accept from LOCAL target
Deny
If that doesn't work you've probably found a bug. Please let us know how it goes.

(Note: another possible alternative might be to try leveraging GM_getResourceText somehow instead of reconfiguring ABE... but not sure how or if that would actually work)

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 6:11 pm
by erosman
Thank you :)

I have tried GM_getResourceText and it has its issues.
Steps taken are discussed (more in depth) at:
http://userscripts.org/topics/191981

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 8:38 pm
by barbaz
For reference, did you get it to work, and if so, what worked?

Although I use Scriptish not Greasemonkey, as a test I tried injecting stylesheet from my local server into a remote page the way you described above from a user script, and it just worked without *any* reconfiguring of ABE...
Unfortunately I can't post the script here due to spam filter, sorry.

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 9:07 pm
by erosman
Case 1: Replacing css href with local file via file-system

Code: Select all

<link media="screen" type="text/css" href="file:///C:/Users/****/style.css" rel="stylesheet"></link>
Error form Firefox:

Code: Select all

Security Error: Content at http://www.*****/ may not load or link to file:///C:/Users/*****/style.css.

Case 2: Replacing css href with local file via http server

Code: Select all

<link media="screen" type="text/css" href="http://172.*****:8000/*******/style.css" rel="stylesheet"></link>
Error from NoScript ABE:

Code: Select all

[ABE] <LOCAL> Deny on {GET http://172.****:8000/*****/style.css <<< http://www.*****/ - 4}
SYSTEM rule:
Site LOCAL
Accept from LOCAL
Deny
As I mentioned in that thread, I am using GM_xml http Request to grab the css from http://172.****:8000/*****/style.css and then insert it
I havent been able to get a rule to work in ABE

Re: ABE Rule to allow local CSS

Posted: Fri Feb 28, 2014 9:11 pm
by Thrawn

Code: Select all

http://localip/localhost:8000
Wait, what? You can't have slashes in a domain name.

Re: ABE Rule to allow local CSS

Posted: Sat Mar 01, 2014 5:36 am
by erosman
I finally got it working with the following inserted at the BEGINNING of SYSTEM

Code: Select all

# NoScript ABE Rule for MiniWeb
Site localhost:8000
Accept from domain

# Prevent Internet sites from requesting LAN resources.
Site LOCAL
Accept from LOCAL
Deny