Open
Description
Description
Changes to how decode
is defined in 9.0.0 (15a1bc4) prevent it from being altered for unit tests by tools such as sinon
, or even direct alteration such as
jwt.decode = function() { return( 'teststring' ); };
As a result errors such as TypeError: Cannot redefine property: decode
are thrown in these scenarios.
Other JWT libraries such as jose
have added configurable: true
to allow this scenario to succeed, which should probably be done here too:
- discussion: https://stackoverflow.com/a/64598197
- fix: panva/jose@6c3b92f
Reproduction
Test code such as
jwt.decode = function() { return( 'teststring' ); };
results in
TypeError: Cannot redefine property
Environment
- Version of this library used:
9.0.0
- Version of the platform or framework used, if applicable:
n/a
- Other relevant versions (language, server software, OS, browser):
n/a
- Other modules/plugins/libraries that might be involved:
n/a
Metadata
Metadata
Assignees
Labels
No labels