Fix Bandit configuration and user settings HTML test

Bandit 1.10.1 does not support read_timeout/write_timeout in http_1_options
or stream_idle_timeout in http_2_options. These invalid options caused the
application to crash on startup with 'Unsupported key(s) in http_1_options'.

Moved read_timeout to thousand_island_options where it belongs, and removed
the unsupported write_timeout and stream_idle_timeout options.

Also fixed UserSettingsHTMLTest to include the missing mobile_sessions assign
that is required by the edit.html.heex template.
This commit is contained in:
Graham McIntire 2026-01-15 16:06:01 -06:00
parent c7f02eac24
commit 0ea2addc91
No known key found for this signature in database
2 changed files with 8 additions and 13 deletions

View file

@ -135,17 +135,10 @@ if config_env() == :prod do
# See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
# Bandit HTTP/1 configuration
http_1_options: [
# Timeout for reading request headers and body (30 seconds)
read_timeout: 30_000,
# Timeout for sending response (30 seconds)
write_timeout: 30_000
],
# Bandit HTTP/2 configuration
http_2_options: [
# Timeout for stream idle (60 seconds)
stream_idle_timeout: 60_000
# Bandit uses ThousandIsland for connection management
# Timeout for reading client data before closing the connection (30 seconds)
thousand_island_options: [
read_timeout: 30_000
]
],
secret_key_base: secret_key_base

View file

@ -17,7 +17,8 @@ defmodule ToweropsWeb.UserSettingsHTMLTest do
email_changeset: email_changeset,
password_changeset: password_changeset,
credentials: [],
can_register_passkey: true
can_register_passkey: true,
mobile_sessions: []
)
assert html =~ "Account Settings"
@ -38,7 +39,8 @@ defmodule ToweropsWeb.UserSettingsHTMLTest do
email_changeset: email_changeset,
password_changeset: password_changeset,
credentials: [],
can_register_passkey: false
can_register_passkey: false,
mobile_sessions: []
)
assert html =~ "Please confirm your email address before registering a passkey"