Commit 7650adc
committed
fix(jwt): detect the redis client correctly and branch markUsed on it
The store picked its dialect from `client.constructor.name`, matching only
'Redis' or 'Cluster'. A real ioredis instance reports 'EventEmitter' — it
extends EventEmitter and no class name survives to the instance — so the
probe never matched and every ioredis client was treated as node-redis,
sending `SET key value [object Object]`.
`markUsed` had a second, independent defect: it never consulted the detected
dialect and always used the ioredis positional `eval` form. node-redis does
not reject that call, it sends `EVAL <script> 0`, so the script ran against an
empty KEYS and failed inside Redis.
Between the two, the blacklist and the RFC 6749 §10.4 refresh-reuse registry
were unusable on every supported client. Detection now probes the API surface
(`scanStream` / `status`) as paseto's store already did, and `markUsed`
branches like its neighbours.
Also seeds the `deleteAll` SCAN cursor as a string. node-redis typed cursors
as numbers through v5 but requires a string from v6, and the peer range
(`>=4.0.0`) admits v6.
The integration suite's todo markers are lifted and it now covers deleteAll,
which had no live-Redis coverage at all.1 parent 11ee674 commit 7650adc
3 files changed
Lines changed: 63 additions & 29 deletions
File tree
- .changeset
- packages/jwt
- src/internal
- tests/stores
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| |||
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
188 | | - | |
| 193 | + | |
189 | 194 | | |
190 | 195 | | |
191 | 196 | | |
| |||
200 | 205 | | |
201 | 206 | | |
202 | 207 | | |
203 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
204 | 216 | | |
205 | 217 | | |
206 | 218 | | |
| |||
237 | 249 | | |
238 | 250 | | |
239 | 251 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
245 | 264 | | |
246 | 265 | | |
247 | 266 | | |
248 | 267 | | |
249 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
250 | 272 | | |
251 | 273 | | |
252 | | - | |
253 | 274 | | |
254 | 275 | | |
255 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 22 | | |
39 | | - | |
| 23 | + | |
40 | 24 | | |
41 | 25 | | |
42 | 26 | | |
| |||
47 | 31 | | |
48 | 32 | | |
49 | 33 | | |
50 | | - | |
| 34 | + | |
51 | 35 | | |
52 | 36 | | |
53 | 37 | | |
| |||
58 | 42 | | |
59 | 43 | | |
60 | 44 | | |
61 | | - | |
| 45 | + | |
62 | 46 | | |
63 | 47 | | |
64 | 48 | | |
65 | 49 | | |
66 | | - | |
| 50 | + | |
67 | 51 | | |
68 | 52 | | |
69 | 53 | | |
70 | 54 | | |
71 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
72 | 67 | | |
0 commit comments