Type-Based Information Flow Analyses Franc ois Pottier January - - PowerPoint PPT Presentation

type based information flow analyses
SMART_READER_LITE
LIVE PREVIEW

Type-Based Information Flow Analyses Franc ois Pottier January - - PowerPoint PPT Presentation

Type-Based Information Flow Analyses Franc ois Pottier January 2728, 2005 Franc ois Pottier Type-Based Information Flow Analyses Why control information flow? identity income tax form secretary Bob fiscal counselor Here is a


slide-1
SLIDE 1

Type-Based Information Flow Analyses

Franc ¸ois Pottier January 27–28, 2005

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-2
SLIDE 2

Why control information flow?

Bob identity income tax form fiscal counselor secretary Here is a common real life scenario.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-3
SLIDE 3

Why control information flow?

Bob identity income tax form fiscal counselor secretary Bob wishes the secretary to have no idea of his income.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-4
SLIDE 4

Why control information flow?

Bob identity income tax form fiscal counselor secretary Bob has to trust his counselor.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-5
SLIDE 5

Why control information flow?

Bob identity income tax form computer system secretary The fiscal counselor is replaced...

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-6
SLIDE 6

Why control information flow?

Bob identity income tax form computer system secretary Access control does not help: Bob must still trust the system not to leak information.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-7
SLIDE 7

Why control information flow?

Bob identity income tax form computer system secretary Information flow control requires the computer system to conform to Bob’s confidentiality policy.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-8
SLIDE 8

Why control information flow?

Bob identity income tax form

fiscal counselor software

secretary Language-based information flow control consists of an analysis

  • f a single piece of software with a well-defined semantics.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-9
SLIDE 9

Why control information flow?

Bob identity income tax form

fiscal counselor software

secretary The property that Bob desires is noninterference: even if he were to supply a different income figure, the secretary wouldn’t be able to tell the difference. In other words, the data sent to the secretary does not depend on Bob’s income.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-10
SLIDE 10

Why control information flow?

Bob identity income tax form

fiscal counselor software

secretary L L H H To specify this property succinctly, one assigns ordered informa- tion levels to each input and output channel – here, L < H – and one allows information to flow up only.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-11
SLIDE 11

Why control information flow?

Bob identity income tax form

fiscal counselor software

secretary L L H H The specification may take the form of a type, such as stringL × intH → stringH × stringL

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-12
SLIDE 12

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Part I Information flow in pure functional languages

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-13
SLIDE 13

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-14
SLIDE 14

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-15
SLIDE 15

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The untyped λ-calculus

A core calculus intended to model the semantics of programming languges. Its syntax is: e ::= x | λx.e | e e | () | inji e | e case x ≻ e e | (e, e) | proji e A typical operational semantics is: (λx.e1) e2 → e1[e2/x] proji (e1, e2) → ei inji e case x ≻ e1 e2 → ei[e/x] plus rules for reduction under a context.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-16
SLIDE 16

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Types

Types are intended to partition expressions and values into categories. t ::= t → t | unit | t + t | t × t Typing environments map variables to types. Γ ::=

  • | Γ; x : t

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-17
SLIDE 17

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The simply-typed λ-calculus

Typing judgements relate typing environments, expressions, and

  • types. A typing judgement is of the form

Γ ⊢ e : t For instance,

  • ⊢ λx.x : t → t

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-18
SLIDE 18

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The simply-typed λ-calculus (cont’d)

Typing judgements are inductively defined by a set of typing rules. Γ(x) = t Γ ⊢ x : t Γ; x : t1 ⊢ e : t2 Γ ⊢ λx.e : t1 → t2 Γ ⊢ e1 : t2 → t Γ ⊢ e2 : t2 Γ ⊢ e1 e2 : t . . .

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-19
SLIDE 19

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The simply-typed λ-calculus (cont’d)

. . . Γ ⊢ () : unit Γ ⊢ e : ti Γ ⊢ inji e : t1 + t2 Γ ⊢ e : t1 + t2 ∀i ∈ {1, 2} Γ; x : ti ⊢ ei : t Γ ⊢ e case x ≻ e1 e2 : t ∀i ∈ {1, 2} Γ ⊢ ei : ti Γ ⊢ (e1, e2) : t1 × t2 Γ ⊢ e : t1 × t2 Γ ⊢ proji e : ti

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-20
SLIDE 20

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Type safety

Values represent the normal outcome of a computation: v ::= λx.e | () | inji v | (v, v) An irreducible term that is not a value is stuck. It represents a runtime error. For instance, proj1 (λx.x) () case x ≻ v1 v2 Type safety states that a well-typed term cannot reduce to a stuck term.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-21
SLIDE 21

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The syntactic approach to type safety

