B
Ben
Keith Patrick said:Comparing the granularity of security would be interesting. I never got the
opportunity to really delve into Java security (my work there was primarily
in UIs, plus when I started, there was a mentality of "It's Java, so it's
secure."), so I think it would be interesting to see where Java has come vs.
where .Net is with regards to code access security.
Interesting you should mention that. Code access security seems to be
touted as a new thing. In fact, it seems that you could do very similar
things in Java since JDK1.2. For instance, taking the list of CAS features
from:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconintroductiontocodeaccesssecurity.asp
Am I missing the point of CAS somewhere? What does .NET security offer
which is actually new?
1. Defines permissions and permission sets that represent the right to
access various system resources:
- Java has a hierarchy of extensible permission objects which encapsulate
the individual complexities of permission sets such as File access and Web
access. Permissions can be grouped into sets and assigned to
ProtectionDomains (analogous to ApplicationDomains)
2. Enables administrators to configure security policy by associating sets
of permissions with groups of code (code groups):
- System administrators can toggle these permissions on and off at a similar
granularity to .NET. The code group abstraction is there too, albeit
indirectly.
3. Enables code to request the permissions it requires in order to run, as
well as the permissions that it would be useful to have, and specifies which
permissions the code must never have:
- I don't understand why it's useful to request permissions, as they will be
granted by default if the local policy allows, right? Unfortunately I don't
think Java can programmatically refuse certain permissions. Nonetheless,
Java can check runtime permissions to handle any shortfall in permissions
gracefully.
4. Enables code to demand that its callers have specific permissions.
5. Enables code to demand that its callers possess a digital signature,
thus allowing only callers from a particular organization or site to call
the protected code.
- Not too sure about these in Java.
6. Enforces restrictions on code at run time by comparing the granted
permissions of every caller on the call stack to the permissions that
callers must have.
- For every privelleged operation the call stack will be traversed and
permissions checked. There is also the concept of 'privelleged code' which
I think is similar to permission assertions in .NET.
Ben