Commit 64f322a
committed
backend: k8cache: percent-encode '+' in cache key fields to avoid delimiter collision
GenerateKey joins apiGroup, kind, namespace, and contextID with '+' as a
delimiter, and DeleteKeys later splits on '+' to strip the namespace via
positional indexing. Kubeconfig context names are not restricted by
Kubernetes naming rules and may legitimately contain '+', which produces
a key with more than 4 segments and breaks the positional namespace
stripping in DeleteKeys. This can cause cache invalidation to silently
target the wrong key, leaving stale cached API responses served after
a write.
Escape literal '+' to '%2B' in each field before joining so the only
'+' characters remaining in the key are the delimiters themselves.
Fixes #6123
Signed-off-by: Siddhi Khandelwal <siddhi.200727@gmail.com>1 parent 2796a66 commit 64f322a
2 files changed
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
168 | 179 | | |
169 | 180 | | |
170 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
413 | 420 | | |
414 | 421 | | |
415 | 422 | | |
| |||
0 commit comments