Security Design 

Overall
Capability design ..

A capability style design using references as Capabilities . In some cases we will use seperate Capability objects. 

Are these Capabilities unforgeable / Immutable ? 

Secure Objects must have all internal or private constuctors hence cannot be created except by the assembly which contians the type we hope for the compiler to check this.

Note references can be set to a different  object of the same type but this does not invalidate the security model.

How to do Backups ? 

Backups are performed by the file system via a Backup capability.

How are Capabilies references revoked ?

Every Secure  Object has an IsNull Field that should be checked. Calling Dispose on the object will ensure all rights are revoked.

How are Capabilities stored and Persisted.

Capabilities are persisted to a file that only the Persister and Backup has a Capability to access. This should be encrypted later. Note this can be compromised by physical access to the machine but so can any OS.

Note the case of persisting a process and a Capability being revoked.

If Capabilities are references how can this be persisted ?

An binary (or debug  XML) representation will preserve references from a Key RIng. 

Are there Capability Objects ?

Sometimes. This is not needed but is sometimes convenient eg System.IO.File will point to an actual File with an internal pointer.  The Framework requires these objects but the structure may be insecure ( eg public construtuctor) and hence wrap a secure private reference to the real object .

How are Capabilities Granted /Created

Each service manages its own capabilities. The File System has all Directory and File Objects and hands out references when needed.  It Can grant these to Users ,Groups ,  AppDomains or anything the designer desires. 

The OS Loader establishes some initial permissions eg the Service Manager requires it to load the services. However this is only on first boot / on test systems.

What is in the Trusted Base ?

This includes a number of services that are trusted by the system . It includes all unmanged code ( eg the Collector) , Plugged code and the compiler. 

How does the IPC work with security.

Certain high critical services will use the Pipes with Message parsing CDC system . This hides the internal implementation and provides additional security. It is up to the service what security design to implement.

How are objects persisted

All capabilites are persisted objects . An application can  have persisted stated if all its data objects are persisted objects. Note the Store/Load  and capability base class are in the same assembly and the logic is internal.  Note 3 persistance modes 
	- None   
	- OnPropertyChanged   
	- Batched  ( changes based On Property Changed but batched with other object changes) 

How does CIL Security work.

The Linker.Dynamic loader ensures security as private members ( CIL private = C# internal) are not exposed and hence can not be called. Hence callers cannot manipulate the assembly unless the developer inadvertantly uses the wrong access. ( For critical assemblies the message parsing CDC is recommend as it hides the internal implementation and hence makes it more secure )  

Least Priviledge 

OO apps generally use privilige for a short period we should make more use of this.

What secure service are there ? 

None . A lot of security breaches come from trusted services . There are no trusted services and Applications and services are treated the same. Note also there are no security layers. 

What does the Kernel have access to ? 

There is no kernel ( Ok you can cosnider the HAL and the schedulign primatives the kernel) 

Access Rights 

There are really a number of Models here  ( R = Reference ) 

Option1) 
R ->           Shared File Class  ( with ACL)

Option2) 
R ->       Read Rights File wrapper  ->    Shared file class
R ->       Read Rights File wrapper  ->    file class

Option3) 
Capability ( R + Right)   -> Shared File Class
Capability ( R + Right)   -> File Class

Option4)  Use interface of the shared ob
R->      (ReadOnlyInterface) Shared File Class

Option 3 is used where complex securities are needed It is just a reference with some rights. 

Option 2 may be used where access is a simple mechanism ( rights/no rights) . 

Option 4 is not viable as the interface could be case as an object and then cast as a type with different rights eg ReadWriteInterface.
A program must not be able to cast to object and back to version of a class with different rights and hence encapsulating the "System Object" is best.

Then again Option 2 and Option3 are similar . Note teh ReadRightsFileWrapper has rights and is a reference.  The difference is with Option 3 the Capability is stored in the user program. In option 2 only the reference is in the user program.  I think Option 2 will be more secure and lead to less thread contention as sometimes we dont need shared objects. 

How does it work with persistace? 

The wrapper classes should contain NOTHING more than a internal reference and accessability should be done via public methods.  These objects should be granted on a per thread bases but the Capabilities can be copied from the app domain. 

Persisting these capabilities is an issue . We have the option of storing the Read Rights File in the user App Domain or in the service.  As the objects are 1/thread and persistant there is no issue with Garbage Collection.  I think its best to store them in the service .  When connecting to the app domain the thread can use its Keyring Capability and load all references into the threads KeyRing. Note the Keyring and the actual persistance is done in the trusted base but the types will be internal and best created by the service.

This leads to a weird RPC style API however eg  ReadableFile.Open(). Though SendMessage ( new OpenFileMessage(ReadableFIle)  is  possible.  MMm this may be best it allows an RPC style if the  service developer desires . Or a Message stle , since the methods can then be internal the service simply calls them.  ie The internal design is not exposed which is always a good thing in software design.