Does AccessController.doPrivileged give JavaScript threads the permissions of the signed Applet?

前端 未结 2 1066
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-14 02:14

I\'m looking at a signed Applet that is heavily called from JavaScript. Obviously, the threads that originate from JavaScript are more heavily sandboxed than any thread started

2条回答
  •  孤城傲影
    2021-02-14 02:44

    I'd go with the doPrivileged. Just be aware that everybody that has access to your applet can download it and put it on their site and have their own malicious javascript call it in ways you didn't imagine.

    The security implications of the other solutions are pretty much the same (EDIT: although creating a new Thread doesn't work, as Longpoke pointed out), but they are more complicated. So I don't see any advantage with them.

    The AccessController.doPrivileged considers the protection domain of just the immediate caller. In your example, the class where your method someMethodCalledFromJavaScript is defined. If this a trusted class in the signed jar, it doesn't matter that the untrusted Javascript is calling it.

提交回复
热议问题