jail
Jailed IO monad.
Like all of us know, the IO monad from the System.IO module
is a wild beast allowing all forms of insecure computations
that can read, or even worse, alter /the real world/. Writing
to sockets, deleting files or even launching missiles, its
possibilities are endless. This library provides a special
IO module that wraps all file and handle based IO operations
from the System.IO module, but provides a possibility to run
them in an restricted environment. When running a jailed IO
computation a file path can be specified all IO operations
will be checked against. Accessing files outside this
directory is not allowed and results in a runtime error.
Additionally, when running a jailed IO computation a
whitelist of file handles can be specified that are
accessible as well.
For example, running some code with the permission to access
all files within (and only within) my home directory and
allowing to access the standard output and standard error can
be enforced like this:
> Jail.run (Just "/home/sebas") [stdout, stderr] yourUntrustworthyComputation
Only allowing the code to access the standard input and
nothing else can be enforced like this:
> Jail.run Nothing [stdin] yourEvenMoreUntrustworthyComputation
Because the jailed IO environment keeps track of all file
handles and checks that are opened by its own operations,
smuggling in evil file handles from the fierce and dangerous
outside world will be punished by border patrol. Only handles
from the whitelist or handles securely opened by functions
like `openFile' will be accepted. Because of the opaque IO
constructor and the restricted set of exported operations
this module is not easily fooled.
I would almost dare to say this module is conceptually safe
and code with the jailed IO type can blindly be trusted.
Except, yes unfortunately except, @unsafePerformIO@ ruins it
all. I would almost suggest adding a flag to the compiler to
enforce the absence of @unsafeRuinMyTypeSafety@-alike
functions in order to be able to create systems in which code
can be trusted by its type alone.
Nonetheless, this module is one step forward in trusting your
own programs. Some real <http://tinyurl.com/paranoidpeople>
prefer writing their software in one of the most insecure
programming languages and perform security audits by hand,
I'd rather have my compiler do the job. (Anyone who wants to
audit this library is more than welcome!)
| version | uploaded | uploader | changes | |
|---|---|---|---|---|
| 0.0.1.1 | 2009-08-27 18:03 UTC | SebastiaanVisser | +2/−2 lines, 1 filesPVP ok | |
| 0.0.1 | 2009-08-27 14:07 UTC | SebastiaanVisser | +604/−0 lines, 4 filesdep +basedep +containersdep +directorysetup-changed |
Dependencies of jail-0.0.1.1
base >=3 && <=5 4.22.0.0 → 4.22.1.0
| 2026-12-01 12:38 UTC | 4.22.1.0 | +388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested |
| 2025-12-19 11:52 UTC | 4.22.0.0 | +886/−215 lines, 28 filesdep ~ghc-internalPVP ok |
| 2026-03-27 12:26 UTC | 4.21.2.0 | +10/−3 lines, 4 filesdep ~ghc-internalPVP ok |
| 2025-12-27 10:31 UTC | 4.21.1.0 | +17/−5 lines, 4 filesdep ~ghc-internalPVP ok |
| 2024-12-16 09:24 UTC | 4.21.0.0 | +1170/−396 lines, 39 filesdep ~ghc-internalPVP ok |
showing 5 of 61 versions
containers >=0.2 && <0.3 0.2.0.1 → 0.8.1 newer than bounds
| 2026-10-04 06:08 UTC | 0.8.1 newer than bounds | +8085/−5169 lines, 39 filesdep +template-haskell-liftdep ~arraydep ~deepseqPVP: major bump suggested |
| 2025-03-01 13:03 UTC | 0.8 newer than bounds | +8447/−7031 lines, 37 filesnew-uploaderPVP ok |
| 2023-09-27 12:15 UTC | 0.7 newer than bounds | +76/−33 lines, 3 filesPVP ok |
| 2023-09-28 04:21 UTC | 0.6.8 newer than bounds | +644/−184 lines, 17 filesdep ~basedep ~deepseqPVP: major bump suggested |
| 2023-02-01 03:11 UTC | 0.6.7 newer than bounds | +783/−229 lines, 20 filesPVP: major bump suggested |
showing 5 of 43 versions
directory >=1.0 && <1.1 1.0.1.2 → 1.3.11.0 newer than bounds
| 2026-05-27 05:59 UTC | 1.3.11.0 newer than bounds | +4560/−4504 lines, 25 filesdep ~file-iodep ~filepathdep ~os-stringPVP ok |
| 2026-01-05 11:08 UTC | 1.3.10.1 newer than bounds | +4989/−4830 lines, 43 filesPVP: major bump suggested |
| 2025-12-24 02:55 UTC | 1.3.10.0 newer than bounds | +90/−39 lines, 7 filesdep ~Win32dep ~basePVP: major bump suggested |
| 2024-10-11 10:43 UTC | 1.3.9.0 newer than bounds | +235/−158 lines, 14 filesdep +file-iodep ~basedep ~timePVP: major bump suggested |
| 2024-05-20 06:52 UTC | 1.3.8.5 newer than bounds | +15/−13 lines, 7 filesdep ~basePVP ok |
showing 5 of 55 versions
monads-fd >=0.0 && <0.1 0.0.0.1 → 0.2.0.0 newer than bounds
| 2010-11-07 15:08 UTC | 0.2.0.0 newer than bounds | +15/−560 lines, 7 filesdep +mtldep ~basePVP ok |
| 2010-11-07 15:10 UTC | 0.1.0.4 newer than bounds | +560/−15 lines, 7 filesdep −mtldep ~basePVP: major bump suggested |
| 2010-11-02 21:20 UTC | 0.1.0.3 newer than bounds | +19/−562 lines, 7 filesdep +mtldep ~basePVP: major bump suggested |
| 2010-09-10 22:10 UTC | 0.1.0.2 newer than bounds | +45/−44 lines, 22 filesdep ~transformersPVP: major bump suggested |
| 2010-05-03 00:26 UTC | 0.1.0.1 newer than bounds | +25/−6 lines, 5 filesPVP: minor bump suggested |
showing 5 of 8 versions
transformers >=0.1 && <0.2 0.1.4.0 → 0.6.3.0 newer than bounds
| 2026-01-12 12:42 UTC | 0.6.3.0 newer than bounds | +28/−1 lines, 4 filesPVP: major bump suggested |
| 2025-04-06 22:39 UTC | 0.6.2.0 newer than bounds | +41/−42 lines, 8 filesdep ~ghc-primPVP: major bump suggested |
| 2024-09-25 11:37 UTC | 0.6.1.2 newer than bounds | +70/−21 lines, 19 filesPVP: minor bump suggested |
| 2023-08-01 19:13 UTC | 0.6.1.1 newer than bounds | +281/−42 lines, 11 filesPVP ok |
| 2023-02-04 08:15 UTC | 0.6.1.0 newer than bounds | +64/−4 lines, 8 filesPVP ok |
showing 5 of 42 versions
Reverse dependencies
1 packages depend on jail