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

Incorrect usage of urlsafe-base64 leading to errors. #80

Closed
SimonSchick opened this issue Dec 27, 2016 · 0 comments
Closed

Incorrect usage of urlsafe-base64 leading to errors. #80

SimonSchick opened this issue Dec 27, 2016 · 0 comments

Comments

@SimonSchick
Copy link

SimonSchick commented Dec 27, 2016

Incorrect usage of urlsafe-base64 in jwt/decrypt.js:99:
https://github.com/cisco/node-jose/blob/master/lib/jwe/decrypt.js#L99

Assumes that the function has a second parameter for encoding, which is incorrect:
https://github.com/RGBboy/urlsafe-base64/blob/master/lib/urlsafe-base64.js#L50

This causes an error for me locally as it tries to JSON.parse the resulting Buffer.

SyntaxError: Unexpected token � in JSON at position 0
    at parse (<anonymous>)
    at JSON.parse (/Users/xxx/xxx/xxx/xxx/tests/_setup.js:20:20)
    at /Users/xxx/xxx/xxx/xxx/node_modules/node-jose/lib/jwe/decrypt.js:100:26
    at process._tickDomainCallback (internal/process/next_tick.js:129:7) { '0': <Buffer REDACTED ... > }

Proposed fix: Call toString on the buffer.

@SimonSchick SimonSchick changed the title Incorrect usage of rlsafe-base64 leading to errors. Incorrect usage of urlsafe-base64 leading to errors. Dec 27, 2016
linuxwolf added a commit to linuxwolf/node-jose that referenced this issue Dec 29, 2016
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

1 participant