Type safety is a safety property: it states that some “bad” configurations are unreachable. It can be established by proving that reduction preserves types, and a well-typed term cannot be stuck.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-22
SLIDE 22

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

On types and noninterference

Types are interesting, but noninterference is not a safety property: it requires relating two processes in execution. How does one attack it? What is the meaning of security annotations, i.e. how does the interpretation of intL differ from that of intH?

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-23
SLIDE 23

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-24
SLIDE 24

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

For simplicity, I assume that the security lattice L consists of two levels L and H, ordered by L ≤ H. Next, I will move to the general case.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-25
SLIDE 25

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Syntax

DCC is a call-by-name λ-calculus with products and sums, extended with two constructs that allow marking a value and using a marked value. e ::= x | λx.e | e e | . . . | H : e | use x = e in e t ::= t → t | unit | t + t | t × t | H(t) In the semantics, these constructs are no-ops. DCC was proposed by Abadi, Banerjee, Heintze and Riecke (1999), drawing on existing ideas from binding-time analysis.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-26
SLIDE 26

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Types

DCC is a standard simply-typed λ-calculus. Only the two new constructs have nonstandard typing rules.

Mark

Γ ⊢ e : t Γ ⊢ (H : e) : H(t)

Use

Γ ⊢ e1 : H(t1) Γ; x : t1 ⊢ e2 : t2 ⊳ t2 Γ ⊢ use x = e1 in e2 : t2 When marking a value, its type is marked as well. When using a marked value, the mark is taken off its type, but the end result must have a protected type.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-27
SLIDE 27

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types

The predicate ⊳ t (“t is protected”) is defined inductively. Intuitively, the information carried by a value of a protected type t must be accessible only to high-level observers. Protected types form a superset of the marked types, that is, every marked type is protected: ⊳ H(t) Furthermore, some types that do not carry a mark at their root may safely be considered protected.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-28
SLIDE 28

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Example

Define bool as unit + unit. Define if, true, and false accordingly. This function negates a high-security Boolean value: λx.use x = x in H : (if x then false else true) : H(bool) → H(bool)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-29
SLIDE 29

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types, continued

For instance, a function type is protected if its codomain is protected: ⊳ t2 ⊳ t1 → t2 This makes intuitive sense because the only way of obtaining information out of a function is to observe its result.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-30
SLIDE 30

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types, continued

A product type is protected if both its components are protected: ⊳ t1 ⊳ t2 ⊳ t1 × t2 This makes intuitive sense because the only way of obtaining information out of a pair is to observe its components.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-31
SLIDE 31

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types, continued

The unit type is protected: ⊳ unit This makes intuitive sense because there is no way of obtaining information out of the unit value.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-32
SLIDE 32

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Towards a noninterference result

How do we prove that the type system enforces noninterference properties? The original DCC paper uses a standard denonational semantics

  • f the simply-typed λ-calculus and enriches it with partial

equivalence relations (PERs). Tse and Zdancewic’s recent papers use an operational semantics together with logical relations.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-33
SLIDE 33

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

PER Basics

Definition

A partial equivalence relation on A is a symmetric, transitive relation on A. It can be viewed as an equivalence relation on a subset of A, formed of those elements x ∈ A such that x R x holds. I write x : R for x R x. I write R R′ for the relation defined by f (R R′) g (∀x, y x R y ⇒ f(x) R′ g(y)).

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-34
SLIDE 34

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

A model of DCC

Every type t is interpreted as an object, that is, a cpo | t | equipped with a PER, also written t. Every well-typed expression Γ ⊢ e : t is interpreted as a morphism from Γ to t, that is, a continuous function from | Γ | to | t | such that f : Γ t holds. In particular, a closed expression • ⊢ e : t is interpreted as an element e of | t | such that e : t, that is, e is related to itself by the PER t.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-35
SLIDE 35

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The intuition behind PERs

The partial equivalence relation t specifies a low-level observer’s view of the object t. It groups values of type t into classes whose elements must not be distinguished by such an observer. For instance, consider the flat cpo bool = {true, false}. The object boolL is obtained by equipping bool with the diagonal relation. The object boolH is obtained by equipping bool with the everywhere true relation.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-36
SLIDE 36

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

From the model to noninterference

Stating that such a model exists amounts to stating a family

  • f noninterference statements.

For instance, assume • ⊢ e : boolH → boolL holds. Then, the value f denoted by e satisfies f : boolH boolL, which is syntactic sugar for ∀x, y ∈ bool x boolH y ⇒ f(x) boolL f(y), that is, ∀x, y ∈ bool f(x) = f(y), which requires f to ignore its argument.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-37
SLIDE 37

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Interpreting types

