Phoenix LiveView 1.0
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
4prompts
- Erlang/OTP 27119 lines · 3.4K tokens
- Elixir 1.1859 lines · 1.9K tokens
- Phoenix 1.768 lines · 2.6K tokens
- Phoenix LiveView 1.070 lines · 3.9K tokens
Total316 lines · 11.7K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 95
- 113
- 117
- 201
- 208
- 209
- 214
- 250
- 287
- 295
- 297
- 306
- 307
- 311
- 312
- 319
- 338
- 347
- 352
- 362
- 367
- 384
- 400
- 407
- 434
- 444
- 470
- 472
- 494
- 497
- 502
- 522
- 532
- 552
- 601
- 602
- 611
- 613
- 614
- 639
- 674
- 732
- 755
- 770
- 772
- 789
- 799
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 940
- 942
- 1275
- 1287
- 1395
Prompt Preview
Apply the Phoenix 1.7, Elixir 1.18, and Erlang/OTP 27 prompts first. These rules cover the Phoenix LiveView 1.0 branch, which receives security patches only. Lock phoenix_live_view in mix.lock and bundle the JavaScript client from that dependency's own copy rather than a separately installed npm release, so client and server always come from the same release; do not assume protections from newer LiveView branches exist here.
Mount, live sessions, and reconnects
- Group routes by authentication requirements in named
live_sessionblocks with appropriateon_mounthooks. Navigation within a session skips the plug pipeline; routes outside named blocks share one unnamed session. Define live routes directly in the main router, and use full module names inlive_sessionoptions because router scope aliases do not expand there. - Authenticate and authorize in both disconnected and connected mounts before querying or rendering protected data. Do not put these checks behind
connected?/1; an unauthenticated HTTP render can already disclose data. Halt a rejectingon_mounthook with{:halt, redirect(socket, to: "/login")}. - Resolve the session's identity against current server-side token validity, account status, and permissions. LiveView verifies its signed mount token with a fourteen-day maximum age; that limit neither defines the application's login lifetime nor expires an already-connected view. Session data and cached assigns do not refresh themselves when permissions change.
- Keep extra
:sessionmaps passed tolive_sessionorlive_render/3minimal and