Security-Typed Programming within Dependently-Typed Programming Dan Licata Joint work with Jamie Morgenstern Carnegie Mellon University
Security-Typed Programming Access control: who gets access to what? read a file play a song make an FFI call Information flow: what can they do with it? post the file contents on a blog copy the mp3 save the result in a database Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 2
Security-Typed Programming Access control: who gets access to what? read a file play a song make an FFI call Information flow: what do they do with it? post the file contents on a blog copy the mp3 save the result in a database Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 3
Access Control Access control list (ACL) for /alice/secret.txt Read “/alice/secret.txt” Alice: rwad Bob: rw Admin: rlidwka Alice Desktop (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 4 Security-Typed Programming within DTP
Access Control Access control list (ACL) for /alice/secret.txt Read “/alice/secret.txt” Alice: rwad Bob: rw Admin: rlidwka Alice Desktop Enforcement: Authentication + ACL lookup (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 4 Security-Typed Programming within DTP
Decentralized Access Control Digital library Read “paper.pdf” • All students of members can read papers • CMU is a member Alice CMU • Alice is a student • Charlie is a student • … (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 5
Decentralized Access Control Digital library Read “paper.pdf” • All students of members can read papers • CMU is a member Alice CMU • Alice is a student Need a mechanism to • Charlie is a student specify and enforce • … decentralized policies... (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 5
Authorization Logic CMU Digital library • All students of • Alice is a student members can read • Charlie is a student papers • … • CMU is a member ACM says ∀ s:principal, CMU says student(Alice) ∀ i:principal, ∀ p:paper, (member(i) ⋀ i says student(s)) ⊃ MayRead(s, p) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 6
Proof Carrying Authorization [Appel+Felten] Digital library Read “paper.pdf” • All students of members can read papers • CMU is a member Alice CMU • Alice is a student • Charlie is a student • … (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 7
Proof Carrying Authorization [Appel+Felten] Digital library Read “paper.pdf” • All students of members can read papers • CMU is a member Alice p : mayread(Alice,paper.pdf) CMU • Alice is a student • Charlie is a student • … (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 7
Proof Carrying Authorization Digital library Read “paper.pdf” Evidence OK? Alice p : mayread(Alice,paper.pdf) (Access granted) (Runtime error) (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 8
Proof Carrying Authorization Digital library Read “paper.pdf” Evidence OK? Alice p : mayread(Alice,paper.pdf) (Access granted) (Runtime error) Can we ensure that runtime errors won’t happen? (slide by Kumar Avijit) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 8
An API for PCA read : file → prin → proof → contents e.g. read(paper.pdf,Alice,p) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 9
An API for PCA read : file → prin → proof → contents e.g. read(paper.pdf,Alice,p) p might not be a well-formed proof Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 9
An API for PCA read : file → prin → proof → contents e.g. read(paper.pdf,Alice,p) p might not be a well-formed proof p might not be a proof of the right theorem! Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 9
Dependent Types! read : (f : file) (k : prin) (p : proof(mayread(k,f)) → contents p is well-formed by typing theorem is explicit in p’s type Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 10
Dependent PCA PCML5 [Avijit+Harper] Aura [Jia,Vaughn,Zdancewik,et al.] Fine [Swamy et. al] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 11
Dependent PCA 12,000 lines of Coq PCML5 [Avijit+Harper] Aura [Jia,Vaughn,Zdancewik,et al.] Fine [Swamy et. al] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 11
Dependent PCA 12,000 lines of Coq PCML5 [Avijit+Harper] Aura [Jia,Vaughn,Zdancewik,et al.] Fine [Swamy et. al] 20,000 lines of F# Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 11
Can we do security-typed programming within an existing dependently-typed language ? Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 12
Security-typed Programming in Agda 1.Representing an authorization logic 2.Compile-time and run-time theorem proving 3.Stateful and dynamic policies Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 13
Security-typed Programming in Agda 1.Representing an authorization logic 2.Compile-time and run-time theorem proving 3.Stateful and dynamic policies Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 14
BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15
BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15
BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15
BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15
Outline 1.Representing an authorization logic 2.Compile-time and run-time theorem proving 3.Stateful and dynamic policies Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 16
Theorem Prover can be big and read(paper.pdf,Alice,p) difficult to write out Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 17
Theorem Prover can be big and read(paper.pdf,Alice,p) difficult to write out We implemented a theorem prover: prove : ( Θ : Ctx) (A : Prop) → Maybe ( Θ ⊢ A) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 17
Theorem Prover can be big and read(paper.pdf,Alice,p) difficult to write out We implemented a theorem prover: prove : ( Θ : Ctx) (A : Prop) → Maybe ( Θ ⊢ A) (n : nat) search depth Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 17
Run-time Proving tryRead : ( Γ : Ctx) (p : prin)(f : file) → Maybe(string) tryRead Γ p f = case (prove 15 Γ Mayread(f,p)) of None => None Some proof => Some (read p f proof) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 18
Run-time Proving tryRead : ( Γ : Ctx) (p : prin)(f : file) → Maybe(string) tryRead Γ p f = case (prove 15 Γ Mayread(f,p)) of None => None Some proof => Some (read p f proof) prove is fancy version of “look up in ACL” Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 18
Run-time Proving prove : (n:nat) ( Θ : Ctx) (A : Prop) → Maybe ( Θ ⊢ A) tryRead : ( Γ : Ctx) (p : prin)(f : file) → Maybe(string) tryRead Γ p f = case (prove 15 Γ Mayread(f,p)) of None => None Some proof => Some (read p f proof) prove is fancy version of “look up in ACL” Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 18
Compile-time Proving Γ pol a static (known at compile-time) policy: Γ pol = CMU says student(Alice) :: ACM says ∀ s:principal, ∀ i:principal, ∀ p:paper, (member(i) ⋀ i says student(s)) ⊃ MayRead(s, p) :: ... Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 19
Compile-time Proving proof? : Maybe ( Γ pol ⊢ Mayread(Alice, paper.pdf)) proof? = prove 15 Γ pol (Mayread(Alice, paper.pdf)) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 20
Compile-time Proving proof? : Maybe ( Γ pol ⊢ Mayread(Alice, paper.pdf)) proof? = prove 15 Γ pol (Mayread(Alice, paper.pdf)) Computes (defintional equality) to either None or Some(p) Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 20
Compile-time Proving proof? : Maybe ( Γ pol ⊢ Mayread(Alice, paper.pdf)) proof? = prove 15 Γ pol (Mayread(Alice, paper.pdf)) Computes (defintional equality) to either None or Some(p) theProof : Γ pol ⊢ Mayread(Alice, paper.pdf) theProof = getSome proof? Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 20
Recommend
More recommend