security typed programming within dependently typed
play

Security-Typed Programming within Dependently-Typed Programming - PowerPoint PPT Presentation

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


  1. Security-Typed Programming within Dependently-Typed Programming Dan Licata Joint work with Jamie Morgenstern Carnegie Mellon University

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. Can we do security-typed programming within an existing dependently-typed language ? Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 12

  21. 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

  22. 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

  23. BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15

  24. BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15

  25. BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15

  26. BL0 [Garg+Pfenning] Security-Typed Programming within DTP Dan Licata and Jamie Morgenstern 15

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

  32. 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

  33. 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

  34. 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

  35. 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

  36. 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

  37. 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