Skip to content

fix: redact passwords with # in MongoDB URIs #674

Closed

Description

@uniqueg

Problem

_redact_uri() in foca/database/register_mongodb.py splits the connection string with urlsplit(), for which # starts a fragment. PyMongo doesn't treat # as special. With a password containing # in MONGO_URI (e.g. mongodb://user:pa#ss@host/db), the client works, and the INFO log message "Created MongoDB client for ..." has the username and the start of the password.

Proposal

Cut the connection string as PyMongo does: at the first ?, then everything after the last @.

Acceptance criteria

  • Regression test with # in the password; hosts and path stay in the redacted form.

Activity

  1. added this to the v0.21.0 milestone on Nov 4, 2026
  2. added
    priority: medium
    status: in progress
    type: bug
    type: security
    workload: minutes
    on Nov 4, 2026
  3. removed
    status: in progress
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumtype: bugtype: securityworkload: minutes

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions