team-alembic / ash_authentication

The Ash Authentication framework
MIT License
87 stars 45 forks source link

/sign-in endpoint produces warning #778

Closed aidalgol closed 1 month ago

aidalgol commented 1 month ago

I have added AshAuthentication to my existing AshPhoenix application following Getting Started Ash Authentication Phoenix, and it seems to work just fine, but visiting the /sign-in endpoint causes the following warning to be emitted on the terminal.

[debug] MOUNT AshAuthentication.Phoenix.SignInLive
  Parameters: %{}
  Session: %{"_csrf_token" => "qBgdtkJLTENpKUGA35dy_h8n", "otp_app" => nil, "overrides" => [AshAuthentication.Phoenix.Overrides.Default], "path" => "/sign-in", "register_path" => "/register", "reset_path" => "/reset", "tenant" => nil, "user" => "user?id=d7200f1d-fd17-45b1-8929-e8475d87607e"}
[debug] QUERY OK source="users" db=0.8ms idle=1475.9ms
SELECT u0."id", u0."email", u0."hashed_password" FROM "users" AS u0 WHERE (u0."id"::uuid = $1::uuid) ["d7200f1d-fd17-45b1-8929-e8475d87607e"]
↳ anonymous fn/3 in AshPostgres.DataLayer.run_query/2, at: lib/data_layer.ex:767
[debug] Replied in 4ms
[debug] HANDLE PARAMS in AshAuthentication.Phoenix.SignInLive
  Parameters: %{}
[debug] Replied in 85µs
warning: Comparing values with `nil` will always return `false`. Use `is_nil/1` instead. In: `{:_ref, [], :email} == nil`
  (ash_authentication 4.0.2) lib/ash_authentication/strategies/password/sign_in_preparation.ex:29: AshAuthentication.Strategy.Password.SignInPreparation.prepare/3
  (ash 3.4.1) lib/ash/query/query.ex:708: anonymous fn/6 in Ash.Query.run_preparations/6
  (elixir 1.17.2) lib/enum.ex:4858: Enumerable.List.reduce/3
  (elixir 1.17.2) lib/enum.ex:2585: Enum.reduce_while/3
  (ash 3.4.1) lib/ash/query/query.ex:552: Ash.Query.for_read/4
  (ash_phoenix 2.1.1) lib/ash_phoenix/form/form.ex:876: AshPhoenix.Form.for_read/3
  (ash_authentication_phoenix 2.0.2) lib/ash_authentication_phoenix/components/password/sign_in_form.ex:62: AshAuthentication.Phoenix.Components.Password.SignInForm.update/2
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/utils.ex:487: Phoenix.LiveView.Utils.maybe_call_update!/3
  (elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/diff.ex:671: anonymous fn/4 in Phoenix.LiveView.Diff.render_pending_components/6
  (telemetry 1.2.1) /path/to/project/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/diff.ex:666: anonymous fn/4 in Phoenix.LiveView.Diff.render_pending_components/6
  (stdlib 4.3.1.4) maps.erl:411: :maps.fold_1/3
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/diff.ex:625: Phoenix.LiveView.Diff.render_pending_components/6
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/diff.ex:143: Phoenix.LiveView.Diff.render/3
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/channel.ex:963: anonymous fn/4 in Phoenix.LiveView.Channel.render_diff/3
  (telemetry 1.2.1) /path/to/project/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
  (phoenix_live_view 0.20.17) lib/phoenix_live_view/channel.ex:958: Phoenix.LiveView.Channel.render_diff/3

It does not appear to be an issue with how I am using it, because the stacktrace is not hitting any of my code.

My project dependencies are as follows. Dependency Current
ash 3.4.1
ash_authentication_phoenix 2.0.2
ash_phoenix 2.1.1
ash_postgres 2.2.3
bandit 1.5.7
credo 1.7.7
dialyxir 1.4.3
dns_cluster 0.1.3
ecto_sql 3.12.0
esbuild 0.8.1
faker 0.18.0
finch 0.18.0
floki 0.36.2
gettext 0.25.0
image 0.54.1
jason 1.4.4
phoenix 1.7.14
phoenix_ecto 4.6.2
phoenix_html 4.1.1
phoenix_live_dashboard 0.8.4
phoenix_live_reload 1.5.3
phoenix_live_view 0.20.17
picosat_elixir 0.2.3
postgrex 0.19.1
swoosh 1.16.10
tailwind 0.2.3
telemetry_metrics 1.0.0
telemetry_poller 1.1.0
toml 0.7.0

And I am running on Erlang/OTP 25 [erts-13.2.2.10]

zachdaniel commented 1 month ago

This should be fixed in either the latest or the next release. It is not a security concern and can safely be ignored :)