Commit bea5df3
committed
fix(sign): fix sign parameters type and usage
The payload and signOptions parameters have incorrect type checking,
therefore possibly breaking the jsonwebtoken source code
passing invalid payload and sign options.
Scenario: if "expiresIn" has been set in the nestjs module and uses payload
as a string, it'll break the code, because jsonwebtoken does not allow the use
of "expiresIn" option with a string payload.
In order to solve the problem, it is necessary predict the developer's behavior using types.
Also throw an error in case of incorrect use of the sign method of the JwtService class.1 parent 5d44e13 commit bea5df3
1 file changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
36 | 61 | | |
37 | 62 | | |
38 | 63 | | |
| |||
48 | 73 | | |
49 | 74 | | |
50 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
51 | 88 | | |
52 | 89 | | |
53 | 90 | | |
| |||
0 commit comments