The interpretation of the type constructors →, × and + is standard. The marked type H(t) is interpreted as the cpo | t |, equipped with the everywhere true relation. Then, the low-level observer’s view of every protected type is the everywhere true relation:

Lemma

If ⊳ t, then t and H(t) are isomorphic.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-38
SLIDE 38

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Interpreting typing judgements

Mark

Γ ⊢ e : t Γ ⊢ (H : e) : H(t) Interpreting Mark boils down to

Lemma

e : t implies e : H(t).

Proof.

The PER H(t) is everywhere true.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-39
SLIDE 39

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Interpreting typing judgements, continued

Use

Γ ⊢ e1 : H(t1) Γ; x : t1 ⊢ e2 : t2 ⊳ t2 Γ ⊢ use x = e1 in e2 : t2 Interpreting Use boils down to

Lemma

e : t1 → t2 and ⊳ t2 imply e : H(t1) → t2.

Proof.

The type t2 is protected, so the PER t2 is everywhere true. As a result, we have ∀x, y x H(t1) y ⇒ (e x) t2 (e y), that is, e : H(t1) → t2.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-40
SLIDE 40

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Interpreting typing judgements, continued

Thus:

Theorem

This is a model of DCC. This shows that every program satisfies the noninterference assertion encoded by its type. The PER approach gives direct meaning to annotated types.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-41
SLIDE 41

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-42
SLIDE 42

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Syntax

In fact, DCC is defined on top of an arbitrary security lattice L. A value may be marked with any security level ℓ. e ::= x | λx.e | e e | . . . | ℓ : e | use x = e in e t ::= t → t | unit | t + t | t × t | Tℓ(t)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-43
SLIDE 43

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Types

The typing rules are generalized as follows:

Mark

Γ ⊢ e : t Γ ⊢ (ℓ : e) : Tℓ(t)

Use

Γ ⊢ e1 : Tℓ(t1) Γ; x : t1 ⊢ e2 : t2 ℓ ⊳ t2 Γ ⊢ use x = e1 in e2 : t2

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-44
SLIDE 44

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types

The predicate ℓ ⊳ t (“t is protected at level ℓ” or “ℓ guards t”) is defined inductively. Intuitively, when ℓ guards t, the information carried by a value

  • f type t must be accessible only to observers of level ℓ or

greater. ℓ ≤ ℓ′ ∨ ℓ ⊳ t ℓ ⊳ Tℓ′(t) ℓ ⊳ t2 ℓ ⊳ t1 → t2 ℓ ⊳ t1 ℓ ⊳ t2 ℓ ⊳ t1 × t2 ℓ ⊳ unit

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-45
SLIDE 45

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Subtyping

Technically, DCC does not have subtyping, because it can be simulated using coercions, that is, functions that have no computational content. For instance, whenever ℓ ≤ ℓ′ holds, we have λx.use x = x in (ℓ′ : x) : Tℓ(t) → Tℓ′(t) The very existence of coercions indicates that the addition of true subtyping would be compatible with the model.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-46
SLIDE 46

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-47
SLIDE 47

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

DCC as a target language

Writing programs in DCC is hard, because explicit uses of Mark and Use must be inserted by the programmer. One really wants a programming language with no ad hoc term constructs, where all security-related information is carried by ad hoc types. In other words, one needs an ad hoc type system for a standard term language. This is what I refer to as “type-based information flow analysis.”

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-48
SLIDE 48

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

DCC as a target language, continued

To prove the correctness of the ad hoc type system, one exhibits a semantics-preserving encoding of it into DCC. Thus, DCC may be viewed as a target language for proving the correctness of several type-based information flow analyses.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-49
SLIDE 49

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

A simple ad hoc type system

To illustrate the idea, I now define a nonstandard type system for a standard λ-calculus with products and sums. Since the calculus is standard, a distinguished type constructor Tℓ would not make any sense. Instead, some, but not necessarily all, of the standard type constructors must now carry a security level.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-50
SLIDE 50

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Types

For instance, let t ::= unit | t → t | t × t | (t + t)ℓ The encoding of types into DCC is unit = unit t1 → t2 = t1 → t2 t1 × t2 = t1 × t2 (t1 + t2)ℓ = Tℓ(t1 + t2)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-51
SLIDE 51

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Protected types

As in DCC, I define the predicate ℓ ⊳ t. ℓ ⊳ unit ℓ ⊳ t2 ℓ ⊳ t1 → t2 ℓ ⊳ t1 ℓ ⊳ t2 ℓ ⊳ t1 × t2 ℓ ≤ ℓ′ ℓ ⊳ (t1 + t2)ℓ′ This definition is correct with respect to DCC:

Lemma

