<<

Dynamic Security Labels and Static Information Flow Control

Lantian Zheng Andrew . Myers Computer Science Department Cornell University, Ithaca, NY 14853 {zlt,andru}@cs.cornell.edu

Abstract be shown to enforce noninterference [13], a strong, end- to-end security property. For example, when applied to This paper presents a language in which information confidentiality, noninterference ensures that confidential flow is securely controlled by a type system, yet the se- information cannot be leaked by the program no matter curity class of data can vary dynamically. Information how it is transformed. flow policies provide the means to express strong secu- However, security cannot be enforced purely stat- rity requirements for data confidentiality and integrity. ically. In general, programs interact with an external Recent work on security-typed programming languages environment that cannot be predicted at compile time, has shown that information flow can be analyzed stat- so there must be a run-time mechanism that allows ically, ensuring that programs will respect the restric- security-critical decisions to be taken based on dynamic tions placed on data. However, real computing systems observations of this environment. For example, it is im- have security policies that cannot be determined at the portant to be able to change security settings on files time of program analysis. For example, a file has as- and database records, and these changes should affect sociated access permissions that cannot be known with how the information from these sources can be used. A certainty until it is opened. Although one security-typed purely static mechanism cannot enforce this. has included support for dy- To securely control information flow when access namic security labels, there has been no demonstration rights can be changed and determined dynamically, dy- that a general mechanism for dynamic labels can se- namic labels [22] are needed that can be manipulated curely control information flow. In this paper, we present and checked at run time. Dynamic information control an expressive language-based mechanism for reasoning mechanisms [33, 6, 11, 17, 29, 10] support dynamic la- about dynamic security labels. The mechanism is for- bels and use run-time label tests to control information mally presented in a core language based on the typed flows. However, these dynamic mechanisms incur large lambda calculus; any well-typed program in this lan- run-time overhead and generally cannot prevent implicit guage is secure because it satisfies noninterference. flows arising from the control flow paths not taken at run time [7, 19]. Thus, it is desirable to combine dy- namic labels and static information flow control: making dynamic labels and run-time label tests explicit in pro- 1. Introduction grams and using static program analysis to reason about Information flow control protects information security their security properties. by constraining how information is transmitted among JFlow [21] and its successor, Jif [24] are the only objects and users of various security classes. These se- implemented security-typed languages supporting dy- curity classes are expressed as labels associated with the namic labels. However, although the Jif type system is information or its containers. Denning [8] showed how designed to control the new information channels that to use static analysis to ensure that programs use infor- dynamic labels create, it has not been proved to en- mation in accordance with its security class, and this ap- force secure information flow. Further, the dynamic la- proach has been instantiated in a number of languages in bel mechanism in Jif has limitations that impair expres- which the type system implements a similar static analy- siveness and efficiency. sis (e.g., [32, 15, 37, 26, 4, 28]). These type systems are In this paper, we propose an expressive language- an attractive way to enforce security because they can based mechanism for securely manipulating information with dynamic security labels. The mechanism is for- 2.1. Security classes malized in a core language λ (based on the typed DSec We assume that security requirements for confidentiality lambda calculus) with first-class label values, dependent or integrity are defined by associating security classes security types and run-time label tests. We prove the cor- with users and with the resources that programs access. rectness of this mechanism by showing that any well- These security classes form a lattice L. We write k v k0 typed program of the core language satisfies noninter- to indicate that security class k0 is at least as restric- ference, which intuitively means that confidential inputs tive as another security class k. In this case it is safe to cannot interfere with outputs observable to attackers. In move information from security class k to k0, because this paper, attackers are assumed to be passive in the restrictions on the use of the data are preserved. To con- sense that they can compromise data confidentiality only trol data derived from sources with classes k and k0, the by observing program outputs. With this passive attack least restrictive security class that is at least as restric- model, if a program satisfies noninterference, then at- tive as both k and k0 is assigned. This is the least upper tackers can learn nothing about confidential inputs of the bound, or join, written k t k0. program. This simple form of noninterference is stan- dard for security-typed languages, although dynamic la- bels introduce a subtle complexity: whether an input is 2.2. Labels confidential may not be statically determinable. Type systems for confidentiality or integrity are con- Some previous MAC systems have supported dy- cerned with tracking information flows in programs. namic security classes as part of a downgrading mecha- Types are extended with security labels that denote se- nism [30]. While downgrading is important, it is useful curity classes. A label ` appearing in a program may to treat it as a separate mechanism so that dynamic ma- be simply a constant security class k, or a more com- nipulation of labels does not necessarily destroy nonin- plex expression that denotes a security class. The no- terference. tation `1 v `2 means that `2 denotes a security class that is at least as restrictive as that denoted by ` . Intu- This paper is a revised and expanded version of a pa- 1 itively, data with label ` can be safely labeled with ` per presented at the second international Workshop on 1 2 if ` v ` holds. Thus, v is called the relabeling rela- Formal Aspects in Security and Trust [39]. Compared 1 2 tion. to that conference version, this paper includes a com- Because a given security class may be denoted by dif- plete proof that the λ type system enforces nonin- DSec ferent labels, the relation v generates a lattice of equiv- terference. Another improvement is that we demonstrate alence classes of labels with t as the join (least upper the dynamic label mechanisms of λ can be applied DSec bound) operator. Two labels ` and ` are equivalent, in practice by proposing a corresponding extension to 1 2 written ` ≈ ` , if ` v ` and ` v ` . The join of two Jif. 1 2 1 2 2 1 labels, `1 t `2, denotes the security class that is the join The remainder of this paper is organized as follows. of the security classes that `1 and `2 denote. For exam- Section 2 presents some background on lattice label ple, if variable x has label `x and variable y has label `y, models and security type systems. Section 3 introduces then the sum x+y is given the label `x t `y. the core language λDSec and uses sample λDSec pro- grams to show some important applications of dynamic 2.3. Security type systems for information labels. Section 4 describes the type system of λDSec. flow Section 5 proves that the λDSec type system enforces noninterference. Section 6 interprets and extends the dy- Security type systems can be used to enforce security namic label mechanism of Jif based on the ideas of information flows statically. Information flows in pro- λDSec. Section 7 covers related work, and Section 8 con- grams may be explicit flows such as assignments, or im- cludes. plicit flows arising from the control flow of the program. Consider an assignment statement x:=y, which contains an information flow from y to x. Then the typing rule for the assignment statement requires that `y v `x, which 2. Background means the security class of y is lower than the security class of x, guaranteeing the information flow from y to x Static information flow analysis can be formalized as a is secure. Intuitively, data with label `1 can be safely la- security type system, in which security labels of data beled with `2 if `1 v `2 holds. Thus, v is called the re- are represented by security type annotations, and infor- labeling relation. mation flow control is performed through type check- One advantage of static analysis is the ability to con- ing. trol implicit flows in all possible execution paths. Con- sider a simple conditional: • L 6v H, • the label of e is less than or equal to L, if s <= 0 then x := 0 else y := 0 and Although there is no direct assignment from s to x or y, • A1 ≈H A2, which means that for any this expression may cause implicit flows from s into x free variable x of e, if the label of x and y, since the values of x and y depend on s after eval- is not higher than or equal to H, then uating the expression. A standard technique for control- A1(x) = A2(x), ling implicit flows is to introduce a program-counter la- if e[A1] and e[A2] are evaluated to v1 and v2, bel [7], written pc, which indicates the security class of then v1 = v2. the information that can be learned by knowing the con- trol flow path taken thus far. In this example, the branch The noninterference property discussed here is ter- taken depends on the value of s, so the pc in the then mination insensitive [28] because e[A1] and e[A2] are required to generate the same result only if both eval- and else clauses will be joined with `s, the label of s. The type system ensures that any effect of expres- uations terminate. In this work, we do not attempt to sion e has a label at least as restrictive as its pc. In other deal with termination and timing channels. Control of words, an expression e cannot generate any effects ob- these channels is largely an orthogonal problem. In av- servable to users who should not know the current pro- erage, termination channels can leak at most one bit per gram counter. In this example, the assignment to x will run, so they have often been considered acceptable (e.g., [8, 32]). Some recent work [1, 27, 38] partially ad- be permitted only if pc v `x, which ensures `s v `x. dresses the control of timing channels. Similarly, `s v `y is also ensured by the static analy- sis. Dynamic mechanisms such as the Data Mark Ma- 3. The λDSec language chine [11] are able to control implicit flows by track- The core language λDSec is a security-typed lambda cal- ing the program counter label pc at run time and check culus that supports first-class dynamic labels. In λDSec, the constraint pc v `x or pc v `y depending on which labels are terms that can be manipulated and checked at branch is taken. However, the dynamic mechanisms do run time. Furthermore, label terms can be used as stat- not check the label constraints required by the control ically analyzed type annotations. Syntactic restrictions flow path not taken at run time. For example, suppose are imposed on label terms to increase the practicality the value of s is positive, and pc v `y holds while of type checking, following the approach used by Xi and Π pc v `x does not hold. Then attackers can infer that Pfenning in ML0 (C) [36]. s is positive from the absence of run-time label test fail- ures. 3.1. Syntax

The syntax of λDSec is given in Figure 1. We use the 2.4. Noninterference name k to range over a lattice of security classes L In general, the goal of static information flow control is (more precisely, a join semi-lattice with bottom element to enforce noninterference, which intuitively means that ⊥), x, y to range over variable names V, and m to range confidential inputs cannot interfere with outputs observ- over a space of memory addresses M. able to attackers. Formally, the security class of attack- To make the lattice explicit, we write L |= k1 v k2 ers is represented by a label L. Then any input with a la- to mean that k2 is at least as restrictive as k1 in L, and bel H such that H 6v L is confidential (high-security), L |= k = k1 t k2 to mean k is the join of k1 and k2 in and any output with a label less than or equal to L is ob- L. The bottom element of L is ⊥. Any non-trivial label servable to attackers and is low-security data. lattice contains at least two points L and H where H 6v Suppose expression e is a program. Then the inputs L. of e are the values of free variables of e, and the outputs In λDSec, a label can be either a security class k, a are simply the result of evaluating e. More formally, the variable x, or the join of two other labels `1 t`2. For ex- inputs of e are represented by an input map A, mapping ample, L, x, and Ltx are all valid labels, and Ltx can free variables of e to values, and the notation e[A] de- be interpreted as a security policy that is as restrictive notes the expression obtained by substituting every free as both L and x. A security class k is also called a la- variable x of e with A(x). Program e satisfies the non- bel value, since it can be used as a value at run time. The interference property if changing the confidential inputs security type τ = β` is the base type β annotated with of e does not affect the outputs observable to attackers, label `. The base types include integers, unit, labels, ref- that is, the following statement holds: erences, functions and products. C ; pc For two arbitrary labels L and H and any two The function type (x : τ1) −−−→ τ2, assigned to a input maps A1 and A2 of e satisfying function with an argument type τ1 and a result type τ2, Security classes k ∈ L Variables x, y ∈ V Locations m ∈ M Labels `, pc ::= k | x | `1 t `2 Constraints C ::= `1 v `2 ,C |  C ; pc Base Types β ::= int | label | unit | τ ref | (x:τ1) −−−→ τ2 | (x:τ1)[C] ∗ τ2 Security Types τ ::= β` τ Values v ::= x | n | k | () | m | λ(x:τ)[C ; pc]. e | (x=v1[C], v2 :τ) τ Expressions e ::= v | `1 t `2 | e1 e2 | !e | e1 := e2 | ref e | if `1 v `2 then e1 else e2 | let (x, y)=e1 in e2

Figure 1. Syntax of λDSec

is a dependent type since τ1, τ2, C and pc may men- sequently, the constraint `1 v `2 can be assumed when tion x. The component C is a set of label constraints type-checking e1. each with the form `1 v `2; they must be satisfied when The product destructor let (x, y)=e1 in e2 unpacks the function is invoked. An empty C is represented by . the result of e1, which is a pair, substitutes the first ele- The pc component is a lower bound on the memory ef- ment for x and the second for y, and then evaluates e2. fects of the function, and an upper bound on the pc label From the computational standpoint, λDSec is fairly of the caller. Consequently, a function is not able to leak expressive, because it supports both first-class functions information about where it is called. Without the anno- and state, which together are sufficient to encode recur- tations C and pc, this kind of type is sometimes written sive functions. For example, suppose λf(x:τ)[C ; pc]. e as Πx:τ1.τ2 [20]. is a recursive function (f may appear in e) with type τf . The product type (x : τ1)[C] ∗ τ2 is also a dependent Then we can encode the recursive function using the fol- type in the sense that occurrences of x can appear in τ1, lowing λDSec code: τ2 and C. The component C is a set of label constraints τf that any value of the product type must satisfy. If τ2 does λ(x:τ)[C ; pc]. ((λ(y :unit)[C ; pc]. !m x) τ τ not contain x and C is empty, the type may be written (m f := λ(x:τ)[C ; pc]. e[!m f /f])) as the more familiar τ1 ∗ τ2. Without the annotation C, where e[!mτf /f] is the expression obtained by substi- this kind of type is sometimes written Σx:τ1.τ2 [20]. tuting !mτf for f in e. In λDSec, values include variables x, integers n, label values k, the unit value (), typed memory locations mτ , 3.2. Operational Semantics functions λ(x:τ)[C ; pc]. e and pairs (x=v1[C], v2 :τ). A function λ(x : τ)[C ; pc]. e has one argument x with The small-step operational semantics of λDSec is given type τ, and the components C and pc have the same in Figure 2. Let M represent a memory that is a fi- meanings as those in function types. For simplicity, C nite map from typed locations to closed values, and let can be omitted if it is empty, and the pc component can he, Mi be a machine configuration. Then a small evalu- be omitted if e has no side effects. A pair (x=v1[C], v2 : ation step is a transition from he, Mi to another config- 0 0 0 0 τ) contains two values v1 and v2. The second element v2 uration he ,M i, written he, Mi 7−→ he ,M i. has type τ and may mention the first element v1 by the It is necessary to restrict the form of he, Mi to avoid name x. The component C is a set of label constraints using undefined memory locations. Let loc(e) represent that the first element of the pair must satisfy. For exam- the set of memory locations appearing in e. A mem- ple, suppose C contains the constraint x v L (which ory M is well-formed if every address m appears at τ implies v1 is a label value), then v1 v L must be true most once in dom(M), and for any m in dom(M), τ τ since inside the pair the value of x is v1. loc(M(m )) ⊆ dom(M), where M(m ) denotes the Expressions include values v, variables x, the join of value of location mτ in M. The configuration he, Mi two labels `1 t `2, applications e1 e2, dereferences !e, is well-formed if M is well-formed, loc(e) ⊆ dom(M), τ assignments e1 := e2, references ref e, label-test ex- and e contains no free variables. By induction on the 0 0 pressions if `1 v `2 then e1 else e2, and product de- derivation of he, Mi 7−→ he ,M i, we can prove that 0 0 structors let (x, y)=e1 in e2. if he, Mi is well-formed, then he ,M i is also well- The label-test expression if`1 v `2 then e1 else e2 formed. is used to examine labels. At run time, if the value of `2 The notation e[v/x] indicates capture-avoiding sub- is a constant label at least as restrictive as the value of stitution of value v for variable x in expression e. Un- `1, then e1 is evaluated; otherwise, e2 is evaluated. Con- like in the typed lambda calculus, e[v/x] may generate L |= k = k1 t k2 [E1] hk1 t k2,Mi 7−→ hk, Mi

[E2] h!mτ ,Mi 7−→ hM(mτ ),Mi

m = newloc(M) [E3] hrefτ v, Mi 7−→ hmτ ,M[mτ 7→ v]i

[E4] hmτ := v, Mi 7−→ h(),M[mτ 7→ v]i

[E5] h(λ(x:τ)[C ; pc]. e) v, Mi 7−→ he[v/x],Mi

L |= k1 v k2 [E6] hif k1 v k2 then e1 else e2,Mi 7−→ he1,Mi

L |= k1 6v k2 [E7] hif k1 v k2 then e1 else e2,Mi 7−→ he2,Mi

[E8] hlet (x, y)=(x=v1[C], v2 :τ) in e, Mi 7−→ he[v2/y][v1/x],Mi

he, Mi 7−→ he0,M 0i [E9] hE[e],Mi 7−→ hE[e0],M 0i

τ E[·] ::= [·] e | v [·] | [·] := e | v := [·] | ![·] | ref [·] | [·] t `2 | k1 t [·] | if [·] v `2 then e1 else e2 | if k1 v [·] then e1 else e2 | let (x, y)=[·] in e

Figure 2. Small-step operational semantics of λDSec a syntactically ill-formed expression if x appears in type 3.3. Examples annotations inside e, and v is not a label. However, this As discussed in Section 1, dynamic labels are vi- is not a problem because the type system of λ guar- DSec tal for precisely controlling information flows between antees that a well-typed expression can only be evalu- security-typed programs and the external environ- ated to another well-typed and thus well-formed expres- ment. A practical program often needs to access sion. files or communicate through networks. These ac- tivities can be viewed as communication through τ The notation M[m 7→ v] denotes the memory ob- an I/O channel with a corresponding label consis- τ tained by assigning v to m in M. tent with the security class of the entity (such as a file or network socket) represented by the channel. Be- The evaluation rules are standard. In rule (E3), the cause the security class of an external entity may be notation address-space(M) represents the set of loca- discovered and even changed at run time, the pre- τ tion names in M, that is, {m | ∃τ s.t. m ∈ dom(M)}; cise label of an I/O channel is dynamic and oper- the allocator newloc(M) deterministically gen- ations on a channel cannot be checked at compile erates a fresh memory location m such that time. m 6∈ address-space(M), and newloc(M 0) = m if address-space(M 0) = address-space(M). In rule (E8), 3.3.1. Run-time access control Implementing v2 may mention x, so substituting v2 for y in e is per- run-time access control is one of the most important ap- formed before substituting v1 for x. For simplic- plications of dynamic label mechanisms. Suppose ity, the variable name in the product value matches there exists a file that stores one integer, and the ac- x so that no variable renaming (alpha conversion) cess control policy of the file is unknown at compile is needed when substituting v1 and v2 for x and y time. In λDSec, the file can be encoded as a refer- in e. In rule (E9), E represents an evaluation con- ence of type (x : label⊥) ∗ (intx ref)⊥, where x text, a term with a single hole (denoted by [·]) in redex is a dynamic label consistent with the access con- position, and the syntax of E specifies the evaluation or- trol policy of the file, and the reference compo- der. nent of type (intx ref)⊥ stores the contents of the file and can be viewed as modeling the physical ad- Sending an integer through a multilevel channel is dress of the file on a storage device. Thus storing an implemented by pairing the integer and its label and integer of type intH in the file is equivalent to as- storing the pair in the reference representing the chan- signing the integer to the memory reference com- nel: ponent, which requires that x is at least as high λ(z :(((x:labelx)) ∗ intx)⊥ ref)⊥). as H. Since the value of x is not known at com- λ(w :labelw). λ(y :intw)[⊥]. z := (x=w, y :intx) pile time, the condition H v x can only be checked at run time, using a label-test expression. The follow- Like other I/O channels, a multilevel channel may have ing function stores a high-security integer z in the file a label that is an upper bound of the security classes w: of the information that can be sent through the chan- nel. Product label constraints can be used to specify the λ(w :((x:label⊥) ∗ (intx ref)⊥)⊥ ref⊥). label of a multilevel channel. For example, a bounded λ(z :intH )[H]. let (x, y)=!w in if H v x then y := z else () multilevel channel can be represented by a memory ref- erence with type ((x : labelx)[x v `] ∗ intx)⊥ ref, Note that the pc label of the function is H because the where ` is the label of the channel, and the constraint function body contains a memory effect of label x when x v ` guarantees any information stored in the refer- H v x. ence has a security label at most as high as `. Sending It is also important to be able to change file permis- information through a bounded multilevel channel of- sions at run time. The following code changes the ac- ten needs a run-time check as in the following code: cess control policy of the file w to label z. However, the original contents of w need to be wiped out to pre- λ(z :(((x:labelx))[x v `] ∗ intx)⊥ ref)⊥). vent them from being implicitly declassified, which pro- λ(w :labelw). λ(y :intw)[⊥]. vides stronger security assurance than an ordinary file if w v ` then z := (x=w, y :intx) else () system. This is done by replacing the old memory refer- The ability to recursively use a variable to construct ence component in the value of w with a new memory the label of its own type provides a useful kind of poly- reference storing the initial value 0. morphism, which this example demonstrates. Without

λ(w :((x:label⊥) ∗ intx ref⊥)⊥ ref⊥). recursive labels, the type of a multilevel channel cannot λ(z :label⊥)[⊥]. (λ(y :intz ref⊥)[⊥]. be constructed so simply, because selecting a label for intz w := (x=z, y :intx ref⊥)) ref 0 the label component x becomes problematic. Any con- stant label that is chosen may be inappropriate; for ex- 3.3.2. Multilevel communication channels Informa- ample, if the label has the label ⊥ then it may be impos- tion flows inside a program are controlled by static type sible to compute a suitable label to supply as x. Another checking. When information is exported outside a pro- possibility is to provide yet another label that is to func- gram through an I/O channel, the receiver might want to tion as the label of x, but this merely pushes the prob- know the exact label of the information, which calls for lem back by one level. Giving x the type labelx is a multilevel communication channels [9] unambiguously neat way to tie off this sequence. pairing the information sent or received with its corre- sponding security label. Supporting multilevel channels 4. Type system is one of the requirements for a MAC system [9]. This section describes the type system of λDSec, which In λDSec, a multilevel channel can be encoded by a is designed to enforce secure information flow. memory reference of type ((x : labelx) ∗ intx)⊥ ref, which stores a pair composed of an integer value and 4.1. Label constraints its label. The confidentiality of the integer component is protected by the label component, since extracting the Because of dynamic labels, it is not always possible to integer component from such a pair requires testing the decide whether the relationship `1 v `2 holds at com- label component: pile time; therefore, the label-test expression (if) must be used to query the relationship. However, this dynamic λ(z :((x: ) ∗ ) ). (x, y)=z labelx intx ⊥ let in query may create new information flows; the language if x v L then mintL := y else () λDSec and its type system are designed to statically con- In the above example, the constraint x v L must be sat- trol these new information flows. intL isfied in order to store the integer component in m . Although labels are first-class values in λDSec, label Since the readability of the integer component depends terms have a restricted syntactic form so that any label on the value of x, letting x recursively label itself en- term can be used as a type annotation. Therefore, con- sures that all the authorized readers of the integer com- straints on label terms are also type-level information ponent can test x and retrieve the integer value. that can be used by the type checker. L |= k1 v k2 ` v ` ∈ C C ` τ1 ≤ τ2 C ` τ2 ≤ τ1 [C1] [C2] 1 2 [S1] C ` k1 v k2 C ` `1 v `2 C ` τ1 ref ≤ τ2 ref

