Aircloak / aircloak

This repository contains the Aircloak Air frontend as well as the code for our Cloak query and anonymization platform
2 stars 0 forks source link

Error navigating to audit log #4919

Closed sebastian closed 3 years ago

sebastian commented 3 years ago
** (ArgumentError) cannot convert nil to param
    (phoenix 1.5.6) lib/phoenix/param.ex:67: Phoenix.Param.Atom.to_param/1
    (air 21.2.0-lts) AirWeb.Router.Helpers.admin_group_path/4
    (air 21.2.0-lts) lib/air_web/live/admin/audit_log_live/index.ex:166: anonymous fn/2 in AirWeb.Admin.AuditLogLive.Index.render_audit_log/1
    (phoenix_live_view 0.13.3) lib/phoenix_live_view/diff.ex:250: Phoenix.LiveView.Diff.traverse/5
    (phoenix_live_view 0.13.3) lib/phoenix_live_view/diff.ex:348: anonymous fn/3 in Phoenix.LiveView.Diff.traverse_comprehension/4
    (elixir 1.11.1) lib/enum.ex:1521: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (phoenix_live_view 0.13.3) lib/phoenix_live_view/diff.ex:304: Phoenix.LiveView.Diff.traverse/5
    (phoenix_live_view 0.13.3) lib/phoenix_live_view/diff.ex:348: anonymous fn/3 in Phoenix.LiveView.Diff.traverse_comprehension/4
Last message: {Phoenix.Channel, %{"params" => %{"_csrf_token" => "Ih4RRCIAABQJdRQTCyc_RgMvBTARBlx8jUKwG8tEY1gF2Qpq0WhQhUnO", "_mounts" => 0}, "session" => "SFMyNTY.g2gDaAJhBHQAAAAHZAACaWRtAAAAFHBoeC1Gb3pBaFR1ZWNZOUxMd2FCZAAKcGFyZW50X3BpZGQAA25pbGQACHJvb3RfcGlkZAADbmlsZAAJcm9vdF92aWV3ZAAmRWxpeGlyLkFpcldlYi5BZG1pbi5BdWRpdExvZ0xpdmUuSW5kZXhkAAZyb3V0ZXJkABRFbGl4aXIuQWlyV2ViLlJvdXRlcmQAB3Nlc3Npb250AAAAAGQABHZpZXdkACZFbGl4aXIuQWlyV2ViLkFkbWluLkF1ZGl0TG9nTGl2ZS5JbmRleG4GAIUwtVJ6AWIAAVGA.x6EzLCx3m7csVXrV2PrsLQFnbLmZHxkT_ALVqPLClts", "static" => "SFMyNTY.g2gDaAJhBHQAAAADZAAKYXNzaWduX25ld2wAAAABZAAMY3VycmVudF91c2VyamQABWZsYXNodAAAAABkAAJpZG0AAAAUcGh4LUZvekFoVHVlY1k5TEx3YUJuBgCFMLVSegFiAAFRgA.3hUPF059YQWyXl-5u5K8sDqKfTZCfJHORZSM1CqUZgU", "url" => "https://demo.aircloak.com/admin/audit_log"}, {#PID<0.3765.0>, #Reference<0.4061398116.2773745678.70815>}, %Phoenix.Socket{assigns: %{}, channel: Phoenix.LiveView.Channel, channel_pid: nil, endpoint: AirWeb.Endpoint, handler: Phoenix.LiveView.Socket, id: nil, join_ref: "4", joined: false, private: %{connect_info: %{session: %{"_air_session_token" => "SFMyNTY.g2gDbQAAACQ5MjcwNjFhMy1lM2RhLTRiYzUtYWQxYy1hOTJmNDU5OWQ5YWZuBgBKRQ8KegFiAAFRgA.XekasN_f1kMZoGKcn_lcHwBawSBolWPwMBBaClIB_uQ", "_csrf_token" => "HKZ3e8tQPDsU9vO73xmayS23"}}}, pubsub_server: AirWeb.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "lv:phx-FozAhTuecY9LLwaB", transport: :websocket, transport_pid: #PID<0.3765.0>}}
edongashi commented 3 years ago

Offending line:

<%= if @metadata["group_name"], do: link(@metadata["group_name"], to: admin_group_path(@socket, :edit, @metadata["group_id"])) %>

Any additional context? Could this be related to LDAP? Maybe you have stored corrupt data while testing an incomplete feature?

sebastian commented 3 years ago

Prior to seeing this error I had deleted a lot of groups. I was about to disable users, but wanted to check if they had been active recently first.

So deleting groups might have been the cause triggering the error.

edongashi commented 3 years ago

So deleting groups might have been the cause triggering the error.

Makes sense. We retain old data in the audit and the database lookups could return nil at a later point. We can guard against this by checking if @metadata["group_id"] also exists before rendering the link.