ℓ ⊳ t implies ℓ ⊳ t.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-52
SLIDE 52

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Sums

All typing rules are standard, except those that deal with sums: Γ ⊢ e : ti Γ ⊢ inji e : (t1 + t2)ℓ Γ ⊢ e : (t1 + t2)ℓ ℓ ⊳ t′ ∀i ∈ {1, 2} Γ; x : ti ⊢ ei : t′ Γ ⊢ e case x ≻ e1 e2 : t′ These suggest the following encoding of expressions: inji e = ℓ : (inji e) e case x ≻ e1 e2 = use x = e in (x case x ≻ e1 e2)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-53
SLIDE 53

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Subtyping

The type system may be equipped with a simple, structural subtyping relation, which extends the security lattice. It is succinctly defined as follows: ⊖ → ⊕ ⊕ × ⊕ (⊕ + ⊕)⊕ The subtyping rule is standard: Γ ⊢ e : t t ≤ t′ Γ ⊢ e : t′ Its correctness follows from:

Lemma

If t ≤ t′ holds, then there exists a coercion of type t → t′ in DCC.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-54
SLIDE 54

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Correctness of the encoding

The correctness of the encoding is given by

Theorem

Γ ⊢ e : t implies Γ ⊢ e : t.

Theorem

e and e have the same semantics. Thus, a function of type boolH → boolL behaves like a DCC function of type TH(bool) → TL(bool), which I have proved must ignore its argument.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-55
SLIDE 55

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-56
SLIDE 56

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

A syntactic approach

DCC is a useful tool and allows giving meaning to annotated types via PERs and logical relations. However, the simple ad hoc type system which I just presented can also be proved correct using a syntactic technique. This technique is inspired by Abadi, Lampson and L´ evy (1996) and by Pottier and Conchon (2000).

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-57
SLIDE 57

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The idea

The idea is to reintroduce marked expressions: e ::= . . . | ℓ : e and to define a small-step operational semantics that keeps track of marks. The semantics implements a sound dynamic dependency analysis. The type system is a sound approximation of the semantics. Thus, it implements a sound static dependency analysis.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-58
SLIDE 58

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The operational semantics

The operational semantics has standard reduction rules that deal with functions, products, and sums, plus ad hoc rules that deal with labels: (ℓ : e1) e2 → ℓ : (e1 e2) (lift-app) proji (ℓ : e) → ℓ : (proji e) (lift-proj) (ℓ : e) case x ≻ e1 e2 → ℓ : (e case x ≻ e1 e2) (lift-case) These rules prevent labels from getting in the way, and track dependencies. When labels are erased, these rules have no effect. So, the nonstandard semantics is faithful to a standard one, modulo erasure.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-59
SLIDE 59

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Computing with partial information

Let a prefix e be an expression that contains holes. Write e e′ if e′ is obtained from e by replacing some holes with prefixes. Reduction is extended to prefixes: holes block reduction.

Lemma (Monotonicity)

Let e, e′ be prefixes such that e e′. If f is an expression such that e →∗ f, then e′ →∗ f.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-60
SLIDE 60

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The operational semantics is sound

For an arbitrary set of security levels L, define ⌊e⌋L as the prefix of e obtained by pruning every subexpression of the form ℓ : e where ℓ ∈ L.

Lemma (Stability)

Let e be a prefix and f an expression. If e →∗ f and ⌊f⌋L = f, then ⌊e⌋L →∗ f. Expressions that carry a label not found in f do not contribute to the computation of f.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-61
SLIDE 61

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Extending the type system

Since I have reintroduced marked expressions, I must slightly extend the type system.

Mark

Γ ⊢ e : t ℓ ⊳ t Γ ⊢ (ℓ : e) : t This rule is reminiscent of DCC’s. However, since the type constructor Tℓ is gone, e and ℓ : e are given the same type t. The premise ℓ ⊳ t ensures that the type annotations carried by t are sufficiently high to reflect the presence of the mark ℓ.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-62
SLIDE 62

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

The type system is sound

I now wish to prove that reduction preserves types. The proof that the standard reduction rules preserve types is standard – well, not quite so, since types carry security annotations, but there is no surprise. There remains to prove that the (lift) rules preserve types.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-63
SLIDE 63

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

(lift-app) preserves types

Here is a type derivation for a (lift-app)-redex: Γ ⊢ e1 : t → t′ ℓ ⊳ t → t′ Γ ⊢ (ℓ : e1) : t → t′

Mark

Γ ⊢ e2 : t Γ ⊢ (ℓ : e1) e2 : t′

App

One may transform it into: Γ ⊢ e1 : t → t′ Γ ⊢ e2 : t Γ ⊢ e1 e2 : t′

App

