473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

firefox: test for privileges without user confirmation?

I'd like to test in my script, if it's going to be possible to enable
priviliges.

If I use this...

netscape.security.PrivilegeManager.enablePrivilege ("UniversalXPConnect")

....it presents a dialog to the user asking if it's ok. Now I don't want
to hide that dialog, I'd like to know if it's going to be possible to
click the Allow button, before ever making this call. Basically I need
to know if the appropriate certificate is installed and enabled and such.

I need this because if the priviliges cannot be enabled, the user must
install a certficate and I want to notify the user about that. But I
don't want to force the user to click allow/deny every time the page
loads, just for the purpose of checking a privilege...

I tried using this...

netscape.security.PrivilegeManager.isPrivilegeEnab led("UniversalXPConnect")

.... and I thought it worked, because in the (Venkman) javascript
debugger, it returns true. But it turns out that it returns true just
because the javascript debugger is already a trusted extension and is
therefor already granted such privileges. In my script, however, it
returns false.

I hope I'm making sense here :)

Anyone knows what to do?

--
Martijn Saly
Nov 21 '06 #1
5 2751
VK

Martijn Saly wrote:
I'd like to test in my script, if it's going to be possible to enable
priviliges.

If I use this...

netscape.security.PrivilegeManager.enablePrivilege ("UniversalXPConnect")

...it presents a dialog to the user asking if it's ok. Now I don't want
to hide that dialog, I'd like to know if it's going to be possible to
click the Allow button, before ever making this call. Basically I need
to know if the appropriate certificate is installed and enabled and such.
With a proper implementation you can't.
Netscape 4.x Java security model is the most sophisticated (forcedly)
paranoid application of security considerations ever made up to date by
the human mind.
Some day I'd like see it being studied in higher schools like the Roman
law: it is not matter that it is not used any more, but it puts your
mind into the right direction.

This way with a proper implementation of the three stages security
model it is not possible. The fact itself of *trying* to ask *anything*
beyond the sandbox is a security alert to be properly handled. But
Firefox netscape.security.* is not really Netscape's Java sandbox: it
is a native C++ implementation of the Java model, but not the code
itself. This way I cannot comment on it as it would be with a Java
applet. Look at netscape.security.PrivilegeManager and see if anything
is relaxed in comparison with Netscape 4.x JVM.

Nov 21 '06 #2
VK wrote:
Martijn Saly wrote:
>I'd like to test in my script, if it's going to be possible to enable
priviliges.

If I use this...

netscape.security.PrivilegeManager.enablePrivileg e("UniversalXPConnect")

...it presents a dialog to the user asking if it's ok. Now I don't want
to hide that dialog, I'd like to know if it's going to be possible to
click the Allow button, before ever making this call. Basically I need
to know if the appropriate certificate is installed and enabled and such.

With a proper implementation you can't.
Netscape 4.x Java security model is the most sophisticated (forcedly)
paranoid application of security considerations ever made up to date by
the human mind.
Some day I'd like see it being studied in higher schools like the Roman
law: it is not matter that it is not used any more, but it puts your
mind into the right direction.

This way with a proper implementation of the three stages security
model it is not possible. The fact itself of *trying* to ask *anything*
beyond the sandbox is a security alert to be properly handled. But
Firefox netscape.security.* is not really Netscape's Java sandbox: it
is a native C++ implementation of the Java model, but not the code
itself. This way I cannot comment on it as it would be with a Java
applet. Look at netscape.security.PrivilegeManager and see if anything
is relaxed in comparison with Netscape 4.x JVM.
I don't understand why you're pulling Java and Netscape 4.x in the
picture. I'm asking about Firefox and javascript. Quite the difference.

--
Martijn Saly
Nov 22 '06 #3
VK

Martijn Saly wrote:
I don't understand why you're pulling Java and Netscape 4.x in the
picture. I'm asking about Firefox and javascript. Quite the difference.
Almost no difference. Gecko security model is the Netscape 4.x Java
security model (over netscape.security classes). The only difference is
that in Gecko it is implemented internally (C++) and not by using JVM.

Any other differences are only in what is taken and what is left
behind. Say Gecko doesn't implement macro targets - which is a big
implementation lack IMHO.

This way the best learning source for netscape.security.* package would
be some old Netscape manual for Capabilities API
<http://java.sun.com/developer/onlineTraining/Security/Fundamentals/Security.html#secNetscape>

