Repository navigation
Commit 7d32f66
committed
fix(antigravity): drop the backtracking trailing-slash regex
The final audit of this campaign found a high-severity CodeQL alert the
campaign itself introduced: js/polynomial-redos at antigravity-models.ts:273,
from 93694a3 via lidge-jun#1897, already promoted to main.
baseUrl.trim().replace(/\/+$/, ) backtracks polynomially on a long run of
trailing slashes. The input is provider config rather than hostile traffic, so
the practical risk is low - but not-hostile-today is a property of the caller
rather than of this function, and a linear scan costs nothing.
stripTrailingSlashes is byte-identical to the regex across the edge cases:
empty string, all slashes, no trailing slash, interior slashes.
Also corrects the closeout: lidge-jun#1899 is a pull request closed unmerged, not an
issue, so this campaign closed two issues rather than three.
The root cause is worth keeping. lidge-jun#1897 merged on local focused tests plus tsc,
which substitutes for CI on behavior and silently skips static analysis. Gating
once at the end is a reasonable trade for speed, but the end-gate I ran does not
include CodeQL, so this class of finding was exactly what the trade gave up.1 parent 8c2b5ed commit 7d32f66
2 files changed
Lines changed: 41 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
271 | 285 | | |
272 | 286 | | |
273 | | - | |
| 287 | + | |
274 | 288 | | |
275 | 289 | | |
276 | 290 | | |
277 | 291 | | |
278 | | - | |
| 292 | + | |
279 | 293 | | |
280 | 294 | | |
281 | 295 | | |
| |||
0 commit comments