ℓ ⊳ t′ Γ ⊢ ℓ : (e1 e2) : t′

Mark

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-64
SLIDE 64

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Type preservation

The cases of (lift-proj) and (lift-case) are left to the audience. Thus:

Lemma (Subject reduction)

Γ ⊢ e : t and e → e′ imply Γ ⊢ e′ : t.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-65
SLIDE 65

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

Putting it all together

Together, the soundness of the semantics and that of the type system lead to noninterference.

Theorem (Noninterference)

  • ⊢ e : boolℓ and e →∗ v imply ⌊e⌋↓{ℓ} →∗ v.

Proof.

By subject reduction, v has type boolℓ. Thus, v must be of the form ℓ1 : ℓ2 : . . . : ℓn : (true | false), where ℓi ⊳ boolℓ holds for every i ∈ {1, . . . , n}. This means ℓi ≤ ℓ, that is, ℓi ∈ ↓{ℓ}, so ⌊v⌋↓{ℓ} is v. The result follows by stability.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-66
SLIDE 66

Simply-typed λ-calculus Overview of DCC Multiple security levels A proof by encoding into DCC A direct, syntactic proof

A reformulation

This result is perhaps better known under a symmetric form:

Theorem (Noninterference)

Let • ⊢ e1 : boolℓ and • ⊢ e2 : boolℓ and ⌊e1⌋↓{ℓ} = ⌊e2⌋↓{ℓ}. Then, e1 →∗ v is equivalent to e2 →∗ v.

Proof.

By the previous theorem and by monotonicity. Expressions that have a low-level type and that only differ in high-level components have the same behavior.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-67
SLIDE 67

Type system Semantics Noninterference

Part II Flow Caml

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-68
SLIDE 68

Type system Semantics Noninterference

Type system Semantics Noninterference

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-69
SLIDE 69

Type system Semantics Noninterference

Type system Semantics Noninterference

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-70
SLIDE 70

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-71
SLIDE 71

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-72
SLIDE 72

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-73
SLIDE 73

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-74
SLIDE 74

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e Exceptions are second-class. They are not values. the idioms “e handle x ≻ e” and “raise x” are not available.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-75
SLIDE 75

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e For the sake of simplicity, certain expression forms must be built

  • ut of values. However, this is not a deep restriction.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-76
SLIDE 76

Type system Semantics Noninterference

Syntax

I refer to the programming language as ML. It has functions, products, sums, references, and exceptions. v ::= x | () | k | λx.e | m | (v, v) | injj v a ::= v | raise ε v e ::= a | v v | ref v | v := v | ! v | projj v | v case x ≻ e e | let x = v in e | E[e] E ::= bind x = [ ] in e | [ ] handle ε x ≻ e | [ ] handle e done | [ ] handle e propagate | [ ] finally e As usual in ML, polymorphism is introduced by let and restricted to values. Sequencing is expressed using bind.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-77
SLIDE 77

Type system Semantics Noninterference

Types

Types and rows are defined as follows: t ::= unit | intℓ | (t

pc [r]

  • → t)ℓ | t refℓ | t × t | (t + t)ℓ

r ::= {ε pc}ε∈E The metavariables ℓ and pc range over L. Subtyping is structural and extends the security lattice. int⊕ (⊖

⊖ [⊕]

  • → ⊕)⊕

⊙ ref⊕ ⊕ × ⊕ (⊕ + ⊕)⊕ {ε ⊕}ε∈E

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-78
SLIDE 78

Type system Semantics Noninterference

Types, continued

In this definition, there are no (level, type, or row) variables. This does not prohibit polymorphism. Although the type system does not have a ∀ quantifier, it has infinitary intersection types, introduced by let. Furthermore, rows are infinite objects. These design choices make it easier to prove noninterference. A system that has (level, type, and row) variables, finite syntax for rows, and constraints, and that supports type inference, can be defined in a second step.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-79
SLIDE 79

Type system Semantics Noninterference

Protected types

The definition of ℓ ⊳ t is unsurprising: ℓ ⊳ unit ℓ ≤ ℓ′ ℓ ⊳ intℓ′ ℓ ≤ ℓ′ ℓ ⊳ (∗

∗ [∗]

  • → ∗)ℓ′

ℓ ≤ ℓ′ ℓ ⊳ ∗ refℓ′ ℓ ⊳ t1 ℓ ⊳ t2 ℓ ⊳ t1 × t2 ℓ ≤ ℓ′ ℓ ⊳ (∗ + ∗)ℓ′

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-80
SLIDE 80

Type system Semantics Noninterference

Typing judgements

