473,803 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(un)signed javascripts modifying forms

I asked a couple of days ago about the following arrangement
(simplified). I made some progress using
netscape.securi ty.PrivilegeMan ager.enablePriv ilege but still have to ask
some further help.

1) a frameset contains
- a number of javascript functions in the head (they do something
like top.frames["UP"].document.myfor m.elements[i].value = v
- two frames UP and DOWN

2) the frame UP contains a form, whose action invokes a java servlet
(on the same machine, but by definition port 8080)

3) the servlet writes into frame DOWN (initially blank) a number
of javascript statements, which invoke functions of the form
parent.function ame(argument) ... i.e. those defined in the head
of the frameset

4) the effect of this should be to update some text input areas
or check buttons in the form in frame UP

For demo purposes I could replace step 3 loading in frame DOWN a fixed
set of javascript statements. I could put the source of frame DOWN on
the same server as frame UP, or on a different server.

In the case of the java servlet, as well if the source of DOWN is on a
different server, the javascripts cannot update the form, because of a
breach of the "Mozilla security model" as pointed out by Martin Honnen
(http://www.mozilla.org/projects/secu...e-origin.html).

The javascripts cannot update the form under Mozilla and Netscape 6/7
(and also 4). They work under Netscape 3 or Konqueror.

I found that I can allow the javascripts residing on a "different
machine" to update the form with the following procedure (which I
derived from the help on signed scripts at
http://developer.netscape.com/viewso...sscripts.html), without
bothering with real signed scripts (too much of a hassle for just a few
users !)

1) the user (I will have only 2-3 users) put in their netscape
prefs.js a line like

user_pref("sign ed.applets.code base_principal_ support", true);

2) I put in my javascript code (WHERE ?) the statements

netscape.securi ty.PrivilegeMan ager.enablePriv ilege("Universa lBrowserRead")
netscape.securi ty.PrivilegeMan ager.enablePriv ilege("Universa lBrowserWrite")

3) the user sees a popup which asks him to grant or deny privileges
for the unsigned script

Now my question is : what is the appropriate place for the
enablePrivilege statements ? And which of them go where ?

I tried a maximal solution, i.e. enabling both Read and Write in THREE
places :

- the head of the frameset
- the head of the source of frame UP
- the javascript code in frame DOWN

this way it works, but the user is asked 6 times to grant privileges.

I tried putting them only in the head, and it does not work. I get a
"permission denied get property Window.ffff" where ffff is one of the
javascript functions in the head of the frameset

Which privilege should I enable and where to get asked the minimum
possible times ?

--
----------------------------------------------------------------------
no****@mi.iasf. cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

Jul 20 '05 #1
2 1792


LC's No-Spam Newsreading account wrote:

I made some progress using
netscape.securi ty.PrivilegeMan ager.enablePriv ilege but still have to ask
some further help.
2) I put in my javascript code (WHERE ?) the statements


Read

http://www.mozilla.org/projects/secu...pts.html#privs

which clearly states

Privileges are granted only in the scope of the requesting function.
This scope includes any functions called by the requesting function.
When the script leaves the requesting function, privileges no longer apply.
Thus you should write a function for the task you have to perform and
inside the function you need to call enable privilege before you try to
access a page loaded from a different origin.
And
http://www.mozilla.org/projects/secu...tml#privs-list
should tell which privileges you need depending on the task you have to
perform.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
On Wed, 28 Jan 2004, Martin Honnen wrote:
Read
http://www.mozilla.org/projects/secu...pts.html#privs
which clearly states

Privileges are granted only in the scope of the requesting function.


I read that but it didn't seem too clear to me. I also read
http://developer.netscape.com/viewso..._sscripts.html which
seemed to suggest setting the privileges at page load time.

Presently I enable "UniversalBrows erRead UniversalBrowse rWrite" in one
single statement, and I do it 3 times (frameset head, frame with form to
be modified, frame with modifying javascript). This way it works, but
the penalty is that the user has to grant privileges in 3 popups.

I also have to bracket the statement with checks on browser name and
version because not all support rivilegeManager .enablePrivileg e with the
same syntax.

Ideally I'd like to reduce the number of OK to grant privileges, but if
no better idea come out, I'll live with 3.

--
----------------------------------------------------------------------
no****@mi.iasf. cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

Jul 20 '05 #3

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

Similar topics

3
3901
by: pascal Joseph | last post by:
J'ai un formulaire avec un seul champ text appelé "unite" et un bouton. En javascript j'aimerai utiliser un script qui interdise les valeurs de type "char" et soit supérieur à 0 J'ai trouvé ce code mais je ne sais pas comment l'appliquer, fonctionne-t-il? <script>
0
4367
by: Juan Pablo MV | last post by:
Hola, agradeceria mucho que me ayudaran. Pasa lo siguiente, tango una función en la pagína que hace que al darle click a un campo de texto esta emule el enter en un boton que yo selecciono. private void Page_Load(object sender, System.EventArgs e) {
6
2296
by: Welie | last post by:
This is sort of a newbie question. I have an access database application. It is split into a backend data file and GUI. I need to make changes to the db schema. The production version of the data file is not accessible to me remotely. Rather than make changes at the client location the best idea seems to be to write a program to do this programaticaly. Just a small exe that the client can download and run which will make the...
7
1641
by: Z-Z | last post by:
Hi, I used the following macro to determine variable signed or not, but only find that it is useless for a short or char variable. I think that it might caused by value conversion rules. I used VC. #define ISUNSIGNED(a) (a>=0 && ~a>= 0) Who knows the reason and other methods to determine short varible signed or not?
26
2782
by: John Harrison | last post by:
I have a problem. I want to compare an integral value, n, against three half open ranges as follows [-A, 0) // range 1 [0, B) // range 2 [B, C} // range 3 Each range corresponds to a different outcome and if the integral value isn't within any of the ranges, that's a fourth outcome. So far so easy, the problem is that n is a signed quantity and A, B, C are unsigned
1
11582
by: nicola | last post by:
Hi, I'm a bit confused about the following: #include <iostream> int main (int argc, char** argv) { std::cout << "Bits of unsigned char: " << std::numeric_limits<unsigned char>::digits << std::endl; std::cout << "Bits of char: " << std::numeric_limits<char>::digits << std::endl;
9
2316
by: Ido Yehieli | last post by:
Hi, from what i've read (http://tigcc.ticalc.org/doc/ keywords.html#short) and unsigned int should normally be in the range 0 to 65535. However, compiling and running this program: #include <stdio.h> int main(){ unsigned int y=1; y-=2;
39
2672
by: Juha Nieminen | last post by:
I was once taught that if some integral value can never have negative values, it's a good style to use an 'unsigned' type for that: It's informative, self-documenting, and you are not wasting half of the value range for values which you will never be using. I agreed with this, and started to always use 'unsigned' whenever negative values wouldn't make any sense. I did this for years. However, I slowly changed my mind: Doing this often...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.