dclabel-0.0.2: The Disjunction Category Label Format

DCLabel.Safe

Contents

Description

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

Synopsis

DC Labels 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 Label Source

A label is a conjunction of disjunctions, where MkLabelAll is the constructor that is associated with the conjunction of all possible disjunctions.

Constructors

MkLabelAll 
MkLabel 

Fields

label :: Conj
 

Instances

Eq Label

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

Read Label 
Show Label 
Owns Label 
ToLNF Label

Reduce a Label to LNF. First it applies cleanLabel 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 label that implies it.

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

data DCLabel Source

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

Constructors

MkDCLabel 

Fields

secrecy :: Label

Integrity category set.

integrity :: Label

Secrecy category set.

Instances

Eq DCLabel 
Read DCLabel 
Show 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:

  • ⊥ = <emptyLabel, allLabel>
  • ⊤ = <allLabel, emptyLabel>
  •  <S_1, I_1> ⊔ <S_2, I_2> = <S_1 ⋀ S_2, I_1 ⋁ I_2>
  •  <S_1, I_1> ⊓ <S_2, I_2> = <S_1 ⋁ S_2, I_1 ⋀ I_2>
  •  <S_1, I_1> ⊑ <S_2, I_2> = S_2 => S_1 ⋀ I_1 => I_2
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 
Owns Disj 
PrettyShow Disj 
ConjunctionOf String Disj 
ConjunctionOf Principal Disj 
ConjunctionOf Label Disj 
ConjunctionOf Disj String 
ConjunctionOf Disj Principal 
ConjunctionOf Disj Label 
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 ⋁ ...]}

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 labels or be ignoerd a corresponding privilege (TCBPriv) must be created (by trusted code) or delegated.

Instances

Eq Principal 
Ord Principal 
Read Principal 
Show Principal 
DisjToFromList Principal

To/from Principals and Disjunction categories.

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

principal :: String -> PrincipalSource

Generates a principal from an string.

singletonSource

Arguments

:: Singleton a 
=> a 
-> Label

Creates a singleton label.

listToDisjSource

Arguments

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

Given list return category.

disjToListSource

Arguments

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

Given category return list.

listToLabelSource

Arguments

:: [Disj] 
-> Label

Given list return category.

Given a list of categories, return a label.

labelToListSource

Arguments

:: Label 
-> [Disj]

Given category return list.

Given a label return a list of categories.

(.\/.)Source

Arguments

:: DisjunctionOf a b 
=> a 
-> b 
-> Label

Given two elements it joins them with ⋁

(./\.)Source

Arguments

:: ConjunctionOf a b 
=> a 
-> b 
-> Label

Given two elements it joins them with ⋀

(<>) :: LabelSource

Empty label.

(><) :: LabelSource

All label.

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., a Label. A trusted privileged object must be introduced by trusted code, after which trusted privileged objects can be created by delegation.

type Priv = LabelSource

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.