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

ruby-jwt::raw_to_asn1: Fails for signatures less than byte_size #155

Closed
joykoduru opened this issue Jun 29, 2016 · 1 comment
Closed

ruby-jwt::raw_to_asn1: Fails for signatures less than byte_size #155

joykoduru opened this issue Jun 29, 2016 · 1 comment

Comments

@joykoduru
Copy link

We use ruby-jwt in one of our applications and recently we had noticed that if the Signature passed to this method is shorter than byte_size, I returns an invalid signature which fails the verification and causing a 500 Internal Server Error.

See the below sample code to understand better:

2.2.3 :004 > str = 'abcdef'
 => "abcdef"
2.2.3 :005 > str[0..10]
 => "abcdef"
2.2.3 :006 > str[10..-1]
 => nil

To fix this we could add a check for passed in signature’s length on #L165 and return “” (empty string) if signature is shorter.

If you feel this could be the right way to fix this issue, let us know how we can contribute to ruby-jwt.

P.S: We are using the ES256 algorithm. It looks like our keys are 256 bits long.

Please let us know your thoughts.

@excpt excpt added this to the Version 1.6.0 milestone Jul 30, 2016
@excpt
Copy link
Member

excpt commented Oct 20, 2016

Please submit your PR. I will be happy to merge it.

excpt added a commit that referenced this issue Nov 30, 2016
Return empty string if signature less than byte_size #155
@excpt excpt closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants