Skip to content

Logging of credentials when opening a new connection #173

@arfl

Description

@arfl

Hello.

For a couple of days, we get much more output when opening new RabbitMQ connections using AMQP.Connection.open/1 (recently, we updated elixir to version 1.11.1).

iex(4)> AMQP.Connection.open("amqp://localhost")
[info]     :supervisor: {#PID<0.1217.0>, :amqp_connection_sup}
    :started: [
  pid: #PID<0.1218.0>,
  name: :connection_type_sup,
  mfargs: {:amqp_connection_type_sup, :start_link, []},
  restart_type: :transient,
  shutdown: :infinity,
  child_type: :supervisor
]
[info]     :supervisor: {#PID<0.1217.0>, :amqp_connection_sup}
    :started: [
  pid: #PID<0.1219.0>,
  name: :connection,
  mfargs: {:amqp_gen_connection, :start_link,
   [
     #PID<0.1218.0>,
     {:amqp_params_network, "guest", {:plaintext, "guest"}, "/", 'localhost',
      5672, 2047, 0, 10, 60000, :none,
      [#Function<11.12217282/3 in :amqp_uri.mechanisms/1>,
       #Function<11.12217282/3 in :amqp_uri.mechanisms/1>], [], []}
   ]},
  restart_type: :intrinsic,
  shutdown: :brutal_kill,
  child_type: :worker
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1220.0>,
  name: :channel_sup_sup,
  mfargs: {:amqp_channel_sup_sup, :start_link,
   [:network, #PID<0.1219.0>, "client 127.0.0.1:61146 -> 127.0.0.1:5672"]},
  restart_type: :intrinsic,
  shutdown: :infinity,
  child_type: :supervisor
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1221.0>,
  name: :channels_manager,
  mfargs: {:amqp_channels_manager, :start_link,
   [#PID<0.1219.0>, "client 127.0.0.1:61146 -> 127.0.0.1:5672", #PID<0.1220.0>]},
  restart_type: :transient,
  shutdown: 30000,
  child_type: :worker
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1222.0>,
  name: :writer,
  mfargs: {:rabbit_writer, :start_link,
   [#Port<0.216>, 0, 4096, :rabbit_framing_amqp_0_9_1, #PID<0.1219.0>,
    "client 127.0.0.1:61146 -> 127.0.0.1:5672", false, 1000000000]},
  restart_type: :transient,
  shutdown: 30000,
  child_type: :worker
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1223.0>,
  name: :main_reader,
  mfargs: {:amqp_main_reader, :start_link,
   [
     #Port<0.216>,
     #PID<0.1219.0>,
     #PID<0.1221.0>,
     {:method, :rabbit_framing_amqp_0_9_1},
     "client 127.0.0.1:61146 -> 127.0.0.1:5672"
   ]},
  restart_type: :transient,
  shutdown: 30000,
  child_type: :worker
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1224.0>,
  name: :heartbeat_sender,
  mfargs: {:rabbit_heartbeat, :start_heartbeat_sender,
   [
     #Port<0.216>,
     10,
     #Function<2.52632387/0 in :amqp_network_connection.start_heartbeat/1>,
     {:heartbeat_sender, "client 127.0.0.1:61146 -> 127.0.0.1:5672"}
   ]},
  restart_type: :transient,
  shutdown: 30000,
  child_type: :worker
]
[info]     :supervisor: {#PID<0.1218.0>, :amqp_connection_type_sup}
    :started: [
  pid: #PID<0.1225.0>,
  name: :heartbeat_receiver,
  mfargs: {:rabbit_heartbeat, :start_heartbeat_receiver,
   [
     #Port<0.216>,
     10,
     #Function<3.52632387/0 in :amqp_network_connection.start_heartbeat/1>,
     {:heartbeat_receiver, "client 127.0.0.1:61146 -> 127.0.0.1:5672"}
   ]},
  restart_type: :transient,
  shutdown: 30000,
  child_type: :worker
]
{:ok, %AMQP.Connection{pid: #PID<0.1219.0>}}

The following output is very problematic:

[info]     :supervisor: {#PID<0.1217.0>, :amqp_connection_sup}
    :started: [
  pid: #PID<0.1219.0>,
  name: :connection,
  mfargs: {:amqp_gen_connection, :start_link,
   [
     #PID<0.1218.0>,
     {:amqp_params_network, "guest", {:plaintext, "guest"}, "/", 'localhost',
      5672, 2047, 0, 10, 60000, :none,
      [#Function<11.12217282/3 in :amqp_uri.mechanisms/1>,
       #Function<11.12217282/3 in :amqp_uri.mechanisms/1>], [], []}
   ]},
  restart_type: :intrinsic,
  shutdown: :brutal_kill,
  child_type: :worker

You can see, that :amqp_params_network logs the credentials and the server name as plaintext.

How is it possible to disable this output? Our config contains already the following configuration for the :lager package.

config :lager,
  error_logger_redirect: false,
  handlers: [level: :critical]

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions