Add version suffix to cookie signing salt (#1369)

This will make sure that users need to reauthenticate every time a new
version is deployed.

Closes https://github.com/firezone/firezone/issues/1358
This commit is contained in:
Andrew Dryga
2023-01-23 13:38:57 -06:00
committed by GitHub
parent 4a2864f9a1
commit 999ea1e43d
2 changed files with 9 additions and 3 deletions

View File

@@ -29,7 +29,12 @@ defmodule FzHttpWeb.Session do
end
defp signing_salt do
FzHttp.Config.fetch_env!(:fz_http, :cookie_signing_salt)
[vsn | _] =
Application.spec(:fz_http, :vsn)
|> to_string()
|> String.split("+")
FzHttp.Config.fetch_env!(:fz_http, :cookie_signing_salt) <> vsn
end
defp encryption_salt do

View File

@@ -65,8 +65,9 @@ defmodule FzHttpWeb.Acceptance.AuthenticationTest do
|> fill_form(%{"email" => "foo@bar.com"})
|> click(Query.button("Send"))
|> assert_el(Query.text("Reset Password"))
|> visit(~p"/dev/mailbox")
|> assert_el(Query.text("Empty mailbox..."))
emails = Swoosh.Adapters.Local.Storage.Memory.all()
refute Enum.find(emails, &(&1.to == "foo@bar.com"))
end
feature "can reset password using email link", %{session: session} do