policies manager(aka security zones)
Posted by: disrupted
Date: April 13, 2009 04:21PM

download from kmext

ported extension, special thanks to shimoda hiroshi
http://piro.sakura.ne.jp/xul/_policymanager.html.en

similar to IE security zones, you can add policies with this extension and add sites to every policy..policies can block or allow anything regardless of global settings.
for example, you can have javascript disabled globally and allow it for certain sites in a policy or vice versa..you can set js to be enabled and block it for sites you don't trust completely(underground music etc). you can also control certain aspects for js for each policy and you can also block cookies, images etc for specific policies. this extension is a better replacement for noscript and if you have noscript installed, you must remove it before using policies manager.. because they conflict badly.

if a site is added to a policy zone, the changes take effect immediately and there's no need to restart kmeleon.

the macro adds 3 menu entries:
tools>privacy>policies manager
page context menu>policies manager
link context menu>policies manager

the page and link context menus copy the damain for the page or link to the clipboard to make it easier to add the url in the policy(just paste)

comparison between 1.1.4 without policies manager on the left and 1.5 with policies manager with javascript and images blocked for abcnews(javascript and images are enabled globally)












Edited 1 time(s). Last edit at 03/13/2010 08:42AM by disrupted.

Re: policies manager(aka security zones)
Posted by: panzer
Date: April 13, 2009 04:25PM

Excellent!

Re: policies manager(aka security zones)
Posted by: soccerfan
Date: April 13, 2009 04:59PM

Quote
panzer
Excellent!

x2

@disrupted: Thanks! Is this kmeleon 1.1.x compatible?

soccerfan

Re: policies manager(aka security zones)
Posted by: disrupted
Date: April 13, 2009 05:42PM

yes, i've tested it on 1.1.4 and it works without problems

Re: policies manager(aka security zones)
Posted by: JamesD
Date: April 21, 2009 07:48PM

@ disrupted

This is great! Automatic blocking of javascript on certain sites makes surfing so very much nicer now. Very good work.

Re: policies manager(aka security zones)
Posted by: disrupted
Date: April 21, 2009 09:59PM

thanks james.. i love that extension too, shimoda hiroshi makes very good ones

Re: policies manager(aka security zones)
Posted by: Arrow
Date: April 22, 2009 12:19AM

Very good idea,

Could this be adapted for use with Hao's ccfme by any chance?

I haven't a clue how to do so.

Re: policies manager(aka security zones)
Posted by: disrupted
Date: April 22, 2009 12:25AM

no..the extension is xul chrome but i think something similar can be written in lua to add the same values in prefs and then access them from a dialog

user_pref("capability.policy.Trusted%20Zone.__permission__.cookie", 1);
user_pref("capability.policy.Trusted%20Zone.__permission__.image", 1);
user_pref("capability.policy.Trusted%20Zone.javascript.enabled", "allAccess");
user_pref("capability.policy.default.javascript.enabled", "allAccess");
user_pref("capability.policy.maonoscript.javascript.enabled", "allAccess");

Re: policies manager(aka security zones)
Posted by: Arrow
Date: April 22, 2009 01:14AM

thanks disrupted

Lets hope Hao reads this :cool:

Re: policies manager(aka security zones)
Posted by: JohnHell
Date: April 22, 2009 08:20PM

Your best contribution winking smiley

Just, one question, because I haven't seen on the original site:

What does it use, hostperm.1 or its own xml/txt whatever file?

I ask because looking about how it works, looks like a hostperm manager (block cookies, js, popup, images, etc)

Re: policies manager(aka security zones)
Posted by: disrupted
Date: April 22, 2009 10:26PM

it just writes into prefs.js and kmeleon reads those values right away, interprets them and give site permissions according to them..it doesn't overlay, the extension itself is a dialog for writing and accessing those values which are automatically understood by gecko..that's the beauty of it.

from hiroshi's website:
Quote

Firefox includes the feature secretly, but there is no UI. This package includes manager GUI and a context menu extension to set the site's policy easily.

