Commit 0b31deb
authored
Remove version from live_session (#3715)
Previously, live_session's had a version field that was generated randomly
whenever the router was compiled. We checked the version field on
live_redirects and enforce a full redirect (as when a user navigates,
that is a good point in time to force a full navigation, right?).
It turns out that live navigation on the client is actually implemented
in a way that every reconnect after the first live navigation is also
treated as a navigation. Therefore, after a deployment that changed the
router, LiveViews that were mounted through a live navigation were never
remounted, but always fully reloaded, losing any state and preventing
form recovery from working.
As the security mechanism of live_session is primarily based on the
live_session name, checking the name is generally enough. There could be
a case where previously a live_session called `:admin` was defined where
a user had access to and after deployment, those routes were instead
moved to a `:semiadmin` live session and now super sensitive routes are
accessible in the `:admin` live session. In this case, a user could try
to mount a route from this super sensitive section, but even then, those
routes SHOULD be protected by on_mount hooks that run and properly check
authorization, e.g. based on the user_id in the session.
So to sum this up, the version field of the live session is not needed,
causes problems at the moment and is therefore removed.1 parent f4c6d5c commit 0b31deb
File tree
5 files changed
+16
-38
lines changed- lib/phoenix_live_view
- test/phoenix_live_view
5 files changed
+16
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1287 | 1287 | | |
1288 | 1288 | | |
1289 | 1289 | | |
1290 | | - | |
1291 | | - | |
| 1290 | + | |
1292 | 1291 | | |
1293 | 1292 | | |
1294 | 1293 | | |
| |||
1299 | 1298 | | |
1300 | 1299 | | |
1301 | 1300 | | |
1302 | | - | |
1303 | | - | |
| 1301 | + | |
1304 | 1302 | | |
1305 | 1303 | | |
1306 | 1304 | | |
| |||
1313 | 1311 | | |
1314 | 1312 | | |
1315 | 1313 | | |
1316 | | - | |
1317 | | - | |
| 1314 | + | |
1318 | 1315 | | |
1319 | 1316 | | |
1320 | 1317 | | |
| |||
1329 | 1326 | | |
1330 | 1327 | | |
1331 | 1328 | | |
1332 | | - | |
1333 | | - | |
| 1329 | + | |
1334 | 1330 | | |
1335 | 1331 | | |
1336 | 1332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
244 | 243 | | |
245 | 244 | | |
246 | 245 | | |
| |||
264 | 263 | | |
265 | 264 | | |
266 | 265 | | |
267 | | - | |
| 266 | + | |
268 | 267 | | |
269 | 268 | | |
270 | 269 | | |
| |||
375 | 374 | | |
376 | 375 | | |
377 | 376 | | |
378 | | - | |
| 377 | + | |
379 | 378 | | |
380 | 379 | | |
381 | 380 | | |
| |||
488 | 487 | | |
489 | 488 | | |
490 | 489 | | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | 490 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
66 | | - | |
| 63 | + | |
67 | 64 | | |
68 | 65 | | |
69 | 66 | | |
| |||
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
77 | | - | |
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
| |||
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
105 | | - | |
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
| |||
119 | 117 | | |
120 | 118 | | |
121 | 119 | | |
122 | | - | |
123 | 120 | | |
124 | 121 | | |
125 | 122 | | |
| |||
323 | 320 | | |
324 | 321 | | |
325 | 322 | | |
326 | | - | |
| 323 | + | |
327 | 324 | | |
328 | 325 | | |
329 | 326 | | |
| |||
333 | 330 | | |
334 | 331 | | |
335 | 332 | | |
336 | | - | |
| 333 | + | |
337 | 334 | | |
338 | 335 | | |
339 | 336 | | |
| |||
0 commit comments