4 ms·
The developer notes: As such, unprivileged users are permitted to write and execute functions without the possibility that they will be able to access informat
by solidsnack9000 2y ago
The developer notes:
As such, unprivileged users are permitted to write and execute functions without the possibility that they will be able to access information or resources that are not allowed to access. This is accomplished by enforcing Haskell's strong type system.
Further on, it says:
Trusted functions must return type PGm (Maybe result) where result is the appropriate Haskell type as determined by the return type of function while untrusted functions must return type IO (Maybe result). The PGm monad type can be imported from the PGutils module.
This makes some sense intuitively, but it would be good to see the details worked out. There is always `unsafePerformIO`, after all...
- hun3 2y ago> This makes some sense intuitively, but it would be good to see the details worked out. The answer seems to be Safe Haskell: https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/safe_haskell.html https://downloads.haskell.org/ghc/latest/docs/users_guide/ex... (Source: Safe extension mentioned in https://github.com/ed-o-saurus/PLHaskell/blob/d917f0991a455cf0558c2036e360ba1a9b40a8ef/src/PLHaskell.hsc#L274 https://github.com/ed-o-saurus/PLHaskell/blob/d917f0991a455c...) The PGm monad seems to be an instance of §6.18.1.2. Building secure systems (restricted IO Monads): https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/safe_haskell.html#building-secure-systems-restricted-io-monads https://downloads.haskell.org/ghc/latest/docs/users_guide/ex... > There is always `unsafePerformIO`, after all... Forbidden in untrusted code by Safe Haskell.
- armchairhacker 2y agoHaskell has a “safe” language dialect which prevents `unsafePerformIO` and others: https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_guide/safe-haskell.html https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_gui... / https://simonmar.github.io/bib/papers/safe-haskell.pdf https://simonmar.github.io/bib/papers/safe-haskell.pdf However, I doubt Safe Haskell (without extensions) is formally verified, and it still uses GHC’s runtime, which could have RCEs. Also note that it doesn’t prevent infinite loops or memory exhaustion, the latter even during compilation.
- Vosporos 2y agooh yeah actually Safe Haskell will be on its way out, it does not deliver on much and ecosystem adoption is a pain.