I distinguish two forms of typing judgements: one deals with values only, the other with arbitrary expressions. Γ, M ⊢ v : t pc, Γ, M ⊢ e : t [r] The level pc reflects how much information is associated with the knowledge that e is executed. The row r reflects how much information is gained by observing the exceptions raised by e.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-81
SLIDE 81

Type system Semantics Noninterference

Connecting values and expressions

Values and expressions are connected as follows:

e-Value

Γ, M ⊢ v : t ∗, Γ, M ⊢ v : t [∗] A value is an expression that has no side effects.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-82
SLIDE 82

Type system Semantics Noninterference

Abstraction and application

Abstraction delays effects. Application forces them (pc ≤ pc′).

v-Abs

pc, Γ[x t′], M ⊢ e : t [r] Γ, M ⊢ λx.e : (t′ pc [r]

  • → t)∗

e-App

Γ, M ⊢ v1 : (t′ pc′ [r]

  • → t)ℓ

Γ, M ⊢ v2 : t′ pc ≤ pc′ ℓ ≤ pc′ ℓ ⊳ t pc, Γ, M ⊢ v1 v2 : t [r] Information about the function may leak through its side effects (ℓ ≤ pc′) or through its result (ℓ ⊳ t).

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-83
SLIDE 83

Type system Semantics Noninterference

Imperative constructs

Information encoded within the program counter may leak when writing a variable, causing an indirect flow (pc ⊳ t).

e-Assign

Γ, M ⊢ v1 : t refℓ Γ, M ⊢ v2 : t pc ⊔ ℓ ⊳ t pc, Γ, M ⊢ v1 := v2 : unit [∗] In the presence of first-class references, information about the reference’s identity may leak as well (ℓ ⊳ t).

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-84
SLIDE 84

Type system Semantics Noninterference

Raising an exception

The value carried by the exception must have fixed (declared, monomorphic) type typexn(ε).

e-Raise

Γ, M ⊢ v : typexn(ε) pc, Γ, M ⊢ raise ε v : ∗ [ε : pc; ∗] Raising an exception reveals that this program point was

  • reached. Hence, the information gained by observing the

exception is pc.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-85
SLIDE 85

Type system Semantics Noninterference

Handling a specific exception

Knowing that e2 is executed allows deducing that an exception was caught. Thus, e2 is typechecked under the stricter context pc ⊔ pcε, where pcε is the amount of information carried by the exception.

e-Handle

pc, Γ, M ⊢ e1 : t [ε : pcε; r] pc ⊔ pcε, Γ[x typexn(ε)], M ⊢ e2 : t [ε : pc′; r] pcε ⊳ t pc, Γ, M ⊢ e1 handle ε x ≻ e2 : t [ε : pc′; r] Examining the whole expression’s result may also reveal that an exception was caught (pcε ⊳ t).

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-86
SLIDE 86

Type system Semantics Noninterference

Computing in sequence

Knowing that e2 is executed allows deducing that e1 did not raise any exception. The amount of information associated with this fact is bounded by ⊔ r1.

e-Bind

pc, Γ, M ⊢ e1 : t′ [r1 ] pc ⊔ (⊔ r1), Γ[x t′], M ⊢ e2 : t [r2 ] pc, Γ, M ⊢ bind x = e1 in e2 : t [r1 ⊔ r2 ]

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-87
SLIDE 87

Type system Semantics Noninterference

Finally

Executing e1 finally e2 eventually leads to executing e2, so

  • bserving that e2 is executed yields no information. Thus, e2 is

typechecked under the context pc.

e-Finally

pc, Γ, M ⊢ e1 : t [r] pc, Γ, M ⊢ e2 : ∗ [∂⊥] pc, Γ, M ⊢ e1 finally e2 : t [r] Observing an exception originally raised by e1 reveals that e2 has completed successfully. To avoid keeping track of this fact, I require e2 to always complete successfully.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-88
SLIDE 88

Type system Semantics Noninterference

Type system Semantics Noninterference

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-89
SLIDE 89

Type system Semantics Noninterference

Reminder: a semantics with labels

In a labelled semantics, examining a single reduction sequence allows comparing it with other sequences. For instance, consider: (λxy.y) (H : 27) →∗ λxy.y By stability, this implies (λxy.y) [] →∗ λxy.y By monotonicity, this implies (λxy.y) (H : 68) →∗ λxy.y

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-90
SLIDE 90

Type system Semantics Noninterference

Labels are limited

The statement if !x = 0 then z := 1 causes information to flow from x to z, even when it is skipped. As a result, designing a sensible labelled operational semantics (one that enjoys stability) becomes problematic. In fact, Denning (1982) claims that no dynamic dependency analysis is possible in the presence of mutable state.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-91
SLIDE 91

Type system Semantics Noninterference

A semantics with brackets