0 0 [C3] C ` ` v > [C4] C ` ⊥ v ` C ` τ2 ≤ τ1 C ` τ1 ≤ τ2 C ` pc2 v pc1 C,C2 ` C1 0 [C5] C ` ` v ` t ` [S2] C1 ; pc1 0 C2 ; pc2 0 C ` (x:τ1) −−−−→ τ1 ≤ (x:τ2) −−−−→ τ2 C ` ` v ` C ` ` v ` 1 2 2 3 0 0 [C6] C ` τ1 ≤ τ2 C ` τ1 ≤ τ2 C,C1 ` C2 C ` `1 v `3 [S3] 0 0 C ` (x:τ1)[C1] ∗ τ1 ≤ (x:τ2)[C2] ∗ τ2 C ` ` v ` C ` ` v ` [C7] 1 3 2 3 C ` β1 ≤ β2 C ` `1 v `2 C ` `1 t `2 v `3 [S4] C ` (β1)`1 ≤ (β2)`2

Figure 3. Relabeling rules Figure 4. Subtyping rules

Furthermore, in λDSec label terms are purely func- tional: they have no side effects and evaluate to the same value in the same context. As a result, any label con- H v L. Inconsistent constraint sets are harmless be- straint of the form `1 v `2 that is known to hold in a cause they always indicate dead code, such as expres- typing context can be used for type checking in that con- sion e1 in “if H v L then e1 else e2”. text. For example, consider the following code: Since the subtyping relationship depends on the rela- λ(x:label⊥). λ(y :(intx ref)⊥). λ(z :intH )[H]. beling relationship, the subtyping context also needs to if H v x then y := z else () include the C component. The inference rules for prov- According to the semantics of the label-test expression, ing C ` τ1 ≤ τ2 are the rules shown in Figure 4 plus the assignment y := z will be executed only if H v x the standard reflexivity and transitivity rules. holds. Thus, the constraint H v x can be used to de- Rules (S1)–(S3) are about subtyping on base cide whether y := z is secure. In this example, any in- types. These rules demonstrate the expected covari- formation stored in z is only accessible to users with se- ance or contravariance. In λ , function types con- curity label at least as high as x. So it is secure to store DSec tain two additional components pc and C, both z in y because x is at least as high as H. of which are contravariant. Suppose the func- In general, for each expression e, the type checker C1 ; pc1 0 keeps track of the set of constraints C that are known tion type τ = (x : τ1) −−−−→ τ1 is a subtype of 0 C2 ; pc2 0 to be satisfied when e is executed, and uses C in type- τ = (x : τ2) −−−−→ τ2. Then wherever func- checking e. tions with type τ 0 can be called, functions with type τ can also be called. This implies two neces- 4.2. Subtyping sary premises. First, wherever C2 is satisfied, C1 is The subtyping relationship between security types plays also satisfied. Since C is satisfied, this premise is writ- an important role in enforcing information flow security. ten C,C2 ` C1, meaning that for any constraint `1 v `2 in C1, we can derive C,C2 ` `1 v `2. Second, the Given two security types τ1 = β1`1 and τ2 = β2`2 , sup- pose τ1 is a subtype of τ2, written as τ1 ≤ τ2. Then any premise pc2 v pc1 is needed because the pc of a func- data of type τ1 can be treated as data of type τ2. Thus, tion type is an upper bound on the pc where the function data with label `1 may be treated as data with label `2, is applied. which requires ` v ` . 1 2 In rules (S2) and (S3), variable x is bound in the func- The type system keeps track of the set of label con- tion and product types. For simplicity, we assume that x straints that can be used to prove relabeling relation- does not appear in C, since α-conversion can always be ships between labels. Let C ` ` v ` denote that 1 2 used to rename x to another fresh variable. This assump- ` v ` can be inferred from the set of constraints C. 1 2 tion also applies to the typing rules. The inference rules are shown in Figure 3; they are stan- dard and consistent with the lattice properties of labels. Rule (S4) is used to determine the subtyping on se- Rule (C2) shows that all the constraints in C are as- curity types. The premise C ` β1 ≤ β2 is natural. The sumed to be true. The constraint set C may contain con- other premise C ` `1 v `2 guarantees that coercing data straints that are inconsistent with the lattice L, such as from τ1 to τ2 does not violate information flow policies. 4.3. Typing (τ ref)`, then C ` pc v τ is required to pre- vent illegal implicit flows. In addition, the premise The type system of λ prevents illegal information DSec C ` pc t ` v τ implies another condition C ` ` v τ flows and guarantees that any well-typed program satis- that is required to protect the confidentiality of the ref- fies the noninterference property discussed in Section 2. erence that is assigned to. Consider the following The typing rules are shown in Figure 5. The notation code that allows low-security users to learn whether label(β ) = ` is used to obtain the label of a type, and ` x v L by observing which of m and m is up- the notations ` v τ and τ v ` are abbreviations for 1 2 dated to 0: ` v label(τ) and label(τ) v `, respectively. λ(x:label )[L]. The typing context includes a type assignment Γ, a H (if x v L then mintL else mintL ) := 0 set of constraints C and the program-counter label pc. Γ 1 2 is a finite ordered list of x:τ pairs in the order that they The code is not well-typed because the condition C ` came into . For a given x, there is at most one pair ` v τ does not hold for the assignment expression. x:τ in Γ. Rule (ABS) checks function values. The function 0 A variable appearing in a type must be a label vari- body is checked with the constraint set C and the 0 able. Therefore, a type τ is well-formed with respect to program-counter label pc , so the function can only be 0 type assignment Γ, written Γ ` τ, if Γ maps all the vari- called at places where C is satisfied and the pc label is 0 ables in τ to label types. The definition of well-formed not more restrictive than pc . labels (Γ ` `) is the same. Consider Γ = x1 :τ1, . . . , xn : Rule (L-APP) is used to check applications of de- τn. For any 1 ≤ i ≤ n, the type τi may only mention la- pendent functions. Expression e1 has a dependent func- C0 ; pc0 bel variables that are already in scope: x1 through xi. tion type ((x : label`0 ) −−−−→ τ)`, where x does ap- Therefore, Γ is well-formed if for any 1 ≤ i ≤ n, τi pear in `0, C0, pc0 or τ. As a result, rule (L-APP) needs 0 0 0 is well-formed with respect to x1 : τ1, . . . , xi : τi. For to use ` [`2/x], C [`2/x], pc [`2/x] and τ[`2/x], which example, “x : labelL, y : intx” is well-formed, but are well-formed since `2 is a label. That also explains “y : intx, x : labelL” is not. A constraint `1 v `2 is why e1, with its dependent function type, cannot be ap- well-formed with respect to Γ if both `1 and `2 are well- plied to an arbitrary expression e2: substituting e2 for formed with respect to Γ. A typing context “Γ; C ; pc” is x in `0, C0, pc0 and τ may generate ill-formed labels well-formed if Γ is well-formed, and pc and all the con- or types, and it is generally unacceptable for the type straints in C are well-formed with respect to Γ. checker to evaluate e2 to value v2 and substitute v2 for The typing assertion Γ; C ; pc ` e : τ means that x, which would make type-checking undecidable. The with the type assignment Γ, current program-counter la- expressiveness of λDSec is not substantially affected by bel as pc, and the set of constraints C satisfied, expres- the restriction that a dependent function can only be ap- sion e has type τ. The assertion Γ; C ; pc ` e : τ is plied to label terms, because the function can be applied well-formed if Γ; C ; pc is well-formed, and Γ ` τ. to a variable that receives the result of an arbitrary ex- Rules (INT), (UNIT), (LABEL) and (LOC) are used pression. For example, in the following code, the appli- to check values. Value v has type β⊥ if v has base type cation e1x indirectly applies e1 to e2: τ β. Rule (LOC) requires typed location m contain no la- (λ(x:label`). if x v L then e1 x else ()) e2 bel variables so that mτ remains a constant during eval- This works as long as the function enclosing e1x is not uation. This is enforced by the premise FV (τ) = ∅, dependent. where FV (τ) denotes the set of free variables appear- In rule (L-APP), the label of e1`2 is at least as restric- ing in τ. tive as `, preventing the result of e1 from being leaked. Rule (VAR) is standard: variable x has type Γ(x). 0 0 The premise C ` C [`2/x] guarantees that C [`2/x] Rule (JOIN) checks the join of two labels and assigns a are satisfied when the function is invoked. The premise result label that is the join of the labels of the operands. 0 C ` pc t ` v pc [`2/x] ensures that the invocation Rule (REF) checks memory allocation operations. If cannot leak the program counter or the function itself the pc label is high, the generated memory location must through the memory effects of the function. not be observable to low-security users, which is guaran- Rule (APP) applies when x does not appear in C0, pc0 teed by the premise C ` pc v τ. Rule (DEREF) checks or τ. In this case, the type of e1 is just a normal func- dereference expressions. Since some information about tion type, so e1 can be applied to arbitrary terms. a reference can be learned by knowing its contents, the Rule (PROD) is used to check product values. To result of dereferencing a reference with type (τ ref)` check v2, the occurrences of x in v2 and τ2 are both re- has type τ t `, where τ t ` = β`0t` if τ is β`0 . placed by v1, since x is not in the domain of Γ. If v1 is Rule (ASSIGN) checks memory update. As in not a label, then x cannot appear in τ2. Thus, τ2[v1/x] rule (REF), if the updated memory location has type is always well-formed no matter whether v1 is a label or [INT]Γ; C ; pc ` n : int⊥ [UNIT]Γ; C ; pc ` () : unit⊥

FV (τ) = ∅ [LABEL] Γ; C ; pc ` k : label⊥ [LOC] τ Γ; C ; pc ` m :(τ ref)⊥

Γ; C ; pc ` `1 : label 0 Γ; C ; pc ` `2 : label 0 `1 `2 x:τ ∈ Γ [JOIN] [VAR] Γ; C ; pc ` `1 t `2 : label 0 0 Γ; C ; pc ` x : τ `1t`2

Γ; C ; pc ` e : τ C ` pc v τ Γ; C ; pc ` e :(τ ref)` [REF] τ [DEREF] Γ; C ; pc ` ref e :(τ ref)⊥ Γ; C ; pc `!e : τ t `

