Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerifyAndDecrypt panics on malformed input #6

Open
alex opened this issue Dec 20, 2013 · 2 comments
Open

VerifyAndDecrypt panics on malformed input #6

alex opened this issue Dec 20, 2013 · 2 comments

Comments

@alex
Copy link

alex commented Dec 20, 2013

package main

import (
    "fmt"
    "time"
    "github.com/fernet/fernet-go"
)

func main() {
    a := []byte{103, 71, 70, 105, 89, 119, 61, 61}
    keys := fernet.MustDecodeKeys("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")
    fmt.Println(fernet.VerifyAndDecrypt(a, time.Second * 60, keys))
}
@alex
Copy link
Author

alex commented Dec 20, 2013

I suggest adding a test case for an input like this (length less than the timestamp, probably also not enough space for hmac as well) to the spec tests.

@kr
Copy link
Contributor

kr commented Dec 20, 2013

Oh snap. Thanks!

There is a test for this in https://github.com/fernet/spec/blob/f16a35/invalid.json#L10-14,
but it's clearly insufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants