securitymanager

How to automatically copy data to new RMI threads ?

Hello, I am adapting a little rmi client-server application. I have written several things : HelloInterface -> A Hello World interface for RMI Server -> The server app' Client -> The client app' Nothing special, but... I have put my hands in a new RMISecurityManager, which calls a JNI method and checks the permission for a separate us...

How to set a SecurityManager for this thread and not for System ?

Hello, I have a program that is running a basic RMISecurityManager in all its threads. But I would like to do more control to several threads and set another SecurityManager specially for these threads. How can I do that ? ...if this is possible !? thank you by advance. Edit : I have found my solution. See here for more details. ...

SecurityManager.IsGranted() behaviour

Hi, can anybody please explain the following c# behaviour? I have written a small console application just to learn about CAS, but I can not seem to understand why the following lines of code work like they do: string[] myRoles = new string[] { "role1", "role2", "role3" }; GenericIdentity myIdentity = new GenericIdentity("myUsername", ...

Disable Java reflection for the current thread

I need to call some semi-trustworthy Java code and want to disable the ability to use reflection for the duration of that code's execution. try{ // disable reflection somehow someObject.method(); } finally{ // enable reflection again } Can this be done with a SecurityManager, and if so, how? Clarification/Context: This is ...

How do I simulate a modal dialog from within an Applet?

On setVisible(true), I call the following code to start a modal dialog: private synchronized void startModal () { try { if (SwingUtilities.isEventDispatchThread()) { EventQueue theQueue = getToolkit().getSystemEventQueue(); while (isVisible()) { AWTEvent event = theQueue.getNextEvent(); Object source = ...

Access non-public classes in sun.awt package [specifically: FetcherInfo]

Question: I have some performance problem in my app - and the bottleneck is sun.awt.image.ImageFetcher.run, and I canno't get any (more) meaningfull info from profiler. So I figured that it would be nice to look at jobs that ImageFetcher is doing. I couldn't get access to FetcherInfo class, that holds all ImageFetcher jobs. To obtain ...

Use Tomcat with Java SecurityManager?

I'm writing a web application that is supposed to run on Tomcat on Ubuntu. On Ubuntu, Tomcat is per default configured to run with the Java SecurityManager. Besides my own web application, there will only be some well known third party web applications related to my own, like the BIRT report engine. If one of the web applications fails ...

How to configure Java SecurityManager to allow to read all properties from given file

I'm currently trying to create a policy file for the Nexus repository manager running on Tomcat. Nexus tries to read the file WEB-INF/plexus.properties (for which I already granted permission), and seems to try to read all properties from there, which fails because it is missing the following permission: java.security.PropertyPermissio...

How to give JSP permissions with SecurityManager policy file in Resin?

We are trying to use SecurityManager with Resin 3.1.9 and run into the following problem: CodeSource.getLocation() returns null for compiled JSPs. This means that we cannot use a specific codebase in grant clause in our policy file, for example: grant codeBase "file:/path_to_resin/runtime/work/-" { OR grant codeBase "file:/path_to_resi...

Should I use Security Manager in Java web applications?

Is it sufficient to secure a Java web application with the rights of the user that is running the application server process or is it reasonable also to use SecurityManager with a suitable policy file? I have used to do the former and not the latter, but some customers would like us to also use SecurityManager that would explicitly give...

AccessControlException when connecting to HTTP server from Tomcat servlet

I'm trying to make my tomcat servlet download a number of files, but I have apache and tomcat running on the same server, so I assume that is why it doesn't work. I've tested on servers not running apache, and all is well. Here's the exception I'm getting when I try to use new Url( fileUrl ).openStream(): Opening input stream Attempte...

How to unit test Java code that is expected to run within an applet Security Manager

I have some Java library code which sometimes runs as an unsigned applet. Because of this it is not always allowed to do some operations (for instance checking for system properties). I would like to run some unit tests with an Applet-like security manager so that I can verify that the code is either not performing any restricted oper...

Is there a way for a SecurityManager in java to selectively grant ReflectPermission("suppressAccessChecks")?

Is there any way for a SecurityManager in Java to selectively grant ReflectPermission("suppressAccessChecks") depending on the details of what setAccessible() is being called on? I don't see any way for this to be done. For some sandboxed code, it would be very useful (such as for running various dynamic JVM languages) to allow the setA...

Small and fast .NET programs? - 65% runtime in ResolvePolicy

Hi, I tried to build a very very small .NET app in F#. It just has to convert a small string into another string and print the result to the console like: convert.exe myString ==> prints something like "myConvertedString" I used dottrace to analyze the performance: 26% (168ms) in my actual string conversion (I thinks this is ok.) ...

Other SecurityManager implementations available?

Is there any other implementation (e.g. in an OSS project) of a Java SecurityManager available which has more features than the one in the JDK? I'm looking for features like configurable at runtime policies updateable at runtime, read from other data sources than a security.policy file Thread-aware, e.g. different policies per Thread ...

How to avoid recursion in Java SecurityManager checkConnect?

I'm trying to take control of a Java code base that does lots of un-documented things. I'm using a custom SecurityManager to check permission requests. Specifically, my code is checking SocketPermission checks -- checkConnect. checkConnect is called when the application tries to resolve a host name to IP address and to connect to a spec...

How to sanely configure security policy in Tomcat 6

I'm using Tomcat 6.0.24, as packaged for Ubuntu Karmic. The default security policy of Ubuntu's Tomcat package is pretty stringent, but appears straightforward. In /var/lib/tomcat6/conf/policy.d, there are a variety of files that establish default policy. Worth noting at the start: I've not changed the stock tomcat install at all --...

Java Security Manager for JRuby

When using Java Security Manager for Jruby scripts, Is it possible give a particular script alone full permissions? ...

Alternative to policy files when granting permissions?

Is it possible to grant Permissions through something other than a policy file? What I'd like to achieve is a permissions-based system that can be modified at runtime. ...

Tomcat configuration for Spring app.

Hello, I have built web application for use in Tomcat. It depends on Spring. I have the following exception when trying to access it: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader) I read tomcat docs, and found that I need to configure security. I added following lines to "/usr/sha...