From b78b6b3472511c7e39d5c91b0449a59e0f361dcf Mon Sep 17 00:00:00 2001 From: David Terei Date: Fri, 9 Nov 2012 16:33:36 -0800 Subject: add note about compilation safety to safe haskell docs --- docs/users_guide/safe_haskell.xml | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'docs') diff --git a/docs/users_guide/safe_haskell.xml b/docs/users_guide/safe_haskell.xml index dc07b89bb8..8b777bbed2 100644 --- a/docs/users_guide/safe_haskell.xml +++ b/docs/users_guide/safe_haskell.xml @@ -44,6 +44,16 @@ + + Safe Haskell, however, does not offer compilation + safety. During compilation time it is possible for arbitrary processes to be + launched, using for example the custom + pre-processor flag. This can be manipulated to either compromise a + users system at compilation time, or to modify the source code just before + compilation to try to alter set Safe Haskell flags. This is discussed further + in section . + + Uses of Safe Haskell safe haskell uses @@ -722,6 +732,48 @@ + + Safe Compilation + safe compilation + + + GHC includes a variety of flags that allow arbitrary processes to be run at + compilation time. One such example is the custom pre-processor flag. Another is the + ability of Template Haskell to execute Haskell code at compilation time, + including IO actions. Safe Haskell does not address this + danger (although, Template Haskell is a disallowed feature). + + + + Due to this, it is suggested that when compiling untrusted source code that + has had no manual inspection done, the following precautions be taken: + + Compile in a sandbox, such as a chroot or similar container + technology. Or simply as a user with very reduced system + access. + Compile untrusted code with the flag + being specified on the command line. This will ensure that modifications + to the source being compiled can't disable the use of the Safe Language + as the command line flag takes precedence over a source level + pragma. + Ensure that all untrusted code is imported as a + safe import and + that the + flag is used with packages from untrusted sources being marked as + untrusted. + + + + + There is a more detailed discussion of the issues involved in compilation + safety and some potential solutions on the GHC + Wiki. + + + +