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

Should jwsDecode return null if payload is not valid JSON? #23

Open
dschenkelman opened this issue Jun 2, 2015 · 3 comments
Open

Should jwsDecode return null if payload is not valid JSON? #23

dschenkelman opened this issue Jun 2, 2015 · 3 comments

Comments

@dschenkelman
Copy link
Member

First of all: awesome library, we use it a lot at Auth0!

Does the issue question make sense? It would require a try/catch around this line:
https://github.com/brianloveswords/node-jws/blob/master/lib/verify-stream.js#L71

I think it should as that is how other invalid cases are dealt with. I'm will send the PR if you tell me that is OK.

Thanks!

@dschenkelman
Copy link
Member Author

It was just a bit of code, I went ahead and created the PR: #24

@omsmith
Copy link
Contributor

omsmith commented Jul 19, 2015

Seems it might be for this particular case, given we're trying to parse json within the library.

Seems to me like we shouldn't be attempting to parse json at all though really, better off sending along the utf8 (or otherwise encoded) string and let the consumer/jwt library deal with that.

Would be a breaking change. Thoughts?

@santiagoaguiar
Copy link

The header is already checked using safeJsonParse at:
https://github.com/brianloveswords/node-jws/blob/master/lib/verify-stream.js#L23

Given the current behavior where other malformed cases (invalid header, invalid jws) are already returned as null, it seems using safeJsonParse should be the right way to do it.

Given this was raised more than a year ago, my hopes aren't high :).

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

3 participants