Instead, I will reason directly about two reduction sequences that share some structure. I will design an ad hoc semantics where the following reduction sequence is valid: (λxy.y) 27 | 68 →∗ λy.y and where, by projection, one may deduce (λxy.y) 27 →∗ λy.y (λxy.y) 68 →∗ λy.y Brackets encode the differences between two programs, that is, their high-level parts.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-92
SLIDE 92

Type system Semantics Noninterference

Why are brackets really useful?

In ML, references are dynamically allocated and do not have statically known names (they are not global variables). One cannot tell in advance whether the references allocated at a certain site are high- or low-level. In fact, they might be both, depending on the calling context. For these reasons, it is difficult to even state that the low-level slice of the store is the same in two executions of a program. In the bracket semantics, the low-level slice of the store is syntactically shared between the two executions.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-93
SLIDE 93

Type system Semantics Noninterference

The bracket calculus ML2

The language ML2 is defined as an extension of ML. v ::= . . . | v | v | void a ::= . . . | a | a e ::= . . . | e | e Brackets cannot not be nested.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-94
SLIDE 94

Type system Semantics Noninterference

Projections

A ML2 term encodes a pair of ML terms. For instance, v1 | v2 v and v1 v | v2 v both encode the pair (v1 v, v2 v). Two projection functions map a ML2 term to the two ML terms that it encodes. In particular: ⌊e1 | e2⌋i = ei i ∈ {1, 2}

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-95
SLIDE 95

Type system Semantics Noninterference

Functions

Each language construct is dealt with by two reduction rules. One performs computation. The other lifts brackets so that they never prevent computation. (λx.e) v → [v/x]e (app) v1 | v2 v → v1 ⌊v⌋1 | v2 ⌊v⌋2 (lift-app) Compare with the labelled semantics: (H : e1) e2 → H : (e1 e2) (lift-app)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-96
SLIDE 96

Type system Semantics Noninterference

Products

The treatment of products is analogous. projj (v1, v2) → vj (proj) projj v1 | v2 → projj v1 | projj v2 (lift-proj)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-97
SLIDE 97

Type system Semantics Noninterference

Designing the (lift) rules

The hypothetical reduction rule e → ⌊e⌋1 | ⌊e⌋2 is computationally correct. However, in the presence of such a rule, achieving subject reduction would require the type system to view every expression as high-level. The (lift) reduction rules track dependencies and must be made sufficiently precise to achieve subject reduction.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-98
SLIDE 98

Type system Semantics Noninterference

References

A store µ is a partial map from memory locations to values that may contain brackets. Store bindings of the form m v | void or m void | v account for situations where the two programs that are being executed have different dynamic allocation patterns.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-99
SLIDE 99

Type system Semantics Noninterference

References, continued

Reductions which take place inside a · | · construct must read

  • r write only one projection of the store.

For this purpose, let configurations be of the form e /

i µ, where

i ∈ {•, 1, 2}. Write e / µ for e /

  • µ.

ei /

i µ → e′ i / i µ′

ej = e′

j

{i, j} = {1, 2} e1 | e2 / µ → e′

1 | e′ 2 / µ′

(bracket)

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-100
SLIDE 100

Type system Semantics Noninterference

References, continued

The reduction rules that govern assignment are: m := v /

i µ

→ () /

i µ[m updatei µ(m) v]

(assign) v1 | v2 := v / µ → v1 := ⌊v⌋1 | v2 := ⌊v⌋2 / µ (lift-assign) where update• v v′ = v′ update1 v v′ = v′ | ⌊v⌋2 update2 v v′ = ⌊v⌋1 | v′

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-101
SLIDE 101

Type system Semantics Noninterference

Example

if !x = 0 then z := 1 / x 0 | 1, z 0 → if 0 | 1 = 0 then z := 1 / x 0 | 1, z 0 → if 0 = 0 | 1 = 0 then z := 1 / x 0 | 1, z 0 →∗ if true | false then z := 1 / x 0 | 1, z 0 → if true then z := 1 | if false then z := 1 / x 0 | 1, z 0 →∗ () | () / x 0 | 1, z 1 | 0

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-102
SLIDE 102

Type system Semantics Noninterference

Exceptions at a glance

The semantics of exceptions is given by a number of standard rules and a single (lift) rule. bind x = v in e → e[v/x] raise ε v handle ε x ≻ e → e[v/x] raise ε v handle e done → e raise ε v handle e propagate → e; raise ε v a finally e → e; a E[a] → a if E handles neither ⌊a⌋1 nor ⌊a⌋2 E[a1 | a2] → ⌊E⌋1[a1] | ⌊E⌋2[a2] if none of the above rules applies

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-103
SLIDE 103

Type system Semantics Noninterference

Relating ML2 to ML

