gradual information flow typing
play

Gradual Information Flow Typing Tim Disney Cormac Flanagan - PowerPoint PPT Presentation

Gradual Information Flow Typing Tim Disney Cormac Flanagan University of California Santa Cruz January 29th, 2011 - STOP 2011 Combining gradual typing with information flow Gradual Information + Typing Flow = More secure software


  1. Gradual Information Flow Typing Tim Disney Cormac Flanagan University of California Santa Cruz January 29th, 2011 - STOP 2011

  2. Combining gradual typing with information flow Gradual Information + Typing Flow = More secure software

  3. Perfect world Security designed upfront

  4. Perfect world Security designed upfront vs. Broken world Security bolted on after the fact

  5. Requirements Design Implementation Verification Maintenance

  6. Finding security requirements upfront is often not economically feasible

  7. Perfect world Broken world

  8. Do not want Perfect world Broken world

  9. Does not exist Do not want Perfect world Broken world

  10. Real world Security evolves with program Does not exist Do not want Perfect world Broken world

  11. Information Flow Confidentiality: keeping sensitive data private & Integrity: protect against untrusted data

  12. Information Flow Confidentiality: keeping sensitive data private & Integrity: protect against untrusted data For this talk we focus on confidentiality

  13. Information Flow Labels H (private) L (public)

  14. Information Flow Labeled Values Labels H (private) 42 L 58,000 H “hello” L L (public)

  15. Gradual Typing Dynamically Statically typed program typed program Siek and Taha (2006), Findler and Felleisen (2002), Wadler and Findler (2009), Ahmed et al. (2011), etc.

  16. Gradual Typing Dynamically Mixed Statically typed program static/dynamic typed program Program fail with blame Casts Dynamically Statically typed modules typed modules Siek and Taha (2006), Findler and Felleisen (2002), Wadler and Findler (2009), Ahmed et al. (2011), etc.

  17. Gradual Typing Dynamically Statically Mixed typed program typed program static/dynamic Program fail with blame Casts Dynamically Statically typed modules typed modules Siek and Taha (2006), Findler and Felleisen (2002), Wadler and Findler (2009), Ahmed et al. (2011), etc.

  18. No security Gradual Security checks Static Dynamic security types security checks

  19. No security Gradual Security checks Mixed static/ Static Dynamic dynamic security security types security checks Program fail with blame Casts Dynamic Static security modules security modules

  20. No security Gradual Security rev 0 checks Mixed static/ Static Dynamic dynamic security security types security checks Program fail with blame Casts Dynamic Static security modules security modules

  21. No security Gradual Security rev 0 checks Mixed static/ Static Dynamic dynamic security security types security checks rev 1 Program fail with blame Casts Dynamic Static security modules security modules

  22. No security Gradual Security rev 0 checks Mixed static/ Static Dynamic dynamic security security types security checks rev 1 rev 2 Program fail with blame Casts Dynamic Static security modules security modules

  23. No security Gradual Security rev 0 checks Mixed static/ Static Dynamic dynamic security security types security checks rev 1 rev 2 rev 3 Program fail with blame Casts Dynamic Static security modules security modules

  24. A language for g radual i nformation f low

  25. The language Values (r): Labeled Values (v): 42 H , ( λ x : A. t ) L Types (a, b): Int , Bool , A → B Labeled Types (A, B): Int L , Bool L , ( A → B ) H

  26. The language Private types: Int H = { 0 L , 0 H , 1 L , 1 H , . . . } potentially private

  27. The language Private types: Int H = { 0 L , 0 H , 1 L , 1 H , . . . } potentially private Public types: Int L = { 0 L , 1 L , 2 L , . . . } definitely public

  28. The language Private types: Int H = { 0 L , 0 H , 1 L , 1 H , . . . } potentially private Public types: Int L = { 0 L , 1 L , 2 L , . . . } definitely public Subtypes

  29. The language Default labels are permissive

  30. The language Default labels are permissive 42 = 42 L

  31. The language Default labels are permissive 42 = 42 L Int = Int H

  32. The language Default labels are permissive 42 = 42 L Int = Int H

  33. The language Default labels are permissive 42 = 42 L Int = Int H

  34. Casting checks runtime labels t : A ⇒ p B Syntax similar to “Blame For All” by Ahmed et al.

  35. Casting checks runtime labels t : A ⇒ p B 42 L : Int H ⇒ p Int L 42 L Syntax similar to “Blame For All” by Ahmed et al.

  36. Casting checks runtime labels t : A ⇒ p B 42 L : Int H ⇒ p Int L 42 L 42 H : Int H ⇒ p Int L blame p Syntax similar to “Blame For All” by Ahmed et al.

  37. Higher-order casting: cast at fault ( fn ): ( Int L → Int H ) ⇒ p ( Int L → Int L ) wrap fn

  38. Higher-order casting: cast at fault ( fn ): ( Int L → Int H ) ⇒ p ( Int L → Int L ) wrap fn fn = λ x : Int L . x + 1 L ( wrap fn ) 42 L 43 L

  39. Higher-order casting: cast at fault ( fn ): ( Int L → Int H ) ⇒ p ( Int L → Int L ) wrap fn fn = λ x : Int L . x + 1 L ( wrap fn ) 42 L 43 L fn = λ x : Int L . x + 1 H cast blamed ( wrap fn ) 42 L blame p

  40. Higher-order casting: context at fault ( fn ): ( Int L → Int L ) ⇒ p ( Int H → Int L ) wrap fn

  41. Higher-order casting: context at fault ( fn ): ( Int L → Int L ) ⇒ p ( Int H → Int L ) wrap fn 24 L ( wrap fn ) 42 L

  42. Higher-order casting: context at fault ( fn ): ( Int L → Int L ) ⇒ p ( Int H → Int L ) wrap fn 24 L ( wrap fn ) 42 L ( wrap fn ) 42 H blame p context blamed

  43. Labeling adds runtime labels V (58000 L : Int L V Int H ) 58000 H

  44. Labeling adds runtime labels V (58000 L : Int L V Int H ) 58000 H disk read : ( Int L → Int L ) V ( Int L → Int H ) wrap fn

  45. Evolution Example

  46. Rev 0 (no security) let intToString : Int → Str = . . .

  47. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42

  48. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000 // confidential!

  49. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42 // confidential! let salary : Int = 58000 let print : Str → Unit = λ s : Str . . . .

  50. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42 // confidential! let salary : Int = 58000 let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary ))

  51. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42 // confidential! let salary : Int = 58000 let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary )) Prints “58000”

  52. Rev 0 (no security) let intToString : Int → Str = . . . let age : Int = 42 // confidential! let salary : Int = 58000 let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary )) Prints “58000”

  53. Add dynamic enforcement

  54. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary ))

  55. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary ))

  56. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary )) Still prints “58000” H

  57. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . print ( intToString ( salary )) Still prints “58000” H

  58. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . let s = ( s : Str H ⇒ p Str L ) in . . . print ( intToString ( salary ))

  59. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . let s = ( s : Str H ⇒ p Str L ) in . . . print ( intToString ( salary ))

  60. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . let s = ( s : Str H ⇒ p Str L ) in . . . print ( intToString ( salary )) Fails and blames p since Str H can’t be cast to Str L

  61. Rev 1 (dynamic enforcement) let intToString : Int → Str = . . . let age : Int = 42 let salary : Int = 58000: Int L V Int H let print : Str → Unit = λ s : Str . . . . let s = ( s : Str H ⇒ p Str L ) in . . . print ( intToString ( salary )) Fails and blames p since Str H can’t be cast to Str L

  62. Add static enforcement

  63. Rev 2 (static enforcement) let intToString : Int H → Str H = . . . let age : Int L = 42 let salary : Int H = 58000: Int L V Int H let print : Str L → Unit L = λ s : Str L . . . . print ( intToString ( salary ))

  64. Rev 2 (static enforcement) let intToString : Int H → Str H = . . . let age : Int L = 42 let salary : Int H = 58000: Int L V Int H let print : Str L → Unit L = λ s : Str L . . . . print ( intToString ( salary )) intToString causes compile error

Recommend


More recommend