ABE Rule to allow local CSS

Discussions about the Application Boundaries Enforcer (ABE) module
erosman

ABE Rule to allow local CSS

Post 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
:)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post 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
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
Guest

Re: ABE Rule to allow local CSS

Post 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
:)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
erosman

Re: ABE Rule to allow local CSS

Post 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.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post 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
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post 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.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
erosman

Re: ABE Rule to allow local CSS

Post 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)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post by barbaz »

Can you please post here the message from the Browser Console after adding the second rule?
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
erosman

Re: ABE Rule to allow local CSS

Post 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
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post 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)
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
erosman

Re: ABE Rule to allow local CSS

Post 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
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: ABE Rule to allow local CSS

Post 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.
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
erosman

Re: ABE Rule to allow local CSS

Post 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
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: ABE Rule to allow local CSS

Post by Thrawn »

Code: Select all

http://localip/localhost:8000
Wait, what? You can't have slashes in a domain name.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (Symbian/3; Series60/5.3 NokiaN8-00/111.030.0609; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.4.2.6 Mobile Safari/533.4 3gpp-gba
erosman

Re: ABE Rule to allow local CSS

Post 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
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
Post Reply