rubencaro/cipher

Attempting to decrypt a nonsensical string causes an error

suprafly opened this issue · 2 comments

Example:
Cipher.decrypt("ddd")

Error
** (MatchError) no match of right hand side value: :error
lib/cipher.ex:36: Cipher.decrypt/1

on line 36 of lib/cipher.ex:
{:ok, decoded} = crypted |> URI.decode_www_form |> Base.decode64

Why does this matter?
Because there may be cases where you are attempting to decrypt something, say an encrypted token coming over an api endpoint, and it may have been injected by a hacker. Should fail gracefully with a sensible reason why.

Just released 1.0.1 including this.

Thanks!

Wow, that was fast. Thanks!

On Fri, Apr 22, 2016 at 11:45 AM, Rubén Caro notifications@github.com
wrote:

Just released 1.0.1 including this.

Thanks!


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2 (comment)