Commit da7c4ca7 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Check signature scheme, fixes #390

parent bb881aa0
......@@ -70,7 +70,10 @@ data Profile = Profile { ip :: IP -- ^ The IP on which to li
-- Convert the kernel profile to and from JSON.
instance FromJSON Profile where
parseJSON (Object v) =
parseJSON (Object v) = do
signatureScheme <- v .: "signature_scheme"
case signatureScheme of
"hmac-sha256" ->
Profile <$> v .: "ip"
<*> v .: "transport"
<*> v .: "stdin_port"
......@@ -79,6 +82,7 @@ instance FromJSON Profile where
<*> v .: "shell_port"
<*> v .: "iopub_port"
<*> (Text.encodeUtf8 <$> v .: "key")
sig -> error $ "Unexpected signature scheme: " ++ sig
parseJSON _ = fail "Expecting JSON object."
instance ToJSON Profile where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment