Commit 582aa25
authored
fix(github): guard the NaN expiry in mintInstallationToken (#10074)
`mintInstallationToken` parsed GitHub's `expires_at` with `Date.parse` and no
finiteness check. A present-but-unparseable value returns NaN, and a NaN
`expiresAtMs` makes `expiresAtMs - TOKEN_SAFETY_MARGIN_MS > Date.now()` forever
false — silently disabling the installation-token cache so every job re-mints,
re-triggering the thundering-herd (and the GitHub secondary-rate-limit) the cache
exists to prevent.
Treat an unparseable `expires_at` exactly like an absent one: fall back to
`Date.now() + 50 * 60_000`. A well-formed value still produces exactly
`Date.parse(payload.expires_at)`, and an absent one still uses the same fallback —
both byte-identical to before. No cache-lifetime constant changes.
Closes #100261 parent 6bdb776 commit 582aa25
2 files changed
Lines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
203 | 244 | | |
204 | 245 | | |
205 | 246 | | |
| |||
0 commit comments