Γ; C ; pc ` e :(τ ) Γ, x:τ 0 ; C0 ; pc0 ` e : τ 1 ref ` Γ; C ; pc ` e2 : τ C ` pc t ` v τ 0 0 [ABS] 0 0 0 0 C ; pc [ASSIGN] Γ; C ; pc ` λ(x:τ )[C ; pc ]. e : ((x:τ ) −−−−−→ τ)⊥ Γ; C ; pc ` e1 := e2 : unit⊥

C0 ; pc0 0 0 0 C ; pc Γ; C ; pc ` e1 : ((x:label`0 ) −−−−−→ τ)` Γ; C ; pc ` e1 : ((x:τ ) −−−−−→ τ)` 0 0 Γ; C ; pc ` `2 : label` [`2/x] Γ; C ; pc ` e2 : τ 0 0 0 0 C ` pc t ` v pc [`2/x] C ` C [`2/x] C ` pc t ` v pc C ` C x ∈ FV (τ) ∪ FV (`0) ∪ FV (C0) ∪ FV (pc0) x∈ / FV (τ) ∪ FV (τ 0) ∪ FV (C0) ∪ FV (pc0) [L-APP] [APP] Γ; C ; pc ` e1 `2 : τ[`2/x] t ` Γ; C ; pc ` e1 e2 : τ t `

0 Γ; C ; pc ` v1 : τ1[v1/x]Γ, x:τ1 ` τ2 Γ; C ; pc ` e1 : ((x:τ1)[C ] ∗ τ2)` 0 0 Γ; C ; pc ` v2[v1/x]: τ2[v1/x] C ` C [v1/x] Γ, x:τ1 t`, y :τ2 t` ; C,C ; pc ` e2 : τ [PROD] 0 0 [UNPACK] Γ; C ; pc ` (x=v1[C ], v2 :τ2) : ((x:τ1)[C ] ∗ τ2)⊥ Γ; C ; pc ` let (x, y)=e1 in e2 : τ

Γ; C ; pc ` `i : label 0 i ∈ {1, 2} `i 0 0 Γ; C, `1 v `2 ; pc t `1 t `2 ` e1 : τ 0 0 0 Γ; C ; pc t `1 t `2 ` e2 : τ Γ; C ; pc ` e : τ C ` τ ≤ τ [IF] 0 0 [SUB] 0 Γ; C ; pc ` if `1 v `2 then e1 else e2 : τ t `1 t `2 Γ; C ; pc ` e : τ

Figure 5. Typing rules for the λDSec language

0 not. Similarly, the occurrences of x in τ1 and C are also Theorem 4.1 (Subject reduction). Suppose pc ` e : τ, 0 0 0 replaced by v1 when v1 and C are checked. and M is a well-typed memory. If he, Mi 7−→ he ,M i, Rule (UNPACK) checks product destructors straight- then M 0 is well-typed, and pc ` e0 : τ. forwardly. After unpacking the product value, those ` e : τ (e) = 0 Theorem 4.2 (Progress). If pc , and FV product label constraints in C are in scope and used ∅, and M is a well-typed memory such that he, Mi is for checking e2. a well-formed configuration, then either e is a value or Rule (IF) checks label-test expressions. The con- there exists e0 and M 0 such that he, Mi 7−→ he0,M 0i straint `1 v `2 is added into the typing context and FV (e0) = ∅. when checking the first branch e1. When check- ing the branches, the program-counter label subsumes Proof. By induction on the derivation of pc ` e : τ. The the labels of `1 and `2 to protect them from im- base cases are cases (INT), (UNIT), (LABEL), (LOC), 0 0 plicit flows. The resulting type contains `1 and `2 be- (ABS), (PROD), in which e is a value. cause the result is influenced by the values of ` and 1 • Case (JOIN). In this case, e is `1 t `2. If `1 is not `2. 0 a value, then h`1,Mi 7−→ h`1,Mi by induction, Rule (SUB) is the standard subsumption rule. If τ is 0 and he, Mi 7−→ h`1 t `2,Mi by rule (E9). If `1 τ 0 τ a subtype of , then any expression of type also has is a value, and `2 is not a value, then he, Mi 7−→ type τ 0. 0 h`1 t `2,Mi by the same argument. Otherwise, `1 This type system satisfies the subject reduction prop- and `2 are both values, then he, Mi 7−→ hk, Mi erty and the progress property, as stated in the following by rule (E1), where k = `1 t `2. two theorems. Theorem 4.1 is an instantiation of Theo- • Case (VAR). Since FV (e) = ∅, this case cannot rem 5.1, which is proved in Section 5. occur. τ Definition 4.1 (Well-typed memory). A memory M • Case (REF). e is ref e1. If e1 is not a value, is well-typed if for any memory location mτ in M, 0 0 then he1,Mi 7−→ he1,M i by induction, and ` M(mτ ): τ. τ τ 0 0 href e1,Mi 7−→ href e1,M i. If e1 is a value τ τ τ v, then href e1,Mi 7−→ hm ,M[m 7→ v]i by can be incorporated into a single term e[(v1 | v2)/x] 2 rule (E3). in the extended language λDSec, providing a syntactic • Case (DEREF). By induction and rule (E2). way to reason about two executions. We can show that two λDSec terms only differ at the confidential part if • Case (ASSIGN). By induction and rule (E4). 2 the two terms can be encoded by a well-typed λDSec • Cases (L-APP) and (APP). e is e1e2. If e1 or term. Therefore, proving the noninterference theorem 0 0 e2 is not a value, then he, Mi 7−→ he ,M i of λDSec can be reduced to proving the subject reduc- 2 by induction and (E9). Otherwise, e1 is tion theorem of λDSec. The major extension to Pottier’s 0 λ(x : τ)[C ; pc]. e1, and e2 is v. By rule proof technique is that the bracket construct must also 0 (E5), he, Mi 7−→ he1[v/x],Mi. Since be applied to labels. Because types may contain brack- 0 FV (e1) = FV (e1) ∪ {x} = {x}, we have eted labels, the projection operation also applies to typ- 0 FV (e1[v/x]) = ∅. ing environments. • Case (UNPACK). By induction and rule (E8). The rest of this section details the syntax and seman- 2 tic extensions of λDSec and proves the key subject re- • Case (IF). By induction and rules (E6) and (E7). 2 duction theorem of λDSec and the noninterference theo- • Case (SUB). By induction. rem of λDSec.

5. Noninterference 5.1. Syntax extensions 2 This section proves that any well-typed program in The λDSec language extends λDSec with the bracket λDSec satisfies the noninterference property as dis- constructs and a new value void that can have any type: cussed in Section 2. Let 7−→∗ denote the transitive closure of the 7−→ relationship. The following defi- ` ::= ... | (` | `) nitions and theorem formalize the claim that the type v ::= ... | (v | v) | void system of λDSec enforces noninterference. For sim- e ::= ... | (e | e) plicity, we only consider that results are integers be- cause they can be compared outside the context of where the ellipses represent the terms also belonging to λDSec. λDSec. The bracket constructs cannot be nested, so the subterms of a bracket construct must be λ terms or Definition 5.1 (Well-typed input). An input map A is DSec void.A λ2 memory encodes two λ memories, well-typed with respect to Γ, written Γ ` A, if for any x DSec DSec which may have distinct domains. The bindings of the in dom(Γ), we have ` A(x) : Γ(x)[A], where Γ(x)[A] form mτ 7→ (v | void) and mτ 7→ (void | v) represent represents the type obtained by substituting every free situations where mτ is bound within only one of the two variable y in Γ(x) with A(y). λDSec memories. Definition 5.2 (Input low-equivalence). Two in- 2 Given a λDSec expression e, let bec1 and bec2 rep- A A put maps 1 and 2 are equivalent with respect resent the two λDSec terms that e encodes. The pro- Γ H Γ ` A ≈ A to and label , written as 1 H 2, if jection functions satisfy b(e1 | e2)ci = ei and are ho- Γ ` A1,A2, and for any x in dom(Γ), H 6v Γ(x) im- momorphisms on other expression forms. In addition, A (x) = A (x) plies 1 2 . (e1 | e2)[v/x], the capture-free substitution of v for x in Noninterference Theorem. Suppose H 6v L, and Γ ` (e1 | e2), must use the corresponding projection of v in e : intL. Given two input maps A1 and A2 such that each branch: (e1 | e2)[v/x] = (e1[bvc1/x] | e2[bvc2/x]). ∗ 0 2 Γ ` A1 ≈H A2, if he[Ai],Mi 7−→ hvi,Mi i for i ∈ In λDSec, labels can be bracket constructs, and types {1, 2}, then v1 = v2. may contain bracketed labels. Thus, the projection oper- ation can be applied to labels, types, type assignments, To prove this noninterference theorem, we adapt the and label constraints. Similarly, the projection functions elegant proof technique developed by Pottier and Si- are homomorphisms on these typing constructs. For ex- monet for an ML-like security-typed language [26]. ample, bint c = int , and bx : τ, y : τ 0c = x : Suppose expression e has only one free variable x. To (L | H) 1 L 1 bτc , y :bτ 0c . show that noninterference holds, it is necessary to rea- 1 1 The following relabeling rule is added to reason son about the executions of two related terms: e[v1/x] about relabeling relationship between bracketed labels: and e[v2/x]. We extend λDSec with a bracket construct (e1|e2) that represents alternative expressions that might arise during the evaluation of two programs that differs bCc1 ` b`1c1 v b`2c1 bCc2 ` b`1c2 v b`2c2 initially only in v1 and v2. Then e[v1/x] and e[v2/x] C ` `1 v `2 5.2. Operational semantics 2 Since a λDSec term effectively encodes two λDSec [VOID]Γ; C ; pc ` void : τ 2 terms, the evaluation of a λDSec term can be pro- bΓc ;bCc ;b 0c ` e : bτc jected into two λDSec evaluations. An evaluation step of 1 1 pc 1 1 1 0 bΓc2 ;bCc2 ;bpc c2 ` e2 : bτc2 a bracket expression (e1 | e2) is an evaluation step of ei- H t pc v pc0 H v τ ther e1 or e2. and e1 or e2 can only access the cor- [BRACKET] responding projection of the memory. Thus, the con- Γ; C ; pc ` (e1 | e2): τ 2 figuration of λDSec has an index i ∈ {•, 1, 2} that 2 indicates whether the term to be evaluated is a sub- Before proving the λDSec type system satisfies the term of a bracket expression, and if so which branch subject reduction property, we first prove some lemmas of a bracket the term belongs to. For example, the con- about projection and substitution. figuration he, Mi1 means that e belongs to the first Lemma 5.3 (Label Projection). If C ` `1 v `2, then branch of a bracket, and e can only access the first pro- bCci ` b`1ci v b`2ci for i ∈ {1, 2}. jection of M. We write “he, Mi” for “he, Mi•”, which means e does not belong to any bracket. Proof. By induction on the derivation of C ` `1 v `2. 2 The operational semantics of λDSec is shown in Fig- ure 6. It is based on the semantics of λ and contains DSec Lemma 5.4 (Constraint Reduction). If Γ; C, ` v some new evaluation rules (E10–E14) for manipulating 1 ` ; pc ` e : τ and C ` ` v ` , then Γ; C ; pc ` e : τ. bracket constructs. Rules (E2)–(E4) are modified to ac- 2 1 2 cess the memory projection corresponding to index i. Proof. By induction on the derivation of Γ; C, `1 v 2 The rest of the rules in Figure 2 are adapted to λDSec by `2 ; pc ` e : τ. indexing each configuration with i. The following two 2 Lemma 5.5 (Projection). If Γ; C ; pc ` e : τ, then lemmas state that the operational semantics of λDSec is bΓc ;bCc ;bpcc ` bec : bτc , for i ∈ {1, 2}. adequate to encode the execution of two λDSec terms. i i i i i Lemma 5.1 (Soundness). If he, Mi 7−→ he0,M 0i, then Proof. By induction on the derivation of Γ; C ; pc ` e : ∗ 0 0 hbeci, bMcii 7−→ hbe ci, bM cii for i ∈ {1, 2}. τ, and using the label projection lemma. Proof. By inspection of the evaluation rules. Lemma 5.6 (Store Access). Let i be in {•, 1, 2}. Sup- pose pc ` v : τ and pc ` v0 : τ. In addition, ∗ Lemma 5.2 (Completeness). If hbeci, bMcii 7−→ i ∈ {1, 2} implies H v τ. Then pc ` readi v : bτci, 0 0 hvi,Mi i for i ∈ {1, 2}, then there exists a configura- pc ` newi v : τ and pc ` updatei v v : τ. tion hv, M 0i such that he, Mi 7−→∗ hv, M 0i. Proof. By the definition of the functions read, new and Proof. First, he, Mi cannot admit an infinite evaluation update in Figure 6, by the projection lemma, and rules sequence. Rules (E11)–(E16) can only be applied for fi- (VOID) and (BRACKET). nite times because each of these rules moves some pair Lemma 5.7 (Substitution). If x : τ 0, Γ; C ; pc ` e : τ, constructor strictly closer to the term’s root. These rules and ` v : τ 0[v/x], then Γ[v/x]; C[v/x]; pc[v/x] ` are the only rules that leave both projections of a con- e[v/x]: τ[v/x]. figuration unchanged. Therefore, by Lemma 5.1, an in- finite evaluation sequence of he, Mi implies that for Proof. By induction on the derivation of some i ∈ {1, 2}, hbeci, bMcii admits an infinite eval- x:τ 0, Γ; C ; pc ` e : τ. ∗ uation sequence, which contradicts hbeci, bMcii 7−→ 0 Theorem 5.1 (Subject reduction). Suppose pc ` e : τ, hvi,M i, since the operational semantics of λDSec is i 0 0 deterministic. memory M is well-typed, he, Mii 7−→ he ,M ii, and 0 0 By induction on the structure of e, we can prove i ∈ {1, 2} implies H v pc. Then pc ` e : τ, and M is also well-typed. that if he, Mi is stuck, then hbeci, bMcii for some i ∈ {1, 2} is also stuck. Therefore, he, Mi cannot be Proof. By induction on the derivation of he, Mii 7−→ stuck, and then it must terminate normally. 0 0 he ,M ii. Without loss of generality, we assume that the last step of the derivation of pc ` e : τ does not use the rule (SUB). Suppose the derivation of pc ` e : τ 5.3. Typing and subject reduction ends with using (SUB). Then there exists τ 0 such that 2 0 0 0 The type system of λDSec includes all the typing rules pc ` e : τ , and τ ≤ τ, and the derivation of pc ` e : τ in Figure 5 and has two additional rules, one for typing does not end with using (SUB). If we can show pc ` e : void, the other for typing bracket constructs. τ 0, which satisfies the assumption, then pc ` e : τ by τ τ [E2] h!m ,Mii 7−→ hreadi M(m ),Mii

m = newloc(M) [E3] τ τ τ href v, Mii 7−→ hm ,M[m 7→ newi v]ii

τ τ τ [E4] hm := v, Mii 7−→ h(),M[m 7→ updatei M(m ) v]ii

0 0 0 hei,Mii 7−→ hei,M ii ej = ej {i, j} = {1, 2} [E10] 0 0 0 h(e1 | e2),Mi 7−→ h(e1 | e2),M i

[E11] h(v1 | v2)v, Mi 7−→ h(v1bvc1 | v2bvc2),Mi

[E12] h(v1 | v2) := v, Mi 7−→ h(v1 := bvc1 | v2 := bvc2),Mi

[E13] h!(v1 | v2),Mi 7−→ h(!v1 | !v2),Mi

[E14] hif v1 v v2 then e1 else e2,Mi 7−→ h(if bv1c1 v bv2c1 then be1c1 else be2c1 | if bv1c2 v bv2c2 then be1c2 else be2c2),Mi 0 0 if v1 = (v | v ) or v2 = (v | v )

0 0 [E15] hv1 t v2,Mi 7−→ h(bv1c1 t bv2c1 | bv1c2 t bv2c2),Mi if v1 = (v | v ) or v2 = (v | v )

0 0 0 0 0 0 [E16] hlet (x, y)=((x=v1[C], v2 :τ) | (x=v1[C ], v2 :τ )) in e, Mi 7−→ he[(v2 | v2)/y][(v1 | v1)/x],Mi

[Auxiliary functions]

0 0 new• v = v update• v v = v read• v = v 0 0 new1 v = (v | void) update1 v v = (v | bvc2) read1 v = bvc1 0 0 new2 v = (void | v) update2 v v = (bvc1 | v ) read2 v = bvc2

2 Figure 6. Small-step operational semantics of λDSec

(SUB). Therefore, the assumption does not lose gener- • Case (E6). By rule (IF), k1 v k2 ; pc ` e1 : τ. By ality. Lemma 5.4 and L |= k1 v k2, we have pc ` e1 : Here we just show eight cases: (E3), (E5), (E6), (E8), τ. (E10), (E11), (E14) and (E16). The rest of evaluation • Case (E8). e is let(x, y)=(x=v [C], v :τ )ine0. rules are treated similarly. 1 2 2 By rule (UNPACK), pc ` (x=v1[C], v2 :τ2) : ((x: 0 τ 0 0 τ1)[C] ∗ τ2)`, and x : τ1 t `, y : τ2 t ` ; pc ` e : τ. • Case (E3). e is ref v, and τ is (τ ref)⊥. Then 0 τ 0 0 0 By rule (PROD), pc ` v1 : τ1[v1/x], and e is m . By (LOC), pc ` e :(τ ref)⊥. By 0 pc ` v [v /x]: τ [v /x], and ` C[v /x]. Lemma 5.6, pc ` new v : τ 0. Thus, M[mτ 7→ 2 1 2 1 1 i Using the substitution lemma twice, we newiv] is well-typed. 0 get C[v1/x]; pc ` e [v1/x][v2[v1/x]/y]: • Case (E5). e is (λ(x : τ 0)[C0 ; pc0]. e0)v. Then pc ` τ[v1/x][v2[v1/x]/y]. It is straightforward to show 0 0 00 00 that e [v /x][v [v /x]/y] = e [v /y][v /x]. Ac- 0 0 0 0 00 C ; pc 1 2 1 2 1 λ(x : τ )[C ; pc ]. e : ((x : τ ) −−−−−→ τ1)`, and cording to rule (UNPACK), x, y 6∈ FV (τ). Thus, 00 00 pc ` v : τ , and ` C [v/x]. By rules (APP) and τ[v /x][v [v /x]/y] = τ. In addition, we have 00 1 2 1 (L-APP), τ = τ1[v/x] t `, and pc v pc [v/x]. By ` C[v /x]. Therefore, pc ` e[v /x][v /y]: τ. 0 0 0 0 1 1 2 rules (ABS) and (SUB), x : τ ; C ; pc ` e : τ1, 00 0 00 0 00 0 and ` τ ≤ τ , ` pc v pc , and C ` C . • Case (E10). e is (e1 | e2). Without loss of general- 0 0 0 0 0 Therefore, ` C [v/x], and pc v pc [v/x]. By the ity, assume he1,Mi1 7−→ he1,M i1 and e2 = e2. 0 0 0 substitution lemma, C [v/x]; pc [v/x] ` e [v/x]: By rule (BRACKET), H v pc, and bpcc1 ` e1 : 0 0 τ1[v/x]. By Lemma 5.4, pc [v/x] ` e [v/x]: bτc1. H v pc implies H v bpcc1. By induction, 0 0 0 τ1[v/x]. Since pc v pc [v/x] and τ1[v/x] v τ, bpcc1 ` e1 : bτc1, and M is well-typed. Using 0 0 0 we have pc ` e [v/x]: τ. rule (BRACKET), we can get pc ` (e1 | e2): τ. • Case (E11). e is (v1 | v2)v. By (APP) and (L-APP), 6. Dynamic labels in practice 0 0 0 C ; pc 00 pc ` (v1 | v2) : ((x : τ ) −−−−→ τ )`, and The simplicity of λDSec helps proving the correctness of 0 00 pc ` v : τ . Then τ = τ [v/x] t `. In addition, its dynamic label mechanism, but makes λDSec imprac- pc t ` v pc0. By (BRACKET), H v `, which im- tical to use. This section shows that the dynamic label 0 plies H v pc . By Lemma 5.5, bpcci ` vi : ((x : mechanism of λDSec can be applied to a practical pro- 0 0 0 bC ci ;bpc ci gramming language such as Jif. First, we show that the bτ ci) −−−−−−−−→bτci)b`ci , and bpcci ` bvci : bτ 0c , which imply bpcc ` v bvc : bτc . Ac- existing dynamic label mechanism of Jif can be inter- i i i i i λ cording to (APP) and (L-APP), a well-typed appli- preted using DSec. Second, we propose an extension to the dynamic label mechanism of Jif based on λDSec. cation expression e1e2 can be type-checked with the pc component of the type of e1 in the typ- 0 6.1. Dynamic labels in Jif ing context. Therefore, bpc ci ` vibvci : bτci. Since H v pc0, we can apply (BRACKET) to get Jif [24] is the only implemented security-typed language pc ` (v1bvc1 | v2bvc2): τ. supporting dynamic labels. Jif extends the Java lan- guage [14] with static information flow control. Jif aims • Case (E14). e is if v1 v v2 then e1 else e2, and there exists j ∈ {1, 2} such that v = (v | v0). Sup- to provide a usable programming model, in which the j dynamic label mechanism plays an important role. pose pc ` v : label for i ∈ {1, 2}. Since v is i `i j In Jif, labels can also be used as first-class values, a bracket construct, H v `j. By (IF), both e1 and e are type-checked with pc t ` t ` in the typ- and a variable of type label may be used as a label 2 1 2 for other values. Jif provides the switch label state- ing context. Thus, we can get pc t `1 t `2 ` e : τ. By Lemma 5.5, bpc t ` t ` c ` bec : bτc . ment for run-time label tests. For example, the follow- 1 2 i i i ing code uses the switch label statement to send a H v `j implies H v bpc t `1 t `2ci. Applying (BRACKET), we get pc ` (bec | bec ): τ. value through a communication channel with a dynamic 1 2 label: • Case (E16). e is let (x, y) = ((x = v1[C], v2 : 0 0 0 0 0 (A) final label{L} x; τ) | (x = v1[C ], v2 : τ )) in e . Suppose expres- 0 0 0 0 Channel{*x} c; sion ((x = v1[C], v2 : τ) | (x = v1[C ], v2 : τ )) has type (x : τ1)[C0] ∗ τ2)⊥. It is easy to show that int{H} y; 0 0 switch label(y) { (v1 | v1) and (v2 | v2) have type τ1 and τ2 respec- tively. Then this case is reduced to case (E8), which case (int{*x} z) c.send(z); is standard. else throw new UnsafeTransfer(); }

The send operation is secure only if x is a high-security 5.4. Noninterference proof label, which has to be determined at run time. The nota- Theorem 5.2 (Noninterference). Suppose H 6v L, and tion *x refers to the label value of x; it can be used as a Γ ` e : intL. Given two input maps A1 and A2 such label only if x is declared as a final variable, to prevent ∗ 0 that Γ ` A1 ≈H A2, if he[Ai],Mi 7−→ hvi,Mi i for assignments from changing the meaning of types that i ∈ {1, 2}, then v1 = v2. mention it. In the example, the switch label state- ment executes the first of the cases whose associated la- Proof. First, we incorporate A and A into a λ2 1 2 DSec bel is at least as restrictive as that of y. The value of y input map A such that for any x in dom(Γ), A(x) = is assigned to the corresponding variable (for example, A (x) if A (x) = A (x), and A(x) = (A (x) | A (x)) 1 1 2 1 2 z). In this example, the first case will be executed only if otherwise. Since Γ ` A ≈ A , A(x) is a bracket 1 H 2 if H v ∗x, guaranteeing that c is a high-security chan- construct only if H v Γ(x)[A ] and H v Γ(x)[A ], 1 2 nel. or equivalently, H v Γ(x)[A]. Therefore, A is a well- In general, the statement switch label(e){case typed input map with respect to Γ. By Lemma 5.7, (int{`} x) S1; else S2} can be encoded as the fol- ` e[A]: intL. ∗ 0 lowing pseudo-code in λDSec: Because he[Ai],Mi 7−→ hvi,Mi i and e[A ] = be[A]c for i ∈ {1, 2}, he[(v |v )/x],Mi 7−→∗ i i 1 2 if `e v ` then (λ(x:int`)[pc].S1) e else S2 0 hv, M i by Lemma 5.2. Moreover, ` v : intL by Theo- rem 5.1. Thus, v is not a bracket value, and bvc1 = bvc2. where `e represents the label of e, and pc is an upper ∗ 0 By Lemma 5.1, he[Ai],Mi 7−→ hbvci, bM cii for bound to the labels of the effects of S1. By rule (IF), i ∈ {1, 2}. Since the operational semantics of λDSec is `1 t `2 v pc needs to hold, where `1 and `2 are the la- deterministic, we have v1 = bvc1 and v2 = bvc2, which bels of `e and `, respectively. Indeed, the type system of imply v1 = v2. Jif ensures `1 t `2 v pc. In Jif, labels are specified using the decentral- conditional branches are statements instead of expres- ized label model [23]. These labels may explic- sions: “if (`1<=`2) S1 else S2”. Intuitively, S1 is itly mention principals. For example, a value with executed if `1 v `2 is true at run time; otherwise, S2 is type int{Alice:Bob} is an integer owned by princi- executed. As in λDSec, `1 v `2 can be assumed to hold pal Alice and readable by Alice and Bob. Like la- when type-checking S1. bels, principals may also be used as first-class values at Both the switch label statement and the actsFor run time. The statement actsFor(p1, p2)S executes statement in Jif can be encoded with the label-test state- the statement S if the principal p1 can act for the princi- ment. For example, the statement “actsFor(p1, pal p2. This acts-for relationship between p1 and p2 is p2) S” is equivalent to “if ({p2:} <= {p1:}) S”. equivalent to {p2:} v {p1:}. Thus the actsFor state- ment essentially implements a run-time label test, and 6.2.2. Method label constraints Jif-DX allows gen- can be encoded as: eral label constraints to be specified in method signa- tures, whereas Jif only provides actsFor constraints. if {p2:} v {p1:} then S else () The following example shows a use of a label constraint on a method: The Jif type system checks S with a program counter la- (B) class Key[principal p] { bel pc such that ` t ` v pc, where ` and ` are the la- 1 2 1 2 int{} encrypt(label{} lb, bels of p1 and p2, respectively. This is consistent with int{*lb} x) the type system of λ . DSec where {*lb} <= {p:} { ... 6.2. The Jif-DX language } The original Jif dynamic label mechanism appears to be } sound but has several limitations. First, label checking The class Key[principal p] represents a key belong- of the clauses of a switch label statement does not ing to principal p. The encrypt method takes in a label fully exploit the label constraint enforced by the run- lb and an integer x labeled with {*lb}, and attempts to time test. Second, Jif supports only one kind of statically encrypt x with the key of principal p and return the en- specified label constraints: actsFor constraints, which crypted result as a public integer. This method should give information about principals but are not as power- only encrypt the data owned by principal p, because the ful as general label constraints. Third, in Jif only vari- result can be decrypted by p. This requirement is cap- ables or fields of the enclosing class declaration can be tured by the method label constraint {*lb} v {p:}. used as dynamic labels, but in practice other expressions The ensures that the constraint is satisfied may be useful in dynamic labels. wherever this method is called. These limitations of Jif make it difficult or awkward Another way to write this code would be to insert to write some applications that need to manipulate dy- a run-time check in the method body and make the namic labels. Therefore, we propose the Jif-DX lan- method throw an exception if {*lb} v {p:} is not sat- guage, which extends Jif with a better dynamic label isfied at run time. This code would incur some unnec- mechanism, including the label-test statement, method essary run-time label checks, and the caller would have and field label constraints, and more general label ex- to handle the exception somehow. Indeed, one advan- 1 pressions . These new language features are based on tage of the method label constraint is its ability to ex- the constructs of λDSec. In particular, the label-test state- ploit information available at the caller side to reduce ment resembles the label-test expression of λDSec; a the number of run-time checks. For example, in the fol- method label constraint corresponds to the label con- lowing Jif-DX code the compiler can determine that the straint component of a lambda term; a field label con- method constraint is satisfied without a run-time check: straint corresponds to the label constraint component in a pair value. (C) Key[Alice]{} k; 6.2.1. The label-test statement Jif-DX provides the int{Alice:Bob} x; label-test statement, which is a more flexible way to im- k.encrypt({Alice:Bob}, x); plement run-time label checks than the switch label statement. The label-test statement resembles the con- ditional label-test expression of λDSec, except that the 6.2.3. Field label constraints In Jif-DX, label con- straints can also be specified on class fields of type 1 Some of the proposed features have been incorporated into Jif ver- label. The compiler ensures that the field label con- sion 3.0. straints of a class are satisfied whenever a new instance of the class is created. All fields appearing in a label con- mate label, and the following code can be used to ac- straint must be final, so field label constraints that are cess o.content while preserving its precise type. satisfied when an object is created will hold for the life- (F) int{*o.lb} y = o.content; time of the object. Like method label constraints, field label constraints If o were not a final variable, then o.content would can be used to reduce the number of run-time label not be well-typed in Jif-DX. But there is an easy checks. For example, sending an integer through a mul- workaround: assign o to a final variable fo and ac- tilevel communication channel with label ` requires cess the content field by fo.content, which has a sending the exact label of the integer through the chan- well-formed type int{*fo.lb}. This workaround is nel. The natural way to implement it is to wrap the inte- like unpacking a pair value in λDSec. ger and its label in an object of the Labeled class and 6.2.5. Example: bounded dynamic labeling In this send the object through the channel. section, we show how to use the new dynamic label constructs in Jif-DX to implement a MAC mechanism, (D) class Labeled { which would be much harder and unintuitive to imple- public final label{`} lb; ment in Jif. The MAC mechanism in the MITRE CMW public int{*lb} content; system [34] associates two labels with each object: a public Labeled(label{`} x, floating label and a fixed mandatory label. The floating int{*x} y) { label is updated accordingly when the content of the ob- lb = x; content = y; ject is updated, but is bounded by the fixed mandatory } label in order to prevent the covert channel caused by } label updates. The doubly labeled object can be repre- The label of field lb is `, ensuring that lb itself can be sented by a UBLabeled (see code fragment E) object in sent through the channel. But the label of field content Jif-DX, and the policy that the floating label be bounded is dynamic, and the constraint {*lb} v ` needs to hold by the mandatory label is represented by the field con- for field content to be sent safely through the chan- straint {*lb} v `, where {*lb} is the floating label, nel. This constraint can be enforced by a run-time la- and ` is the mandatory label. bel check, but it can also be enforced statically by spec- The following code shows how to update the label ifying a field label constraint {*lb} v `, as in the and access the content of a UBLabeled object. Simple UBLabeled (“UB” stands for upper bound) class. Send- as it is, this example demonstrates several subtle issues ing a UBLabeled object through a channel with label ` related to manipulating dynamic labels. is always safe. (G) UBLabeled o; (E) class UBLabeled { final label{} x, y; public final label{`} lb int{*x} data; where {*lb} <= `; ... public int{*lb} content; (1) if ({*x} <= `) public UBLabeled(label{`} x, o = new UBLabeled(x, data); int{*x} y) final UBLabeled{} fo = o; where {*x} <= ` { (2) if ({*fo.lb} <= {*y} && {*y} <= `) lb = x; content = y; o = new UBLabeled(y, fo.content); } } (3) int{`} output = fo.content; int{Alice:} output2; 6.2.4. Path-expression labels Consider the Labeled (4) if ({*fo.lb} <= {Alice:}) class again, and suppose o is a Labeled object. output2 = fo.content; Then what is the type of o.content? Accord- ing to the Labeled class, the precise type would be The first label-test statement (1) attempts to update the int{*o.lb}, which cannot be expressed in Jif be- content of o, and the constraint {*x} <= ` guarantees the cause Jif does not allow path expressions such as o.lb label of the new value is bounded by the mandatory la- to appear in labels. bel `. The constructor call new UBLabeled(x, data) In Jif-DX, a path expression with the type label can is well-typed because of the constraint {*x} v ` en- be used in label expressions as long as all the identi- forced by the label test. fiers in the path expression are final, ensuring that the The second label-test statement (2) attempts path expression always has the same value. For exam- to just update the label field of o to y. The first test ple, if o is a final variable, then {*o.lb} is a legiti- {*fo.lb}<={*y} is necessary for new UBLabeled(y, fo.content) to be well-typed, because the type of One problem with type-based static information flow fo.content (int{*fo.lb}) must be a subtype of analyses is that they tend to be conservative and may int{*y}. Essentially, the constraint prevents down- identify information flows that do not exist. For exam- grading the label of the object content. Furthermore, ple, consider the following code: this example shows that the immutability require- ment for label fields is not a fundamental limitation if s <= 0 then x := 0 else x := 0 because adding a level of indirection makes it pos- in which x does not depend on s, but most security type sible to update o.lb even though the field lb is fi- systems still ensure `s v `x. Some recent work [2, 16] nal. partially addresses this problem by using flow-sensitive The last two statements (3,4) attempt to ac- static analyses. cess o.content. The assignment to output is The Jif language [21, 24] extends Java with a type well-typed because of the field label constraint system for analyzing information flow, and aims to be {*fo.lb} v `. The assignment to output2 might ap- a practical language for developing secure applications. pear secure because a label test is used to ensure the However, there is not yet a noninterference proof for label of output2 is at least as restrictive as the la- the type system of Jif, because of its complexity. This bel of fo.content. However, there is an implicit work is inspired by the dynamic label mechanism of flow from fo.lb to output2 in the label-test state- Jif, although the dynamic label mechanism in λDSec is ment. The implicit flow is legal only if ` v {Alice:}, more expressive. Jif provides two constructs for run- which prevents a possible covert channel caused by dy- time label tests: the switch-label statement and the namic labeling. actsFor statement, both of which can be encoded us- ing the label-test expression in λDSec. The typing rules 7. Related Work for switch-label and actsFor are as restrictive as the typing rule of the label-test expression. Thus, the nonin- Dynamic information flow control mechanisms [33, 34] terference result for λDSec provides strong evidence that track security labels dynamically and use run-time secu- these dynamic label constructs in Jif are secure. rity checks to constrain information propagation. These Banerjee and Naumann [5] proved a noninterference mechanisms are transparent to programs, but they can- result for a Java-like language with simple access con- not prevent illegal implicit flows arising from the con- trol primitives. Unlike in λDSec, run-time access control trol flow paths not taken at run time. in their language is separate from information flow con- Various general security models [18, 30, 12] have trol in the sense that the result of a run-time access check been proposed to incorporate dynamic labeling. Unlike does not affect the security of any information flow in a noninterference, these models define what it means for program. a system to be secure according to a certain relabeling Concurrent to our work, Tse and Zdancewic proved policy, which may allow downgrading labels. a noninterference result for a security-typed lambda Using static program analysis to check informa- calculus (λRP) with run-time principals [31]. Run-time tion flow was first proposed by Denning and Den- principals are closely related to dynamic labels, as la- ning [8]; later work phrased the analysis as type bels are composed of principals in the decentralized la- checking (e.g., [25]). Noninterference was later de- bel model of Jif. However, λRP does not support refer- veloped as a more semantic characterization of secu- ences or existential types, which makes it unable to rep- rity [13], followed by many extensions. Volpano, Smith resent dynamic security policies that may be changed at and Irvine [32] first showed that type systems can be run time, such as file permissions. As discussed in Sec- used to enforce noninterference, and proved a ver- tion 1, modeling real systems requires this ability. By sion of noninterference theorem for a simple imperative comparison, in λDSec the label stored in a reference may language, starting a line of research pursuing the nonin- be updated at run time, and with dependent existential terference result for more expressive security-typed lan- types, we can ensure that a piece of data and its label are guages. Heintze and Riecke [15] proved the noninterfer- updated consistently. In addition, support for references ence theorem for the SLam calculus, a purely functional makes λDSec more powerful than λRP computationally. language. Zdancewic and Myers [37] investigated a se- The λRP type system uses singleton types (types contain- cure calculus with first-class continuations and refer- ing only one value [3]) for relating type information to ences. Pottier and Simonet [26] considered an ML-like term-level constructs. We have chosen to use dependent functional language and introduced the proof tech- types because it is the approach used by Jif, and the ap- nique that is extended in this paper. A more complete proach based on singleton types neither provides more survey of language-based information-flow tech- expressiveness nor simplifies the type system or the non- niques can be found in [28]. interference proof in any substantial way. In general, we feel that the choice between dependent types and single- [5] Anindya Banerjee and David A. Naumann. Using ac- tons is a matter of taste. cess control for secure information flow in a Java-like Other work [36, 35] has used dependent type systems language. In Proc. 16th IEEE Computer Security Foun- to specify complex program invariants and to statically dations Workshop, pages 155–169, June 2003. catch program errors considered run-time errors by tra- [6] D. E. Bell and L. J. LaPadula. Secure computer systems: ditional type systems. This work also makes a trade-off mathematical foundations and model. Technical Report between expressive power and practical type checking. M74-244, MITRE Corp., Bedford, MA, 1973. [7] Dorothy E. Denning. Cryptography and Data Security. 8. Conclusions Addison-Wesley, Reading, Massachusetts, 1982. [8] Dorothy E. Denning and Peter J. Denning. Certification This paper formalizes computation and static checking of programs for secure information flow. Comm. of the of dynamic labels in the type system of a core language ACM, 20(7):504–513, July 1977. λDSec and proves a noninterference result: well-typed [9] Department of Defense. Department of Defense Trusted programs have the noninterference property. The lan- Computer System Evaluation Criteria, DOD 5200.28- guage λDSec is the first language supporting general dy- STD (The Orange Book) edition, December 1985. namic labels whose type system is proved to enforce [10] Petros Efstathopoulos, Maxwell Krohn, Steve VanDe- noninterference. Based on the dynamic label mechanism Bogart, Cliff Frey, David Ziegler, Eddie Kohler, David of λDSec, we propose an extension to Jif, making it eas- Mazieres,` Frans Kaashoek, and Robert Morris. Labels ier to write programs manipulating dynamic labels effi- and event processes in the Asbestos operating system. In ciently. Proc. 20th ACM Symp. on Operating System Principles An important direction for future work is to investi- (SOSP), October 2005. gate the interaction between dynamic labels and para- [11] J. S. Fenton. Memoryless subsystems. Computing J., metric polymorphism. 17(2):143–147, May 1974. [12] Simon Foley, Li Gong, and Xiaolei Qian. A security Acknowledgements model of dynamic labeling providing a tiered approach to verification. In IEEE Symposium on Security and Pri- The authors would like to thank Greg Morrisett, Steve vacy, pages 142–154, Oakland, CA, 1996. IEEE Com- Zdancewic and Amal Ahmed for their insightful sug- puter Society Press. gestions. Many thanks also to Steve Chong, Nate Nys- [13] Joseph A. Goguen and Jose Meseguer. Security policies trom, Michael Clarkson, Yin Wang and the anonymous and security models. In Proc. IEEE Symp. on Security reviewers, who all provided useful feedback on earlier and Privacy, pages 11–20, April 1982. drafts of this paper. [14] James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. This work was supported by the Department of the The Java Language Specification. Addison Wesley, 2nd Navy, Office of Naval Research, under ONR Grant edition, 2000. ISBN 0-201-31008-2. N00014-01-1-0968. Any opinions, findings, conclu- [15] Nevin Heintze and Jon G. Riecke. The SLam calculus: sions, or recommendations contained in this material Programming with secrecy and integrity. In Proc. 25th are those of the authors and do not necessarily re- ACM Symposium on Principles of Programming Lan- flect views of the Office of Naval Research. This work guages (POPL), pages 365–377, San Diego, California, was also supported by the National Science Founda- January 1998. tion under grants 0208642, 0133302, and 0430161, and [16] Sebastian Hunt and David Sands. On flow-sensitive se- by an Alfred P. Sloan Research Fellowship. curity types. In Proc. 33rd ACM Symposium on Princi- ples of Programming Languages (POPL), pages 79–90, References January 2006. [17] M. Douglas McIlroy and James A. Reeds. Multilevel se- [1] Johan Agat. Transforming out timing leaks. In Proc. 27th curity in the UNIX tradition. Software—Practice and Ex- ACM Symposium on Principles of Programming Lan- perience, 22(8):673–694, August 1992. guages (POPL), pages 40–53, January 2000. [18] John McLean. The algebra of security. In IEEE Sympo- [2] Torben Amtoft and Anindya Banerjee. Information flow sium on Security and Privacy, pages 2–7, Oakland, Cal- analysis in logical form. In The Eleventh International ifornia, 1988. Symposium on Static Analysis Proceedings, pages 100– 115, 2004. [19] Catherine Meadows. Policies for dynamic upgrading. In [3] David Aspinall. Subtyping with singleton types. In Com- Database Security, IV: Status and Prospects, pages 241– puter Science Logic (CSL), Kazimierz, Poland, pages 1– 250. North Holland, 1991. 15. Springer-Verlag, 1994. [20] John C. Mitchell. Foundations for Programming Lan- [4] Anindya Banerjee and David A. Naumann. Secure infor- guages. The MIT Press, Cambridge, Massachusetts, mation flow and pointer confinement in a Java-like lan- 1996. guage. In Proc. 15th IEEE Computer Security Founda- [21] Andrew C. Myers. JFlow: Practical mostly-static infor- tions Workshop, June 2002. mation flow control. In Proc. 26th ACM Symposium on Principles of Programming Languages (POPL), pages [37] Steve Zdancewic and Andrew C. Myers. Secure in- 228–241, January 1999. formation flow via linear continuations. Higher Order [22] Andrew C. Myers and Barbara Liskov. A decentralized and Symbolic Computation, 15(2–3):209–234, Septem- model for information flow control. In Proc. 17th ACM ber 2002. Symp. on Operating System Principles (SOSP), pages [38] Steve Zdancewic and Andrew C. Myers. Observa- 129–142, 1997. tional determinism for concurrent program security. In [23] Andrew C. Myers and Barbara Liskov. Protecting Proc. 16th IEEE Computer Security Foundations Work- privacy using the decentralized label model. ACM shop, pages 29–43, June 2003. Transactions on Software Engineering and Methodol- [39] Lantian Zheng and Andrew C. Myers. Dynamic security ogy, 9(4):410–442, October 2000. labels and noninterference. In Proc. 2nd Workshop on [24] Andrew C. Myers, Lantian Zheng, Steve Zdancewic, Formal Aspects in Security and Trust, IFIP TC1 WG1.7. Stephen Chong, and Nathaniel Nystrom. Jif Springer, August 2004. 3.0: Java information flow. Software release, http://www.cs.cornell.edu/jif, July 2006. [25] Jens Palsberg and Peter Ørbæk. Trust in the λ-calculus. In Proc. 2nd International Symposium on Static Analy- sis, number 983 in Lecture Notes in Computer Science, pages 314–329. Springer, September 1995. [26] Franc¸ois Pottier and Vincent Simonet. Information flow inference for ML. In Proc. 29th ACM Symposium on Principles of Programming Languages (POPL), pages 319–330, 2002. [27] Andrei Sabelfeld and Heiko Mantel. Static confidential- ity enforcement for distributed programs. In Proc. 9th In- ternational Static Analysis Symposium, volume 2477 of LNCS, Madrid, Spain, September 2002. Springer-Verlag. [28] Andrei Sabelfeld and Andrew C. Myers. Language- based information-flow security. IEEE Journal on Se- lected Areas in Communications, 21(1):5–19, January 2003. [29] Ray Spencer, Stephen Smalley, Peter Loscocco, Mike Hibler, David Andersen, and Jay Lepreau. The Flask security architecture: System support for diverse secu- rity policies. In Proc. 8th USENIX Security Symp., pages 123–139, August 1999. [30] Ian Sutherland, Stanley Perlo, and Rammohan Varadara- jan. Deducibility security with dynamic level assign- ments. In Proc. 2nd IEEE Computer Security Founda- tions Workshop, Franconia, NH, June 1989. [31] Stephen Tse and Steve Zdancewic. Run-time principals in information-flow type systems. In IEEE Symposium on Security and Privacy, Oakland, CA, May 2004. [32] Dennis Volpano, Geoffrey Smith, and Cynthia Irvine. A sound type system for secure flow analysis. Journal of Computer Security, 4(3):167–187, 1996. [33] Clark Weissman. Security controls in the ADEPT-50 time-sharing system. In AFIPS Conference Proceedings, volume 35, pages 119–133, 1969. [34] John P. L. Woodward. Exploiting the dual nature of sen- sitivity labels. In IEEE Symposium on Security and Pri- vacy, pages 23–30, Oakland, California, 1987. [35] Hongwei Xi. Imperative programming with dependent types. In Proceedings of 15th Symposium on Logic in Computer Science, Santa Barbara, June 2000. [36] Hongwei Xi and Frank Pfenning. Dependent types in practical programming. In Proc. 26th ACM Sympo- sium on Principles of Programming Languages (POPL), pages 214–227, San Antonio, TX, January 1999.