Repository navigation
Commit 566cea6
authored
fix(desktop): frame each tmux format record so a newline in a field cannot forge a pane (#8725)
* fix(desktop): frame each tmux format record so a newline in a field cannot forge a pane
tmux prints a newline inside a `-F` field as is. A pane whose working
directory (or window name, or session name) held a newline followed by
separator-joined text ended its own record early and forged another: any
target, command and path, while the real pane disappeared from `panes`.
Every `-F` read (list-clients, list-panes, the active pane) now frames each
record with a marker made fresh for that call, and only lines framed whole by
it are read. Nobody outside the call knows the marker, so no field can forge a
record, and the halves of a record a newline split are each dropped.
* fix(desktop): make the tmux format frame with the shared random helper
* fix(desktop): neutralise newlines at the source in tmux fields others can set
The per-call frame is not a secret: on macOS `ps` shows any process's
arguments, and on Linux `/proc/<pid>/cmdline` is world-readable, so someone
who owns the directory a pane sits in can read the frame and rename the
directory before tmux reads it.
tmux now replaces each newline with `<NL>` itself (`#{s/\n/<NL>/:…}`) in the
fields someone other than the user can set: the pane's directory, its
command, and the window title a program sets. A record is then one line, and
the frame stays as a second line of defence. tmux output is also decoded as a
stream, so a character split across two chunks arrives whole.1 parent 334b9f3 commit 566cea6
2 files changed
Lines changed: 192 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
29 | 57 | | |
30 | 58 | | |
31 | 59 | | |
32 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
33 | 63 | | |
34 | 64 | | |
35 | 65 | | |
36 | 66 | | |
37 | 67 | | |
38 | | - | |
39 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
40 | 72 | | |
41 | 73 | | |
42 | 74 | | |
43 | 75 | | |
44 | 76 | | |
45 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
46 | 109 | | |
47 | 110 | | |
48 | 111 | | |
| |||
140 | 203 | | |
141 | 204 | | |
142 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
143 | 210 | | |
144 | 211 | | |
145 | 212 | | |
| |||
232 | 299 | | |
233 | 300 | | |
234 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
235 | 327 | | |
236 | 328 | | |
237 | 329 | | |
| |||
293 | 385 | | |
294 | 386 | | |
295 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
296 | 431 | | |
297 | 432 | | |
298 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
50 | 73 | | |
51 | 74 | | |
52 | 75 | | |
| |||
112 | 135 | | |
113 | 136 | | |
114 | 137 | | |
115 | | - | |
116 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
117 | 143 | | |
118 | | - | |
119 | | - | |
| 144 | + | |
| 145 | + | |
120 | 146 | | |
121 | 147 | | |
122 | 148 | | |
| |||
129 | 155 | | |
130 | 156 | | |
131 | 157 | | |
132 | | - | |
| 158 | + | |
| 159 | + | |
133 | 160 | | |
134 | 161 | | |
135 | 162 | | |
136 | 163 | | |
137 | 164 | | |
138 | | - | |
| 165 | + | |
139 | 166 | | |
140 | 167 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
144 | 172 | | |
145 | 173 | | |
146 | 174 | | |
| |||
206 | 234 | | |
207 | 235 | | |
208 | 236 | | |
209 | | - | |
| 237 | + | |
210 | 238 | | |
211 | 239 | | |
212 | 240 | | |
213 | | - | |
| 241 | + | |
214 | 242 | | |
215 | 243 | | |
216 | 244 | | |
| |||
226 | 254 | | |
227 | 255 | | |
228 | 256 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
235 | 262 | | |
236 | 263 | | |
237 | 264 | | |
238 | 265 | | |
239 | 266 | | |
240 | 267 | | |
241 | | - | |
| 268 | + | |
242 | 269 | | |
243 | | - | |
244 | | - | |
245 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
246 | 273 | | |
247 | | - | |
| 274 | + | |
248 | 275 | | |
249 | 276 | | |
250 | | - | |
| 277 | + | |
251 | 278 | | |
252 | 279 | | |
253 | 280 | | |
| |||
0 commit comments