Title: Principals in Programming Languages: A Syntactic Proof Technique
1Principals in Programming LanguagesA Syntactic
Proof Technique
- Steve Zdancewic
- Dan Grossman and Greg Morrisett
- Cornell University
2Type Abstraction
- Long history of study
- Strachey 1967, Reynolds 1974, 1983, Mitchell
Plotkin 1988, ... - Reasoning about Programs
- Type safety
- System Design
- Extensible Systems
3Principals
- One way to characterize principals is by their
"view" of the environment. - Resources Available
- Memory
- Security Privileges
- Type Information (this talk)
4Types and Principals
val h open"file" ...
Client
( File handle ) abstype fh open string ?
fh read fh ? char
API
Host
type fh int fun open s ...
5Safety Properties
- Client cant create file handles
- Must call open to obtain file handles
- File handles are abstract
- No client ever performs
- handle 3
- Host can return any integer as handle
- The read function is applied only to
host-provided values
6Polymorphic Encoding
(L fh. l hostopen string ? fh,
read fh ? char.
ltclientgt)
7Operational Models Needed
- Parametric Polymorphism
- Recursive Types
- References State
- Control Operators
- Threads
- Objects
- ...
8The Goal
Track and enforce type abstractions in an
operational semantics.
(Proofs in style of Wright Felleisen 1992)
9Linking Host and Client
(L fh. l hostopen string ? fh,
read fh ? char.
ltclientgt) int lthostgt
10Evaluation
(L fh. l hostopen string ? fh,
read fh ? char. ltclient
bodygt) int lthostgt
(l hostopen string ? int,
read int ? char. ltclientgtint/fh) lt
hostgt
11Evaluation
(l hostopen string ? int,
read int ? char. ltclient
bodygtint/fh) lthostgt
ltclientgtint/fhlthostgt/host
12An Observation
- No mention of fh
- No distinction between client and
- host
ltclientgtint/fhlthostgt/host
13Our Solution
- Make principals explicit in the syntax
- Color client code blue
- Color host code red
- Typecheck with different rules
- Host knows fh int
- Track colors during evaluation
14Syntax
t fh int t ? t ...
C x n lxt.C (C C) Ht
H x n lxt.H (H H) Ct
G Ć Gxt Gxt
15Client Operational Semantics
nint ? n
lxt.H s? s? ? lxs.Hxt/xs?
16Host Operational Semantics
nfhint ? n
17lhandle int. hr(handle)fh?char 3fh
18lhandle int. hr(handle)fh?char 3fh
lhandle fh. hr(handleint)char 3fh
19lhandle int. hr(handle)fh?char 3fh
lhandle fh. hr(handleint)char 3fh
hr(3fhint)char
20lhandle int. hr(handle)fh?char 3fh
lhandle fh. hr(handleint)char 3fh
hr(3fhint)char
hr(3)char
21lhandle int. hr(handle)fh?char 3fh
lhandle fh. hr(handleint)char 3fh
hr(3fhint)char
hr(3)char
Achar
22lhandle int. hr(handle)fh?char 3fh
lhandle fh. hr(handleint)char 3fh
hr(3fhint)char
hr(3)char
Achar
A
23Static Semantics
24Theorems
Soundness proved by standard Subject Reduction
and Progress lemmas.
Erasure property Embeddings and colors dont
affect evaluation.
25Independence of Evaluation
If C is host-free and lhfh.C is of type fh ? int
then
(lhfh.C) nfh ? m iff (lhfh.C) n'fh ? m
26File Handles Come From Open
Suppose (lopenstring ?fh.C) is well-typed and C
is host-free. If (lopenstring ?fh.C)
lsstring.ho(s)string ?fh steps to C'
containing nfh as a subterm, then n was
derived from a sequence of the form ho(s)
? n
27The General Setting
- Multiple principals
- Many abstract types
- Products, Sums, Recursive Types, and
- References
- Proofs follow standard techniques
28Related Work
- Language Based Security
- (Smith Volpano '97, Heintze Riecke '98,
Myers '99) - Principals
- (Nielson Nielson '92, Leroy Rouaix '98)
- Other Parametricity Results
- (Abadi, Cardelli Curien '93, Crary '99,
Pierce Sangiorgi '99)
29Summary
Operational approach to proving type abstraction
properties
Principals are a useful conceptual framework.
30Host Operational Semantics
lxt.C s? s? ? lxsint/fh.Cxt/xs?
nfhint ? n