Nov 22 '06 #4
VK
VK wrote:
This way the best learning source for netscape.security.* package would
be some old Netscape manual for Capabilities API
<http://java.sun.com/developer/onlineTraining/Security/Fundamentals/Security.html#secNetscape>

Also may look at:
<http://www.mozilla.org/projects/security/components/signed-scripts.html>
and
<http://www.mozilla.org/projects/security/components/jssec.html#privs>

This will answer your original request:
<snipif the priviliges cannot be enabled, the user must
install a certficate and I want to notify the user about that. But I
don't want to force the user to click allow/deny every time the page
loads, just for the purpose of checking a privilege...
Netscape/Gecko security model doesn't work this way. A properly signed
(with a valid recognized certificate) JAR with your page and script
does *not* get any special privileges and it runs in the same sandbox
as a regular script. What it gets is a *privilege to ask for
privileges* : but the final decision (grant or not) is still up to user
via popup security dialog.

Other words for a regular Web page enablePrivilege request will be
silently ignored. In a relaxed environment (local page) or for properly
signed JAR such request will lead to popup security dialog and if user
presses Yes then the privilege will be granted.

More over even if user clicked Yes, the privilege will *not* be granted
to the whole script for the entire "page lifetime" but only for the
given function for the function execution period. It means that if
function fileReader() {
// request for privilege here
// the rest of code
}
only fileReader gets any privileges but not any other functions in your
script. And the next time you call fileReader it will ask for
privileges again - unless user set the checkbox "Always allow" in the
security dialog.

Overall it is far of Microsoft's security hole with "signed ActiveX" so
an extra reading is highly suggested (expecially the old Nescape 4.x
Capabilities API documentation as Mozilla's wiki is very poor and buggy
on this subject).

In answer to your original question:

try {
netscape.security.privilegeManager.enablePrivilege (strPrivilege);
}
catch (SecurityException) {
// security dialog is not allowed to be shown
// or user clicked No on your request
// always be ready for that
}

Nov 22 '06 #5
VK
VK wrote:
More over even if user clicked Yes, the privilege will *not* be granted
to the whole script for the entire "page lifetime" but only for the
given function for the function execution period. It means that if
function fileReader() {
// request for privilege here
// the rest of code
}
only fileReader gets any privileges but not any other functions in your
script. And the next time you call fileReader it will ask for
privileges again - unless user set the checkbox "Always allow" in the
security dialog.
That is for an external page and an external script. In Firefox
extensions (.ipx blocks) script can have "permanently allowed"
privileges. This way if you are making some intranet file manager for
Gecko then the best would be to write your own extension, sign it and
provide an installation link on relevant webpages.
For IE users what will be signed ActiveX (.ocx) to install. Other UA's
are respectively FUBAR (though Opera and now Safari have installable
"widgets" mechanics which can be thoretically twisted in the needed
way. I cannot comment too much on the later as I did not play with it).

Nov 22 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Geoff | last post by:
When trying to focus a field in Firefox, I get the following error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame ::...
9
by: Joe | last post by:
I'm trying to create an image preview function so that my users can preview images before they upload them. I've got my example working locally on both Firefox and IE, and from the webserver in IE....
2
by: chatiman | last post by:
Hello, Is it possible to get extended privileges for a local application, without asking if possible, like any non/java-javascript app would be able to ? Thanks
10
by: wayne | last post by:
I found the following script to copy text to the client clipboard but it is not working in Firefox (works fine in IE 6). Can anyone suggest what I need to change? ...
11
by: steingold | last post by:
Hi All. Is it possible to define an external stored procedure to be executed not with the executing user privileges, but instead with the user who created the stored procedure privileges in db2...
1
by: Kreißl, Karsten | last post by:
Hello, we want use dblink to connect several databases in a client/server environment. Connection from local users to the remote databases should be possible only for privileged users. We tried a...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
1
by: menoquindici | last post by:
We have a situation here where one of my co-workers removed several privileges from the 'root' user, namely: INSERT UPDATE DELETE FILE
4
by: Don Calloway | last post by:
I'm attempting to implement User-level security on an Access 2003 database in Access 2000 format and have hit a brick wall. I created a Workgroup Information File with myself as admin and added...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.