Signed applets called from javascript - how/where to load policy file?

I'm running into some apparently well-known problems with signed applets accessing a client machine's hard drive.
So, I can get things to work if I place the following two lines in my 'local' JDK installation:
permission java.io.FilePermission "${user.home}/x.properties", "read,write";
permission java.util.PropertyPermission "user.home", "read";These let me a) read the user's home directory and b) read/write a file that's located there.
What I don't want to do is edit the java.policy file, but I'm having problems loading a separate policy file. The app server we run with our product is jetty, and I'm assuming I would be passing in the '-Djava.security.policy=='filename' with the other jetty start-up parameters- is this a correct assumption? And, what path do I give for the file, will I need to put it somewhere in the .war file we distribute, or in the JDK installation on the server? If it's on the server, will client machine's know about these extra rights?
I'd REALLY appreciate any help I could get on this...
thanks in advance,
+0^^

Maybe you didn't realize but my previous post was sarcastically ment:
"hello SUN security stop bugging me in writhing this malicious program"
and
"hello SUN security, I'm a good boy now trust what I'm doing"
Are in a practical sense exactly the same.
SUN should either remove the stack check or the doprivileged. The stack check takes up
valuable resources for nothing since a malicious program can easily circumvent that.
Your post about a malicious user abusing your (CA) signed applet to ruine someone's
system is correct, it would not be difficult. A CA signed applet will not even ask a user to
trust or not. This is one of the reasons we have the usepolicy in affect, but this cannot be
used on "grandma's old PC" since it's too complicated for users to do such things.
YOU seem to be the one to blame, not the hacker! (The user accepted YOUR
certificate!).Actually you are to blame, because you made software that exposes a vonurability
other people can take advantage of.
what you can do before calling the doprivileged private method is check the call stack.
So your signed applet has a public method checking the callstack, if this lookes OK
that method will call the private doprivileged method.
Here is the example
package t;
import java.util.Properties;
import java.applet.Applet;
public class test extends Applet {
         public test(){
               startingPrivileged();
         public void startingPrivileged(){
               System.out.println("this is the stack");
               try{
                    throw new Exception("get the call stack");
               }catch(Exception e){
                    StackTraceElement stack[] = e.getStackTrace();
                    for (int i=0; i<stack.length; i++) {
                         System.out.println("file: " + stack.getFileName() + " method: " + stack[i].getMethodName() + " class: " + stack[i].getClassName() + " at " + new Integer(i).toString());
                    // this is a really simple check to see if this method was started from the t. package
                    // a good hacker can just create it's own package named t and take advantage of this method
                    // if this method was started from the same package there is no reason to make this method
                    // public, protected would work.
                    // there must be a better way to check if this method was called by "your" or "trusted" code
                    if(stack[1].getClassName().startsWith("t.")){
                         dosomePrivileged();
          private void dosomePrivileged(){
               System.out.println("this is the method that does privileged stuff");
     public static void main(String args[]) {
          new test();

Similar Messages

  • CodeBase for Applet called from Javascript

    I have a Search applet that is called from an HTML form in a browser when a button in the form is pressed. The Applet searches files in a folder/subfolders and uses a JSObject to create a new page for the browser with results. Up until recently I was using the plugin from jre 1.3.1 with the appropriate FilePermission entries in the .java.policy file and the applet worked as expected. IE if I added new folders to be searched, I had to add new entries to the policy file to give permission.
    I then installed jre 1.4.2 and the applet started getting Security problems stating the program did NOT have FilePermission. I tried several changes to the policy file and finally found that if I put the FilePermission entries in the empty(Global) codeBase the applet would work.
    What changed between jre 1.3.1 and 1.4.2?
    I would like to understand how the system works, ie where is the true codeBase and not cop-out with giving global permission.
    Any suggestions?
    Also the Java Tutorial shows a Windows syntax for a path (uses \) : C:\testing\-
    The policytool gets confused when I try to enter this. I use double \\ and it takes it OK when I do a Save. But later if I use policytool again to make changes somewhere else in the policy file, the \\ are removed and I end up with: C:testing- in the policy file. So I do it manually with an editor.
    Norm

    I would agree. Remember that the changes you make to the policy file apply to all applets that will ever be run on the system, not only to your applet.

  • Accessing Signed Applet Method From Javascript

    Hi All,
    In my intranet application i have to retrive the mac addres of the client using the applet. I have to capture the MAC Address and set it as a hidden value in the jsp page.
    I have used the signed applet and able to retrive the mac address of the client using IE but I am not able to do the same on NN 7.1
    Below is my javascript and the applet tag syntax, please help me if i am wrong anywhere
    function mac()
    var mval=document.myApplet.getWinMACAddress()
    alert("addres" +mval)                         
    document.loginform.js_value.value=mval
    and the applet tag in my jsp page is
    <applet code ="SignedAppletDemo.class" codebase="http://mysouthasia/AcadResource/jsp/" archive="SSignedApplet.jar" width=1 height=1 align=center name="myApplet" >
    </applet>
    Thanks in Advance

    Since getWinMACAddress( ) seems to work just fine for IE, is there an equivalent for NN7.1?
    What happens if I run Opera instead, and on a Linux system? Or Safari on OS X? Obviously getWinMACAddress( ) isn't going to work for that.
    I really don't understand why so many Asian programmers get "Find the MAC address of..." as a homework assignment. There are many reasons why it isn't really practical to do so, and for examples, just search this forum for MAC addresses. Lots and lots of examples and counter examples.

  • Invoking Applet methods from Javascript for Netscape 6

    Hi,
    I am trying to invoke an applet method from javascript, but it is failing with Netscape 6 browser:
    I am doing it the following way-
    function test(form)
    var i = document.myapplet.getname();
    where myapplet is the name of the applet and getname is a method within the applet. This is
    working with Ie but not with netscape 6.
    I would appreciate it if someone could tell me how should I invoke the applet method for netscape browsers.
    Thanks.
    Jay Srin.

    Not working with NS 6 - and will not i guess till they upgrade to Mozilla Version 1.0 - Live Connect is not implemented 100% correct yet - if you want you can download the 7.0 Pre Release Netscape - since its using mozilla 1.0 it should work , see :
    http://forum.java.sun.com/thread.jsp?forum=30&thread=272975

  • Hello i accidentally synced all my photos from Iphoto and they doubled, i removed them all eventually to re-import them again, but i have no camera folder anymore and i have a folder called "From Mac" how can i turn it back to normal?

    hello i accidentally synced all my photos from Iphoto and they doubled, i removed them all eventually to re-import them again, but i have no camera folder anymore and i have a folder called "From Mac" how can i turn it back to normal?

    That is normal for photos synced from a computer to a phone using iTunes. Synced photos were never placed in the Camera Roll. Additionally since iOS 8 there is no Camera Roll: http://appleinsider.com/articles/14/09/19/goodbye-camera-roll-where-to-find-your -photos-in-ios-8

  • I accidentally deleted some files from iCloud, how do I recover the files if I do not have other backup or in time machine

    I accidentally deleted some files from iCloud, how do I recover the files if I do not have other backup or in time machine

    You don't.

  • Applet function call from javascript

    Hi,
    I'm haveing a problem with accesing applet's functions from Javascript in Mozilla. IE works fine but in Mozilla I get the following error:
    Error: document.applets[0] has no properties
    The code used is: document.applets[0].test();
    The applet has the following 2 tags defined, I don't know if they are necessary here but I'm doing the reverse too (applet functions call javascript).
    <PARAM name="MAYSCRIPT" value="Y">
    <PARAM name="SCRIPTABLE" value="Y">
    If you have any ideea please help.
    Thanks

    in javascript try document.getElementById("idOfTheApplet")
    use object tag instead of applet tag:
         <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                  height="300" width="450" >
            <param name="code" value="appTest.class" />
            <!--[if !IE]> Mozilla/Netscape and its brethren -->
            <object classid="java:appTest.class"
                    height="300" width="450"
                    >
              <param name="mayscript" value=Y" />
            </object>
            <!-- <![endif]-->
          </object>or check out HtmlConverter.exe in the jdk bin dir.

  • Calling from javascript a method which uses accesscontroller.dopriviledged

    Hello everybody!
    I've a problem in accessing my pc resources from a signed applet when calling methods from Javascript.
    If I try from start() or init() methods, I can do it, but as soon as I try from anoter method defined by myself, it throws this me an AccessControlException:access denied.
    I googled and found that I should use this code:
    KeyStore smartCardKeyStore= (KeyStore)
                 AccessController.doPrivileged(
                           new PrivilegedExceptionAction() {
                             public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
                                 KeyStore alfa;
                                 alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
                                 alfa.load(null,null);//this is the point where it trhew the AccessControlException
                                 return alfa;
                         );The problem is that with this code, I can't get it work with Firefox (which doesn't throw any exception, just won't work!) neither with IE, which throws this:
    netscape.javascript.JSException: Nome sconosciuto.
    java.lang.Exception: netscape.javascript.JSException: Nome sconosciuto.
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)Please, help me! I'm in a big trouble, since I should finish my project asap and I am not able to pass this cumbersome obstacle...
    Thank you in advance! :)

    Hi! Don,
    You cannot call methods which breach Security from Javascript. That is what SUN says.
    But there is a hack, or a work around...
    Declare a boolean Variable , say named buttonClicked.
    Initailly keep its value false(default).
    Write an inner class that extends a thread class whose RUN method will contain the following piece of Code:
    public void run(){
        while(buttonClicked){
                     KeyStore smartCardKeyStore= (KeyStore)
                 AccessController.doPrivileged(
                           new PrivilegedExceptionAction() {
                             public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
                                 KeyStore alfa;
                                 alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
                                 alfa.load(null,null);//this is the point where it trhew the AccessControlException
                                 return alfa;
    }You start the Thread inner class in your init method.
    So, its RUN method will continuously be waiting to go into the while loop.
    And in your start method you will set the +"buttonClicked"+ variable to true upon a Javascript onclick event of a button.
    So, the moment you click a button, you only set the buttonClciked variable to true in your start method--------
    This does, in no way breach security. So no exception is thrown.. But the code which breaches security is initiated by another thread other than that spawned the Applet; so the browser does not care anything about its privileges. It just lets the execution of the code.
    I hope it works for you; be in contact, if it doesn't.
    Thanks and Regards,
    Samba

  • How to call a javascript method after table load on JSFF Fragment load?

    Hello,
    The usecase is to invoke a javascript method after table is done loading (fetching data) when user lands to a JSFF fragment. With JSPX pages I can achieve that by using PagePhaseListener. I have tried with RegionController as follows, and the problem i face is that I cannot prevent multiple calls to the Javascript call when user presses a tab or button in a screen, or changes drop-down value with autosubmit on.
    import javax.faces.context.FacesContext;
    import oracle.adf.model.RegionBinding;
    import oracle.adf.model.RegionContext;
    import oracle.adf.model.RegionController;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class MyListener implements RegionController{
    public MyListener() {
    super();
    @Override
    public boolean refreshRegion(RegionContext regionContext) {
    int refreshFlag = regionContext.getRefreshFlag();
    System.out.println("Render flag is: "+refreshFlag);
    if (refreshFlag == RegionBinding.PREPARE_MODEL)
    initializeMethod();
    regionContext.getRegionBinding().refresh(refreshFlag);
    return false;
    public boolean validateRegion(RegionContext regionContext) {
    regionContext.getRegionBinding().validate();
    return false;
    public boolean isRegionViewable(RegionContext regionContext) {
    return regionContext.getRegionBinding().isViewable();
    public void initializeMethod() {
    FacesContext f = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(f, ExtendedRenderKitService.class);
    service.addScript(f, "myJSFunction();");
    @Override
    public String getName() {
    return null;
    I need the javascript to be called only once after the table is done loading when user lands to a fragment (jsff).
    Any ideas appreciated?
    JDeveloper version is 11.1.1.5.0
    Thank you.
    Valon
    Edited by: Valon on Apr 11, 2013 3:10 PM

    One of the requirements is to compare every row with the next row and highlight the changes. There are other requirements as well where JavaScript solution is used.
    The question remains the same. Is it doable or not without changing the solution from JavaScript solution to server-side solution ? Can we call a JavaScript only once when the user lands to a jsff fragment ?
    Hope that is clear.
    Thanks.
    Valon

  • Applet called from netbeans TomcatServletExample

    How?
    I started with the netbeans Tomcat Servlet Example as a base and it works fine.
    I would like to load an applet created under the same project and placed into
    the TomcatServletExample.war or in a seperate project with a seperate jar archive.
    (I have tried both)
    I have added the TestApplet.html to the Servlet project and call it from the example index.html
    My TestApplet.html just can not find my applet code.
    The error is a
    load: class socapplets.AReflectance.class not found.
    My HTML looks something like the following, I have tried many combinations with and without the
    codebase.
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title>TestApplet</title>
    </head>
    <body>
    Test Applet<br>
    <br>
    <APPLET CODE="socapplets.AReflectance.class"
    archive="socApplets.jar"
         WIDTH=550 HEIGHT=450>
    </APPLET>
    </body>
    </html>
    Is there a simple way of loading an applet into an external browser under netbeans. This
    is just for development only. I hope to make the applet communicate back to one of my servlets.
    My Browser is Mozilla 1.7

    Followup to my own question.
    I finally got my applet to run by adding a jar archive containing the applet directly to
    my tomcat war archive. This is ok but not ideal. I wonder if this is a strange feature of the
    bundled Tomcat or netbeans. This maybe the wrong forum, but I do
    see others with applet class not found questions. This may help.
    Thank you.
    ~
    ~

  • PHONE CALL FROM BT HOW RUDE !!!!!!!!!!!!!!!!!!!!!!...

    I HAVE JUST TAKEN A CALL FROM BT REGARDING MY OUTSTANDING BILL 
    I EXPLAINED THAT I COULD NOT PAY TILL FIRDAY ( PAYDAY ) AS I HAVE NO MONEY ( TRUTH) CAN NOT GET AN EXTENSION TILL I HAVE MADE PART PAYMENT  - CANT DO THIS TILL FRIDAY  -  CAN NOT EXTEND !!!! I ASK TO SPEAK TO A SUPERVISIOR AND I WAS TOLD NO !!!  - HOW RUDE
    I THEN ASKED IF I COULD BE TRANSFERRED TO SALES TO DISCUSS MY PACKAGE AS I CAN NOT AFFORD £100 A MONTH.............. GOT TOLD NO UNLESS I PAY SOME OF MY BILL  - AGAIN TOLD HER I WAS SKINT !!  I ASKED AGAIN AND THEN SHE SAID SHE WOULD TRANSFER ME ,,,,,,,,,,,,,, AND PUT THE PHONE DOWN ON ME 
    THROUGHOUT MY CONVERSATION WITH HER SHE TRIED 5 TIMES TO PUT THE PHONE DOWN 
    I AM DISGUSTED AT THE SERVICE YOU RECIEVE ........ I AM DISGUSTED AT THE COST OF THE SERVICE THAT I RECEIVE............ 
    I AM NOT AFTER ANY SPECAIL CIRCUMSTANCES ( DISABLED) BUT I STRUGGLE TO ANSWER QUESTIONS AS I CAN NOT PROCESS THE QUESTION ASKED QUICK ENOUGH AND ALL THROUGH THE CONVERSATION SHE WAS RUSHING ME ..............................
    I SO WISH VIRGIN WAS IN MY AREA .........................
    I HOPE TO GET A REPLY TO THIS BY A MEMBER OF STAFF AS I HAVE POSTED BEFORE AND WAS IGNORED 

    The grass is not always more greener.
    Yep, living in the real world as i do makes me fully aware of that rather important fact.
    However, other providers being 'nearly' as bad is not an excuse for Bt to continue providing a service that doesnt match their promises.
    I had problems from day dot with bt selling me a package they later claimed didn't exist, & wasn't ever available through their website. They must've changed my order number almost half a dozen times trying to eradicated proof of my original purchase, & the 'so-called' mistake made in the online advertisement that apparently never existed....... exactly how something that they swear never happened can later be called a mistake by them is yet another stumper!.
    Lucky for me that i kept the transcript of the convo i had with the sales agent, hence eventually got my original deal.
    Fact is Bt are dishonest, their staff appear to be encouraged to lie & make customers feel that they're always at fault, wrong, liars, thick & generally unreasonable or impatient.
    The nonsense with getting through to India & unplugging cables, flicking switches, checking & changing wires etc etc.... is just a basic two finger insult to the intellect & true value Bt place on their paying customers.
    It seriously looks the only way to hope to get a result is to request (& in some cases beg) for help via this forum community, but even then its been noticed & noted' staff can & will be selective as to how & who they decide reply to!!!.
    And if you really think i'm wrong..... then have a better look at the nature of the 'majority' of posts made here by their customers.  

  • How do you CHANGE the location (away from Drive C) where Firefox stores temporary files?

    I know where Firefox stores temporary files. I want to CHANGE this location away from Drive C to decrease writes to an SSD. Thank you.

    Thank you.
    This function may be one of the few things that IE does better than Firefox. IE lets you change the temporary file location in Tools - Internet options - Settings. Firefox developers should make this task easier and put the instructions in the Help file where they can be easily found.
    Since I use an SSD for Drive C, I have learned that any file(s) that are frequently written to should be moved elsewhere to a conventional HDD.

  • I downloaded an Adobe file from my email but cannot find it on my hard drive or in recycle bin - it's in downloads but am unable to open from downloads - how can I recover the file?

    I downloaded an Adobe file from my email (service provider is MWeb) but now cannot find it on my hard drive and it's not in the recycle bin. It does, however, appear in Firefox downloads but I'm unable to open it from there. How can I recover the file?

    Thanks Rob.
    I actually had no clue what the core problem was caused by. So it's Windows itself...that helps some.
    I'll resubmit there. It might actually have saved time for it to simply have been moved to there instead of off-topic, though I suppose you have to follow protocol.

  • SAP GRC - Exporting rules from GRC - how to read the .txt file generated ?

    Hi there,
    I am using GRC Compliance Calibrator and have downloaded the default Global rules defined in Compliance Calibrator using the Rule Architect -> Utilities->Export rules.
    This gave me a massive txt file with a lot of tables and data. Reading through this forum, I did figure out that lines starting with M are the header rows for the tables and D rows are the data rows.
    My question is, how do i figure out what each of the Virsa tables stand for (e.g. VIRSA_CC_FUNCACT, VIRSA_CC_FUNCPRM) ?
    I tried SE11 and looking up these tables in the SAP environment associated with this CC install, however it says that the table was not found.
    Could someone please point me to :
    A) A list of the common Virsa CC tables and their descriptions ?
    OR
    B) How can i find what these tables stand for online or in the SAP environment?
    Many thanks !

    Hi Santosh,
    There is no option available to export only the customized rule sets to another system. The export rules option will give all the rules that are available in that system.
    You can do in the below manner
    a) Extract the data from Export rules
    b) Open that text file in a spreadsheet and edit the spreadsheet [Remove the rule sets & the rules not required in production system]
    c) Save the spreadsheet in UTF-8 text file
    d) Upload them in the production.
    The above procedure is bit complex and cumbersome -as changing the text file is risky. Even a space will not generate any rules in the RAR. I would suggest rename the new rule set in different naming convention and upload in your test environment before uploading the text files  in Production.
    But, using the Export and Import option you cannot upload only the customized rule set as the extract happens for the entire rules sets available in the system.
    Thanks and Best Regards,
    Srihari.K

  • JavaScript: How to check if a file exists.

    Hello Everybody,
    Can you tell me how to check if a file exists using JavaScript and Internet Explorer.
    Browsing on this website I could read about the command "f.exists()" and it was necessary to include "java.io.*".
    Should I use this same command and should I include the same files? Or are there other files and other commands?
    Thanks in advance.

    sorry ya. there is no command to check whether a file exists using javascript. The following code says the object name and value. But it can't say whether the file exists in the harddisk or .. Javascript cannot access database and system resources. If the file exists or not can be checked through the application (ASP, CFML, ..) you are using.

Maybe you are looking for

  • Dynamic Configuration of Mail-Sender does not work

    Hi, we use XI 3.0 SPS 19. In my szenario I have a mail sender and I have receiver determination with conditions depending on the mail subject. In the condition editor, I selected the context object "SHeaderSUBJECT" to build my condition. In the mail

  • Vista 64: boot camp 3.2/3.1 crashes

    Hi, i tried to install the 3.2 update of 64bit boot camp 3.2. Right after double clicking the exe a windows msg pops up saying: "installationprogram of apple boot camp update doesn´t work anymore" (translation from german!). I also tried to run the u

  • Multiple firewire cameras bandwidth calculatio​n

    Hi, all I saw the table of the maximum packet size based on the camera speed: Camera Speed Maximum cumulative packet size 100 Mbps 1024 bytes 200 Mbps 2048 bytes 400 Mbps 4096 bytes 800 Mbps* 8192 bytes I'm not clear with the calculation. If the came

  • Number of License Keys in Premiere Pro CS6 (Student)?

    I am looking at purchasing the Student Edition of Adobe Premiere Pro CS6 and wanted to know the number of License Keys it comes with. I am looking to put it on two of my computers and would rather purchase the non student edition if I can't get multi

  • 1:1 preview render - so slow u can't believe it

    I have LR 2.0 on a Powerbook G4 with 2GB ram and a 250GB HD (90GB still free). I experience extreme slowness in the use of the 1:1 preview, it takes sometime 40-50sec, sometime even 1 minute, before the 1:1 render is done and in fact this makes the 1