NAnt code can only do what the machine administrator allows because code
access security is checked by the CLR against the framework no matter
what you do.  The only reason we've never run into it is that with the
default .NET configuration assemblies on the local machine are fully
trusted and can do everything.  If an administrator tightened this down,
parts of NAnt would stop working.

Attributing your code is only necessary if you want to tighten things
down further or you want to implement some special code access
permissions.  To be honest, I can't see where this is necessary with
NAnt.  For example, a task that does any kind of FileIO would get
checked for FileIOPermission by the runtime.  Perhaps you have some
ideas?

Asserting permissions in code is really only necessary if you want to
add extra permission checks, check against custom permissions or if you
want to be able "fall back" if you don't have some permission you need.
For example, you assert FileIOPermission on a folder and if you don't
get it you might fall back to using isolated storage.  It is also useful
when you want to do fancy stuff with impersonation and you don't want
.NET checking all the way up to the caller for code permission.  For
example, you might build a DLL that does certain administrative tasks on
behalf of caller that don't have the permission the DLL has.  In that
case, there are ways to make sure that code access checks or a specific
code access check in that DLL do not walk the call stack.  Obviously,
you have to take great care in that kind of scenario because that DLL
could be exploited.  In any case, I don't think that is a relevant
scenario for NAnt.

>From a security perspective, one of the most useful things to do is to
strongly name assemblies.  This guard against all sorts of things
including untrusted callers and, if you grant permission to the strongly
named assembly, Trojans.  It also allows the administrator to grant
permissions to a specific assembly coming from a given zone (e.g. local
machine) without granting permissions to all assemblies in that zone or
even to all versions of that assembly in that zone.  However, this
probably isn't something you can really do with open source because you
are distributing source and people have to be able to build it; I can't
see how you could avoid distributing the key pair used in the signing
process.

6) NAnt runs on Mono.  Does Mono have code access security?

Thanks
-------------------------------------
TFC
 
-----Original Message-----
From: Scott Hernandez [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 19, 2003 4:43 PM
To: [EMAIL PROTECTED]

I'd like to start littering our code with declarative security
statements.
It would be good to start to lock down what nant needs from a security
point
of view so we can easy make a statement like our code is secure.

Does anyone have much experience with .net declarative security and the
best
approach to the goal of making a statement like "our app is secure". Or
at
least be able to identify the unsafe (with respect to security) sections
of
code that need special permissions. I would like to see 3rd party tasks
follow some security guidelines as well.

We run pretty liberal right now with access to reflection and other
internal
access in the framework I would guess.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to