Commit 3192dcc
fix(http): prevent transfer cache key collisions
`makeCacheKey` joined the request fields with `|` before hashing. The url
and the serialized body can contain `|` themselves, so a shifted field
boundary (url `/items/a` + body `b|c` vs url `/items/a|b` + body `c`)
produced the same joined string and the same key, letting two distinct
requests share a transfer cache slot.
Join with `\0` instead, which cannot occur in a valid url or in encoded
params, so the field boundaries cannot be forged by field content.1 parent 00699f3 commit 3192dccCopy full SHA for 3192dcc
2 files changed
+15-3Lines changed: 15 additions & 3 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/common/http
- src
- test
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/common/http/src/transfer_cache.ts
Copy file name to clipboardExpand all lines: packages/common/http/src/transfer_cache.ts+4-1Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
421 | 421 | |
422 | 422 | |
423 | 423 | |
424 | | - |
| 424 | + |
| 425 | + |
| 426 | + |
| 427 | + |
425 | 428 | |
426 | 429 | |
427 | 430 | |
|
Collapse file
packages/common/http/test/transfer_cache_spec.ts
Copy file name to clipboardExpand all lines: packages/common/http/test/transfer_cache_spec.ts+11-2Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
419 | 419 | |
420 | 420 | |
421 | 421 | |
422 | | - |
| 422 | + |
423 | 423 | |
424 | 424 | |
425 | 425 | |
426 | 426 | |
427 | 427 | |
428 | 428 | |
429 | 429 | |
430 | | - |
| 430 | + |
431 | 431 | |
432 | 432 | |
433 | 433 | |
| ||
764 | 764 | |
765 | 765 | |
766 | 766 | |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
| 771 | + |
| 772 | + |
| 773 | + |
| 774 | + |
| 775 | + |
767 | 776 | |
768 | 777 | |
769 | 778 | |
|
0 commit comments