tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Nielsen <>
Subject Re: [Security Audit] CoyoteRequest.doGetSession
Date Wed, 16 Oct 2002 17:36:46 GMT
Jean-Francois Arcand wrote:
> Glenn Nielsen wrote:
>> The doPrivileged() for getting a session is in the CoyoteRequest 
>> public getSession()
>> method which is implemented as required by ServletRequest and 
>> HttpServletRequest. 
> I'm unable to find the information in the spec. Can you point me to the 
> section where the discuss the required privilege? My understanding is 
> the doPrivilege block is needed only if you want to serialize/store the 
> session. If you don't, then you don't need it. If you run Tomcat as it 
> is right now (with the security manager), then you don't need the extra 
> call.

How Session's are persisted is up to the container, not in the spec.
Tomcat has in o.a.c.session two different Store's, a file Store and
s store which uses JDBC. Plus an administrator could write their own
custom Manager/Store and configure it in server.xml.

In my testing of Tomcat with a very strict security policy and the default
session manager that doPrivileged() was needed.  If it hadn't been needed,
it wouldn't be there. It would definitely be needed if JDBCStore was used.
PersistentManagerBase() can swap in/out sessions as needed with the Store.
This would fail if the doPrivileged() block were not there and a web app
tried to get a Session which had been swapped out to disk or db.

>> The getSession() can be called by a web application.  The 
>> doPrivileged() block would
>> be required to exist either where it currently is or in each 
>> individual implementation
>> of Manager/Store.  If it wasn't there getting a session would fail if 
>> the web app
>> were not granted the necessary permissions.  Permissions I would not 
>> want to grant to it.
> Not in the current implementation. Since the default Manager do not need 
> any special permission, the doPrivilege block is not required.
>> IMHO it is best left where it is.  If someone were to implement a 
>> custom Manager/Store
>> then the permissions allowed at that point would be the intersection 
>> of those permissions
>> granted to catalina and those granted to the codeBase for the custom 
>> Manager/Store.
>> So you still have your fine grained control of security policies.
>> That is how it should work.
> Well, every Manager have a large set of permissions granted by default. 
> I personnaly prefer limitting the permission set instead of granting 
> everything (like the current implementation). Also, the doPrivilege 
> block (as implemented right now) do not contains anything that require 
> special permissions. The doPrivilege block is a performance penalty, and 
> the block is way too big ( for security reasons ). See 
> for more info.

All the doPrivileged call does is reset what ProtectionDomains are checked
by the AccessController checkPermissions.  Yes, there is overhead when calling 
doPrivileged(), but there are times when this is needed, and this is one of 
them.  In regards to the size of the block of code executed within a 
doPrivileged() that is from the standpoint of security, i.e. all code now
being executed has more permissions granted so you have to make sure that
the code which triggered the doPrivileged() can't bypass security.  That
is not so in this case.

> Right now, every Manager are granted by default whatever they want. If I 
> want to denied ManagerA file permissions, I have no way to do it right 
> now...right?

No, every manager is not granted whatever they want.  The Manager/Store which
come with Tomcat are granted whatever permissions are granted to catalina.jar.
A custom Manager/Store is allowed whatever permissions were granted to it in
the catalina.policy for it's codeBase.

Still -1 for changing/removing the doPrivileged()



Glenn Nielsen    | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message