what i found really amazing is that this extension is so low profile with few downloads on mozilla addons(it's one of the least popular extensions!) and it's never mentioned on the 'big sites' evaluating/promoting firefox extensions.. kinda gives you an idea about what most fireslut users care about: social bookmarks, tags and useless eyecandy and ofcourse anything remotely related to porrn

Re: policies manager(aka security zones)
Posted by: reeko124
Date: April 23, 2009 08:02AM

Quote
disrupted
what i found really amazing is that this extension is so low profile with few downloads on mozilla addons(it's one of the least popular extensions!) and it's never mentioned on the 'big sites' evaluating/promoting firefox extensions.. kinda gives you an idea about what most fireslut users care about: social bookmarks, tags and useless eyecandy and ofcourse anything remotely related to porrn

Exactly and that is the same reason KM isn't used because it is more for people like us. I see some addons for FF and I say to myself "do you really need that?" Maybe we are in the minority here . What was funny was when I was using FF I had the extensions I used and when I came over to KM guess what? They were all ported to be used on KM. It was a no brainer to stay with KM after that. I had to try FF again to get Gspace until someone left me a message that is was made to work with KM grinning smiley. Whoe just happens to be the person I am quoting right now. It was so nice to uninstall FF again



Reeko

Re: policies manager(aka security zones)
Posted by: reeko124
Date: May 09, 2009 03:43AM

I was originally gonna reply here that a policy wouldn't work anymore but I left out the "www." at the beginning of the address like an idiot. So since this was open I wanted to say thanks again for policy manager. Its so nice once you get in your routine of sites and not have to turn this off or turn that on. This is the best one you have done so for IMHO. So consider this a thanks and a BUMP for those who missed it.



Reeko

Re: policies manager(aka security zones)
Posted by: slayer
Date: November 20, 2009 10:03PM

I'm going to try this extension, it really looks good. :cool:

Re: policies manager(aka security zones)
Posted by: JamesD
Date: November 28, 2009 07:25PM

I just wanted to point out a possible conflict with some of KM's macros.

Quote
http://kmeleonbrowser.org/forum/read.php?1,98793,98845#msg-98845
I don't think that you can zoom images when using Policy Manager with a default of no Javascript unless the page is from a domain in your Javascript OK list. I think almost anything with an "injectjs()" is going to be affected.

I ran into this when looking at the KM zoom macro. I went back to a copy of KM 1.1.6 in which the general policy was Javascript OK and list of sites where I did not want JS. Zoom image worked there but not on my KM 1.5.3 where I have a general of no JS and list of site which require it. Several items under page properties will not work in this case.

Re: policies manager(aka security zones)
Posted by: JamesD
Date: December 02, 2009 10:22PM

Upon changing from a default of allAccess for Javascript in policy to a more secure default of noAccess, I found that some functions which come with KM would no longer work. Everything that depends on the "injectjs()" statement would only work for sites in my list of Javascript approved sites in Policy Manager. The first function that for which I noticed a problem was zoom an image.

Since I like the new saftey of no javascript for just surfing around, I decided to try to have both methods in Policy Manager. I have just completed a macro which allows me to toggle my default in Policy Manager and to have site lists for both approved and disapproved for Javascript.

Before I go any further, I must advise you to back up to a secure place the file named "prefs.js" in your profile if you intend to try this idea.

You will need an image for the new button which will be created. That can be found at http://www.perigee.net/~jmd8421r/Flip_PM.bmp. Save this file as "Flip_PM.bmp" in the Default folder under skins. You will have a green flag if your default policy is no access for Javascript. You will have a red flag if your default policy is all access for Javascript.


Since I had previously had a list of sites for no access when my default policy was all access, I decided to keep that and use it along with my current list for all access when the default is no access. This is something that I wanted for myself and is not required to make Flip_PM.kmm work. I will give instructions on doing this part below the macro listing.

Flip_PM.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- Flip_PM.kmm
# ---------- Change the default for JavaScript within Policy Manager
#
# Dependencies        : main.kmm
# Resources           : panorama image Flip_PM.bmp in SKINS\DEFAULT
#                     : may also have policy lists for allAccess and noAccess 
# Preferences         : -
# Version             : 0.4  12/02/09 
# --------------------------------------------------------------------------------

_Flip_PM_RunCode {
$_FPM_ToolbarName = "Flip_PM" ;
$_FPM_BSize = "16" ;
$_FPM_LastItem = "" ;
$_FPM_AddBarTag = $_FPM_ToolbarName .",". $_FPM_BSize .",". $_FPM_BSize .",". $_FPM_LastItem ; 
pluginmsg(toolbars, "AddToolbar", $_FPM_AddBarTag);

$_FPM_ButtonName = "FlipJS" ;
$_FPM_Command = "macros(Flip_PM_Toggle)" ;
$_FPM_MenuName = "" ;
$_FPM_tipText = "Flip Policy Manager JavaScript on/off";
$_FPM_ImageHot = "Flip_PM.bmp[2]" ;
$_FPM_ImageCold = "Flip_PM.bmp[1]" ;
$_FPM_ImageDead = "Flip_PM.bmp[3]" ;
$_FPM_AddButtonTag = $_FPM_ToolbarName.",".$_FPM_ButtonName.",".$_FPM_Command.",".$_FPM_MenuName.",".$_FPM_tipText.",".$_FPM_BSize.",".$_FPM_BSize.",".$_FPM_ImageHot.",".$_FPM_ImageCold.",".$_FPM_ImageDead.",".$_FPM_LastItem ; 
pluginmsg(toolbars, "AddButton", $_FPM_AddButtonTag);
## ---  SYNC BUTTON TO PREF FOR DEFAULT JS  --- ##
$_FPM_ImageType = "COLD" ;
$_FPM_Current = getpref( STRING, "capability.policy.default.javascript.enabled");
if ($_FPM_Current == "allAccess" ) {
	##  1 equals green  -  0 equals red
	$_FPM_ImageCold = "Flip_PM.bmp[0]"; } else {
	$_FPM_ImageCold = "Flip_PM.bmp[1]" ;
	}
$_FPM_SyncButtonTag = $_FPM_ToolbarName.",".$_FPM_Command.",".$_FPM_ImageType.",".$_FPM_ImageCold ;
pluginmsg(toolbars, "SetButtonImage", $_FPM_SyncButtonTag);
}

Flip_PM_Toggle {
togglepref( STRING, "capability.policy.default.javascript.enabled", "noAccess", "allAccess");
$_FPM_ImageType = "COLD" ;
$_FPM_Current = getpref( STRING, "capability.policy.default.javascript.enabled");
if ($_FPM_Current == "allAccess" ) {
	##  1 equals green  -  0 equals red
	$_FPM_ImageCold = "Flip_PM.bmp[0]"; } else {
	$_FPM_ImageCold = "Flip_PM.bmp[1]" ;
	}
$_FPM_ToggleButtonTag = $_FPM_ToolbarName.",".$_FPM_Command.",".$_FPM_ImageType.",".$_FPM_ImageCold ;
pluginmsg(toolbars, "SetButtonImage", $_FPM_ToggleButtonTag);
}

$OnSetup=$OnSetup."_Flip_PM_RunCode;";
$macroModules=$macroModules."Flip_PM;";

== end of Flip_PM.kmm





The following were my original prefs about Policy Manager.

user_pref("capability.policy.Known%20JS%20pops.__permission__.cookie", -1);
user_pref("capability.policy.Known%20JS%20pops.__permission__.image", -1);
user_pref("capability.policy.Known%20JS%20pops.__permission__.install", -1);
user_pref("capability.policy.Known%20JS%20pops.__permission__.popup", -1);
user_pref("capability.policy.Known%20JS%20pops.javascript.enabled", "noAccess");
user_pref("capability.policy.Known%20JS%20pops.sites", < long list of sites > );
user_pref("capability.policy.policynames", "Known%20JS%20pops Test%20case test");

This was the current prefs for Policy Manager. As you can see this one has a default javascript.enabled value of "noAccess".

user_pref("capability.policy.Require%20JavaScript.__permission__.cookie", 1);
user_pref("capability.policy.Require%20JavaScript.__permission__.image", 0);
user_pref("capability.policy.Require%20JavaScript.__permission__.install", 0);
user_pref("capability.policy.Require%20JavaScript.__permission__.popup", 0);
user_pref("capability.policy.Require%20JavaScript.javascript.enabled", "allAccess");
user_pref("capability.policy.Require%20JavaScript.sites", < long list of sites > );
user_pref("capability.policy.default.javascript.enabled", "noAccess");
user_pref("capability.policy.policynames", "Test%20case test Require%20JavaScript");

With KM stopped, I copied the original prefs into the "prefs.js" file and combined the user_pref("capability.policy.policynames" data to reflect both policies.

user_pref("capability.policy.policynames", "Test%20case test Require%20JavaScript  Known%20JS%20pops");

I deleted the extra policynames line which did not contain both policies.

Re: policies manager(aka security zones)
Posted by: forever
Date: July 10, 2010 10:48AM

Quote
disrupted

the page and link context menus copy the damain for the page or link to the clipboard to make it easier to add the url in the policy(just paste)

is there any chance to add a new site just per rightclick?

like: rightklick --> Policies Manager --> add site to "list"

would be great

Re: policies manager(aka security zones)
Posted by: JamesD
Date: July 10, 2010 11:13AM

Quote
forever
is there any chance to add a new site just per rightclick?

like: rightklick --> Policies Manager --> add site to "list"

You still have to choose which list. It is possible to have several lists.

Re: policies manager(aka security zones)
Posted by: forever
Date: July 10, 2010 11:42AM

yes i know..... wasnt exact enought

"list" means you choose which list winking smiley

Re: policies manager(aka security zones)
Posted by: disrupted
Date: July 10, 2010 10:26PM

the original extension has a select policy xul but it depends on mozilla/firefox overlay by initiating from the xul menu which isn't possible in kmeleon(no xul ui) which made the select policy terminate instantly since it couldn't populate the zone or zones without the missing overlay.

i didn't care much for it at the time and as long as the extension worked properly but now that you've asked for it, i added the js overlays inside the dialog directly and changed the onload functionsso it can populate the zones and display them..unfortunately though; the url can not passed from kmeleon as that relies on an eventlistener service specific to xul meaning the add to zone will initiate properly but the url buffer will be empty, this is fixed by a simple autoit helper which will fetch the url and type it in the buffer.

the difference between the extension in kmeleon and mozilla xuls is that the policy selector will not initiate when there are no policies/zones but in kmeleon it will open regardless of existence of custom zones or not..it's not really a bug as clicking ok without gselecting a zone will not cause problems. another difference is in firefox the dialog immediately displays the current page host in the buffer where as in kmeleon there are a couple of nanoseconds before the host appears(autoit gets in action)

the updated policy manager:
http://kmext.sourceforge.net/files/kmpolicies.7z

once it's open and the url is displayed, click on the arrow to display your zones..select and click ok.


don't worry if you add a website which is already in a zone..pm takes care of that and will not accept dual entries in same zone or different zones. the regular pm dialog to edit and create zones can still be accessed from tools>provacy>policy manger and can also be opened from the selector by clicking the manage policies button

Re: policies manager(aka security zones)
Posted by: forever
Date: July 11, 2010 12:04AM

woooooooow

great work.... now it's much better and more comfortable

Thank you for your help and this extension

Re: policies manager(aka security zones)
Posted by: disrupted
Date: July 11, 2010 09:49AM

thanks forever, i didn't make the extension though.. i just ported it to kmeleon.

there's been an update that fixes a bug in the macro(adding http prefix) and fixes delay in the autoit helper
please download from same link

additionally, a special version of the helper which will instantly display the url in the dialog. this version may not work on russian systems so please test.

this is just the helper exe, not the extension
http://kmext.sourceforge.net/tests/pm-helper-fast.7z
extract the exe in tools and replace the pm-helper.exe, you must download the extension before testing the fast helper

Re: policies manager(aka security zones)
Posted by: mhf
Date: July 11, 2010 10:02AM

very cool disrupted - thanks for this. I use PM a lot and this improvement makes it much easier.

Re: policies manager(aka security zones)
Posted by: forever
Date: July 11, 2010 10:33AM

thanks for the update and the helper

disrupted..... porting is also a sort of creating winking smiley

and without people like you, k-meleon won't be so great

Re: policies manager(aka security zones)
Posted by: km2
Date: August 18, 2010 03:54PM

when downloading files from rapidshare, there is situation:
Policy block JavaScript for example from links, like rs111.rapidshare.com, rs222. etc... It's possible to fix that?
(rapidshare.com enabled)

Re: policies manager(aka security zones)
Posted by: disrupted
Date: August 20, 2010 12:35AM

you mean subdomain filtering like in internet explorer zones
e.g:
*.rapidshare.com

unfortunately that doesn't work in policy manager and you have to enter the full domain or subdomain

Re: policies manager(aka security zones)
Posted by: km2
Date: August 24, 2010 03:55PM

Quote
disrupted
unfortunately that doesn't work in policy manager and you have to enter the full domain or subdomain

Yes, that's true. sad smiley

Re: policies manager(aka security zones)
Posted by: km2
Date: March 25, 2011 11:30PM

Hey.
Policy manager updated to 2.2.2009110501.

Re: policies manager(aka security zones)
Posted by: Wasi
Date: June 13, 2011 03:32AM

adding sites at subdomain level is the most wanted thing, as mentioned above, sites like rapidshare and hotmail (I have a lot of trouble opening my hotmail account) without subdomain entry make me mad and ultimately I have to enable JS globally to check mail.
consider this in the next version pls

Re: policies manager(aka security zones)
Posted by: JamesD
Date: June 21, 2011 06:03PM

Quote
km2
Hey.
Policy manager updated to 2.2.2009110501.

Can you provide a link to the new version?

K-Meleon forum is powered by Phorum.