skip to main content
research-article

Safe haskell

Published:13 September 2012Publication History
Skip Abstract Section

Abstract

Though Haskell is predominantly type-safe, implementations contain a few loopholes through which code can bypass typing and module encapsulation. This paper presents Safe Haskell, a language extension that closes these loopholes. Safe Haskell makes it possible to confine and safely execute untrusted, possibly malicious code. By strictly enforcing types, Safe Haskell allows a variety of different policies from API sandboxing to information-flow control to be implemented easily as monads. Safe Haskell is aimed to be as unobtrusive as possible. It enforces properties that programmers tend to meet already by convention. We describe the design of Safe Haskell and an implementation (currently shipping with GHC) that infers safety for code that lies in a safe subset of the language. We use Safe Haskell to implement an online Haskell interpreter that can securely execute arbitrary untrusted code with no overhead. The use of Safe Haskell greatly simplifies this task and allows the use of a large body of existing code and tools.

References

  1. L. Cardelli, J. Donahue, L. Glassman, M. Jordan, B. Kalsow, and G. Nelson. Modula-3 report (revised). In Technical Report. Systems Research Center, Digitical Equipment Corporation, 1989.Google ScholarGoogle Scholar
  2. D. Crockford. Adsafe: Making JavaScript safe for advertising. http://adsafe.org/, 2008.Google ScholarGoogle Scholar
  3. C. Done. TryHaskell: An interactive tutorial in your browser. http://tryhaskell.org/, 2012.Google ScholarGoogle Scholar
  4. ECMA. ECMA-262: ECMAScript Language Specification. Fifth Edition, 2009.Google ScholarGoogle Scholar
  5. ECMA. Ses: Secure EcmaScript Language Specification. http://wiki.ecmascript.org/doku.php?id=ses:ses, 2009.Google ScholarGoogle Scholar
  6. Facebook. Fbjs (Facebook JavaScript). http://developers.facebook.com/docs/fbjs/, 2012.Google ScholarGoogle Scholar
  7. M. Finifter, A. Mettler, N. Sastry, and D.Wagner. Verifiable functional purity in Java. In Computer and Communications Security. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. GHC Bug Tracker. Newtypes and type families combine to produce inconsistent fc(x) axiom sets. http://hackage.haskell.org/trac/ghc/ticket/1496, 2007.Google ScholarGoogle Scholar
  9. W. Harrison. Achieving information flow security through precise control of effects. In Computer Security Foundations Workshop. IEEE Computer Society, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. I. Jones. The Haskell cabal, a common architecture for building applications and libraries. In Trends in Functional Programming Symposium, 2005.Google ScholarGoogle Scholar
  11. R. Lämmel and S. Peyton Jones. Scrap your boilerplate: a practical design pattern for generic programming. In Types in Languages Design and Implementation Workshop. ACM SIGPLAN, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Li and S. Zdancewic. Encoding information flow in Haskell. In Computer Security Foundations Workshop. IEEE Computer Society, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Marlow (editor). Haskell 2010 language report. 2010.Google ScholarGoogle Scholar
  14. A. Mettler, D. Wagner, and T. Close. Joe-e: A security-oriented subset of Java. In Network and Distributed System Security Symposium. Internet Society, 2010.Google ScholarGoogle Scholar
  15. M. Miller. Robust composition: Towards a unified approach to access control and concurrency control. In Ph.D. Dissertation. Johns Hopkins University, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Miller, K.-P. Yee, and J. Shapiro. Capability myths demolished. In Technical Report. Johns Hopkins University, 2003.Google ScholarGoogle Scholar
  17. M. S. Miller, M. Samuel, B. Laurie, I. Awad, and M. Stay. Caja: Safe active content in sanitized JavaScript. http://code.google.com/p/google-caja/, 2008.Google ScholarGoogle Scholar
  18. A. Russo, K. Claessen, and J. Hughes. A library for light-weight information flow security in Haskell. In Haskell Symposium. ACM SIGPLAN, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Stefan, A. Russo, J. C. Mitchell, and D. Mazières. Flexible dynamic information flow control in Haskell. In Haskell Symposium. ACM SIGPLAN, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Steigler and M. Miller. How Emily tamed the Caml. In Technical Report HPL-2006-116. HP Laboratories, 2006.Google ScholarGoogle Scholar
  21. D. Stewart. Lambdabot. http://hackage.haskell.org/package/lambdabot, 2012.Google ScholarGoogle Scholar
  22. M. Stiegler. Emily: A high performance language for enabling secure cooperation. In Creating, Connecting and Collaborating through Computing Conference. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. A. Taly, Ú. Erlingsson, J. C. Mitchell, M. S. Miller, and J. Nagra. Automated analysis of security-critical javascript APIs. In Security and Privacy Symposium. IEEE Computer Society, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. Terei and GHC Team. Hackager: A Hackage testing tool. http://hackage.haskell.org/trac/ghc/wiki/HackageTesting, 2012.Google ScholarGoogle Scholar
  25. T.-c. Tsai, A. Russo, and J. Hughes. A library for secure multi-threaded information flow in Haskell. In Computer Security Foundations Symposium. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. S. Tse and S. Zdancewic. Translating dependency into parametricity. In International Conference on Functional Programming. ACM SIGPLAN, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. D. Wallach. A new approach to mobile code security. In Ph.D. Dissertation. Princeton University, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. S. Weirich, D. Vytiniotis, S. Peyton Jones, and S. Zdancewic. Generative type abstraction and type-level computation. In Principles of Programming Languages Symposium. ACM SIGNPLAN, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Safe haskell

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 12
        Haskell '12
        December 2012
        157 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2430532
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell '12: Proceedings of the 2012 Haskell Symposium
          September 2012
          168 pages
          ISBN:9781450315746
          DOI:10.1145/2364506

        Copyright © 2012 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 13 September 2012

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!