Skip to content

Sensitive data printed despite the show_sensitive_data_on_connection_error: false flag #335

@luigi-discoup

Description

@luigi-discoup

Hi everyone 👋

I'm having some db connection error lately and even though the Ecto Repo configuration sets:

show_sensitive_data_on_connection_error: false

the error message includes credentials (username and password) in plaintext, in the connection arguments:

Task #PID<0.3781.0> started from #PID<0.3183.0> terminating
** (DBConnection.ConnectionError) ssl recv: closed
    (postgrex 0.21.1) lib/postgrex.ex:347: Postgrex.query!/4
    (db_connection 2.8.1) lib/db_connection.ex:956: DBConnection.run/3
    (db_connection 2.8.1) lib/db_connection/task.ex:30: DBConnection.Task.init/3
    (elixir 1.18.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.18.4) lib/task/supervised.ex:36: Task.Supervised.reply/4
Process Label: "db_after_connect_task"
Function: &DBConnection.Task.init/3
    Args: [{Postgrex, :query!, ["SET search_path TO ***, public", []]}, #PID<0.3183.0>, [timeout: 15000, pool_index: 6, types: Postgrex.DefaultTypes, port: 5432, pool: DBConnection.ConnectionPool, repo: Core.Repo, telemetry_prefix: [:core, :repo], otp_app: :core, timeout: 15000, migration_timestamps: [type: :utc_datetime], ssl: [verify: :verify_none], pool_size: 20, socket_options: [], stacktrace: false, show_sensitive_data_on_connection_error: false, after_connect: {Postgrex, :query!, ["SET search_path TO ***, public", []]}, parameters: [application_name: "***"], hostname: "***.***.rds.amazonaws.com", scheme: "ecto", username: "***", password: "***", database: "***"]]

I manually redacted the values above, in the original error, credentials are fully visible.

Is this an expected behaviour?

Environment

  • Elixir: 1.18.4 (compiled with Erlang/OTP 27)
  • Ecto: 3.13.4
  • EctoSQL: 3.13.2
  • DBConnection: 2.8.1
  • Postgrex: 0.21.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions