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

Cookie encode throw exception in case of empty secret #1114

Closed
kaushik143 opened this issue Mar 4, 2022 · 1 comment · Fixed by #1266
Closed

Cookie encode throw exception in case of empty secret #1114

kaushik143 opened this issue Mar 4, 2022 · 1 comment · Fixed by #1266
Assignees
Labels
bug Something isn't working

Comments

@kaushik143
Copy link

kaushik143 commented Mar 4, 2022

Describe the bug
Cookie encode throw exception in case of empty secret

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'CookieSpec'
  2. Change the cookies gen function to have only an empty secret
def cookies: Gen[Random with Sized, Cookie] = for {
  name     <- Gen.anyString
  content  <- Gen.anyString
  expires  <- Gen.option(Gen.anyInstant)
  domain   <- Gen.option(Gen.anyString)
  path     <- Gen.option(path)
  secure   <- Gen.boolean
  httpOnly <- Gen.boolean
  maxAge   <- Gen.option(Gen.anyLong)
  sameSite <- Gen.option(Gen.fromIterable(List(Cookie.SameSite.Strict, Cookie.SameSite.Lax)))
  secret   <- Gen.option(Gen.fromIterable(List("")))
} yield Cookie(name, content, expires, domain, path, secure, httpOnly, maxAge, sameSite, secret)
  1. Run CookieSpec
  2. See an error

java.lang.IllegalArgumentException: Empty key
at java.base/javax.crypto.spec.SecretKeySpec.(SecretKeySpec.java:110)

Expected behaviour
Encode shouldn't throw an exception

@kaushik143 kaushik143 added the bug Something isn't working label Mar 4, 2022
@dhyanpatel
Copy link

I'd like to take a shot at this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants