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

Example code is memory insecure #60

Open
lggomez opened this issue Aug 3, 2021 · 5 comments
Open

Example code is memory insecure #60

lggomez opened this issue Aug 3, 2021 · 5 comments
Labels
documentation Improvements or additions to documentation jwt-go: legacy

Comments

@lggomez
Copy link
Member

lggomez commented Aug 3, 2021

Migrated from dgrijalva/jwt-go#441:

Comments
@gardc
gardc commented on Nov 21, 2020 •

Referring to this example (https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) pointed to by the readme, feeding it an invalid JWT will create a memory panic.

Go playground example. (https://play.golang.org/p/wyOgm21FYE8)

Checking for err and token.Valid before assuming it's all good in the hood fixes the issue, Go playground example. (https://play.golang.org/p/0sX-54gXfE2)

@lggomez lggomez added documentation Improvements or additions to documentation jwt-go: legacy labels Aug 3, 2021
@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

@johnbalvin
johnbalvin commented on Nov 26, 2020

just check the error https://play.golang.org/p/LG0AFYMhGQm

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

FWIW, here's the repro using this package: https://play.golang.org/p/ym1qpfvFdZS

@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

Related issue: dgrijalva/jwt-go#379

@jackaitken
Copy link

jackaitken commented Apr 28, 2023

Could I raise a PR to fix this example?

@oxisto
Copy link
Collaborator

oxisto commented Apr 29, 2023

Could I raise a PR to fix this example?

Sure go ahead, although I am not sure if we already fixed this over time now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation jwt-go: legacy
Projects
None yet
Development

No branches or pull requests

3 participants