We have a LiveView that presents a form and collects some sensitive information from the currently logged in user and sends it out to an external API for verification. This API recently returned an unexpected response that we weren’t handling and caused the process to crash. Unfortunately, the error logs contain the last message sent, which was a Phoenix.Socket.Message
containing all of the sensitive form data.
I’ve simplified the log a bit, but imagine other forms of PII being included.
GenServer #PID<0.13441.0> terminating
....REDACTED....
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 5.0.2) gen_server.erl:1077: :gen_server.try_handle_info/3
(stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F3uiIJTtxFjUFIHi", event: "event", payload: %{"event" => "submit", "type" => "form", "value" => "form%5Bfirst_name%5D=FIRST&form%5Blast_name%5D=LAST"}
Is there any way to prevent this with LiveView or the underlying logger or would I be better off not using LiveView to collect this information?