Skip to content

Mongo URI password visible in process list on Linux #561

Closed as not planned
Closed as not planned
@vineelyalamarthy

Description

@vineelyalamarthy

Describe the bug
Exporter tries to connect with MongoDB using the URI to get the metrics.

Here is the URI format.

mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]

When we do ps -ef we are able to see the password even though we try to render the password via an env and this can be a security breach when we use this in production environment.

To Reproduce
Steps to reproduce the behavior:

  1. Install MongoDB 4.2 in either replica set mode or stand alone mode. (Though we believe Mongo version has nothing to do here)
  2. Run the binary (mongodb_exporter-0.7.1.linux-amd64.tar.gz) by providing the Mongo connection URI as shown above.

Expected behavior
When we go the terminal and do ps -ef, password should be redacted.

Logs
Please provide logs relevant to the issue

Environment

  • Linux
  • docker, k8s (1.22)
  • Mongo DB version 4.2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions