dclabel-0.0.4: The Disjunction Category Label Format

DCLabel.Safe

Contents

Description

This module exports a safe-subset of DCLabel.Core, implementing Disjunction Category Components. The exported functions and constructors may be used by untrusted code, guaranteeing that they cannot perform anything unsafe.

Synopsis

DC Components with EDSL

joinSource

Arguments

:: Lattice a 
=> a 
-> a 
-> a

Join of two elements, ⊔

meetSource

Arguments

:: Lattice a 
=> a 
-> a 
-> a

Meet of two elements, ⊓

topSource

Arguments

:: Lattice a 
=> a

Top of lattice, ⊤

bottomSource

Arguments

:: Lattice a 
=> a

Bottom of lattice, ⊥

canflowtoSource

Arguments

:: Lattice a 
=> a 
-> a 
-> Bool

Partial order relation, ⊑

data Component Source

A components is a conjunction of disjunctions, where MkComponentAll is the constructor that is associated with the logical False.

Constructors

MkComponentAll 
MkComponent 

Fields

component :: Conj
 

Instances

Eq Component

Components have a unique LNF (see ToLNF) form, and equality testing is perfomed on labels of this form.

Read Component 
Show Component 
Serialize Component 
Owns Component 
ToLNF Component

Reduce a Component to LNF. First it applies cleanComponent to remove duplicate principals and categories. Following, it removes extraneous/redundant categories. A category is said to be extraneous if there is another category in the component that implies it.

NewPriv Component 
PrettyShow Component 
CanDelegate Priv Priv 
CanDelegate Priv TCBPriv 
CanDelegate TCBPriv Priv 
NewDC String Component 
NewDC Principal Component 
NewDC Component String 
NewDC Component Principal 
NewDC Component Component 
ConjunctionOf String Component 
ConjunctionOf Principal Component 
ConjunctionOf Component String 
ConjunctionOf Component Principal 
ConjunctionOf Component Component 
ConjunctionOf Component Disj 
ConjunctionOf Disj Component 
DisjunctionOf String Component 
DisjunctionOf Principal Component 
DisjunctionOf Component String 
DisjunctionOf Component Principal 
DisjunctionOf Component Component 

data DCLabel Source

A DCLabel is a pair of secrecy and integrity category sets, i.e., a pair of Components.

Constructors

MkDCLabel 

Fields

secrecy :: Component

Integrity category set.

integrity :: Component

Secrecy category set.

Instances

Eq DCLabel 
Read DCLabel 
Show DCLabel 
Serialize DCLabel 
RelaxedLattice DCLabel 
ToLNF DCLabel

Each DCLabel can be reduced a unique label representation in LNF, using the toLNF function.

Lattice DCLabel

Elements of DCLabel form a bounded lattice, where:

PrettyShow DCLabel 

newtype Disj Source

A category, i.e., disjunction, of Principals. The empty list '[]' corresponds to the disjunction of all principals. Conceptually, [] = [P_1 ⋁ P_2 ⋁ ...]

Constructors

MkDisj 

Fields

disj :: [Principal]
 

Instances

Eq Disj 
Ord Disj 
Read Disj 
Show Disj 
Serialize Disj 
Owns Disj 
PrettyShow Disj 
ConjunctionOf String Disj 
ConjunctionOf Principal Disj 
ConjunctionOf Component Disj 
ConjunctionOf Disj String 
ConjunctionOf Disj Principal 
ConjunctionOf Disj Component 
ConjunctionOf Disj Disj

Instances using disjunctions.

newtype Conj Source

A category set, i.e., a conjunction of disjunctions. The empty list '[]' corresponds to the single disjunction of all principals. In other words, conceptually, [] = {[P_1 ⋁ P_2 ⋁ ...]} Logically '[]' = True.

Constructors

MkConj 

Fields

conj :: [Disj]
 

data Principal Source

Principal is a simple string representing a source of authority. Any piece of code can create principals, regarless of how untrusted it is. However, for principals to be used in integrity components or be ignoerd a corresponding privilege (TCBPriv) must be created (by trusted code) or delegated.

Instances

Eq Principal 
Ord Principal 
Read Principal 
Show Principal 
Serialize Principal 
DisjToFromList Principal

To/from Principals and Disjunction categories.

NewPriv Principal 
Singleton Principal 
PrettyShow Principal 
NewDC Principal Principal 
NewDC Principal Component 
NewDC Component Principal 
ConjunctionOf Principal Principal 
ConjunctionOf Principal Component 
ConjunctionOf Principal Disj 
ConjunctionOf Component Principal 
ConjunctionOf Disj Principal 
DisjunctionOf Principal Principal 
DisjunctionOf Principal Component 
DisjunctionOf Component Principal 

principal :: ByteString -> PrincipalSource

Generates a principal from an string.

singletonSource

Arguments

:: Singleton a 
=> a 
-> Component

Creates a singleton component.

listToDisjSource

Arguments

:: DisjToFromList a 
=> [a] 
-> Disj

Given list return category.

disjToListSource

Arguments

:: DisjToFromList a 
=> Disj 
-> [a]

Given category return list.

listToComponentSource

Arguments

:: [Disj] 
-> Component

Given list return category.

Given a list of categories, return a component.

componentToListSource

Arguments

:: Component 
-> [Disj]

Given category return list.

Given a component return a list of categories.

(.\/.)Source

Arguments

:: DisjunctionOf a b 
=> a 
-> b 
-> Component

Given two elements it joins them with ⋁

(./\.)Source

Arguments

:: ConjunctionOf a b 
=> a 
-> b 
-> Component

Given two elements it joins them with ⋀

(<>) :: ComponentSource

Empty component (logically this is True).

(><) :: ComponentSource

All component (logically this is False).

newDCSource

Arguments

:: NewDC a b 
=> a 
-> b 
-> DCLabel

Given two elements create label.

Privilegies

data TCBPriv Source

Privilege object is just a conjunction of disjunctions, i.e., Component. A trusted privileged object must be introduced by trusted code, after which trusted privileged objects can be created by delegation.

type Priv = ComponentSource

Untrusted privileged object, which can be converted to a TCBPriv with delegatePriv.

canflowto_p :: RelaxedLattice a => TCBPriv -> a -> a -> BoolSource

Relaxed partial-order relation

delegatePriv :: TCBPriv -> Priv -> Maybe TCBPrivSource

Given trusted privilege and a "desired" untrusted privilege, return a trusted version of the untrusted privilege, if the provided (trusted) privilege implies it.

canDelegate :: CanDelegate a b => a -> b -> BoolSource

Can use first privilege in place of second.

owns :: Owns a => TCBPriv -> a -> BoolSource

Checks if category restriction can be bypassed given the privilege.

class NewPriv a whereSource

Class used to create Privs and TCBPrivs.

Methods

newPriv :: a -> PrivSource

Given element create privilege.

newTCBPriv :: TCBPriv -> a -> Maybe TCBPrivSource

Given privilege and new element, create (maybe) trusted privileged object.

noPriv :: TCBPrivSource

Privilege object corresponding to no privileges.