Pairs of ML reduction sequences that produce answers are in

  • ne-to-one correspondence with ML2 reduction sequences.

Lemma (Soundness)

Let i ∈ {1, 2}. If e / µ → e′ / µ′, then ⌊e / µ⌋i → ⌊e′ / µ′⌋i.

Lemma (Completeness)

Assume ⌊e / µ⌋i →∗ ai / µ′

i for all i ∈ {1, 2}. Then, there exists a

configuration a / µ′ such that e / µ →∗ a / µ′.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-104
SLIDE 104

Type system Semantics Noninterference

Type system Semantics Noninterference

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-105
SLIDE 105

Type system Semantics Noninterference

The basic idea

The bracket calculus is a tool to attack the noninterference

  • proof. Indeed, to prove that two ML programs produce the same

answer, it is sufficient to prove that a single ML2 program produces an answer that contains no brackets. Thus, the key is to keep track of brackets during reduction. I do so via a standard technique: a type system for ML2 and a subject reduction theorem.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-106
SLIDE 106

Type system Semantics Noninterference

Keeping track of brackets

To define a type system for ML2, it suffices to give typing rules for brackets. These rules are parameterized by an (upward-closed) set of “high” levels H. They require the value and the side effects of every bracket to be “high.”

v-Bracket

Γ, M ⊢ v1 : t Γ, M ⊢ v2 : t H ⊳ t Γ, M ⊢ v1 | v2 : t

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-107
SLIDE 107

Type system Semantics Noninterference

Type preservation

In ML2, reduction preserves types:

Theorem (Subject reduction)

If ⊢ e /µ : t [r] and e /µ → e′ /µ′ then ⊢ e′ /µ′ : t [r].

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-108
SLIDE 108

Type system Semantics Noninterference

A final lemma

An expression with a “low” type cannot produce a value whose projections differ.

Lemma

Let ℓ ∈ H. If ⊢ e : intℓ and e →∗ v then ⌊v⌋1 = ⌊v⌋2.

Proof.

By subject reduction, ⊢ v : intℓ holds. So, v must be either an integer constant k or a bracket k1 | k2. Because ℓ ∈ H, the latter is impossible.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-109
SLIDE 109

Type system Semantics Noninterference

Noninterference

Theorem (Noninterference)

Choose ℓ, h ∈ L such that h ≤ ℓ. Let h ⊳ t. Assume (x t) ⊢ e : intℓ, where e is an ML expression. If, for every i ∈ {1, 2}, ⊢ vi : t and e[vi/x] →∗ v′

i hold, then v′ 1 = v′ 2.

Proof.

Let H = ↑{h}. Define v = v1 | v2. h ⊳ t and v-Bracket imply ⊢ v : t. By substitution, this yields ⊢ e[v/x] : intℓ. Now, ⌊e[v/x]⌋i is e[vi/x], which, by hypothesis, reduces to v′

i . By

completeness, there exists an answer a such that e[v/x] →∗ a. Then, by soundness, we have ⌊a⌋i = v′

i , so a is a value.

h ≤ ℓ implies ℓ ∈ H. The previous lemma then shows that the projections of a coincide.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-110
SLIDE 110

Part III Conclusion

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-111
SLIDE 111

Some open problems

◮ The type systems that I have presented are sometimes not

flexible enough. Dynamic labels are an interesting extension. What other extensions are possible and useful?

◮ Noninterference is often too drastic a requirement.

Declassification appears useful but is unsafe. How can it be tamed?

◮ Despite a huge number of publications, nobody seems to be

using these type systems in practice. There may be a need for a few killer applications!

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-112
SLIDE 112

Selected References I

Mart´ ın Abadi, Anindya Banerjee, Nevin Heintze, Jon G. Riecke. A Core Calculus of Dependency. POPL, 1999. Dorothy E. Denning. Cryptography and Data Security. Addison-Wesley, 1982. Andrew C. Myers. Mostly-Static Decentralized Information Flow Control. Technical Report MIT/LCS/TR-783, 1999. Andrew C. Myers and Andrei Sabelfeld. Language-Based Information-Flow Security. IEEE JSAC 21(1), 2003.

Franc ¸ois Pottier Type-Based Information Flow Analyses

slide-113
SLIDE 113

Selected References II

Franc ¸ois Pottier and Vincent Simonet. Information Flow Inference for ML. ACM TOPLAS 25(1), 2003. Vincent Simonet. The Flow Caml system: documentation and user’s manual. INRIA Technical Report 0282. Steve Zdancewic and Andrew C. Myers. Secure Information Flow via Linear Continuations. HOSC 15(2–3), 2002.

Franc ¸ois Pottier Type-Based Information Flow Analyses