Skip to content

Conversation

kmruiz
Copy link
Collaborator

@kmruiz kmruiz commented Sep 3, 2025

Proposed changes

This sets up a Keychain, a holder of known secrets. When a new secret is created it should be registered in the keychain so loggers can redact them and avoid leaking secrets into our logs.

Checklist

This sets up a Keychain, a holder of known secrets. When a new secret
is created it should be registered in the keychain so loggers can
redact them and avoid leaking secrets into our logs.
@kmruiz kmruiz self-assigned this Sep 3, 2025
@Copilot Copilot AI review requested due to automatic review settings September 3, 2025 17:26
@kmruiz kmruiz requested a review from a team as a code owner September 3, 2025 17:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a dictionary-based redaction system for secrets in logs by introducing a Keychain class that stores known secrets and integrates with the MongoDB redact library to automatically redact sensitive information from log messages.

  • Adds a Keychain class to manage and register secrets with their types (user, password, url)
  • Integrates the keychain with all logger classes to enable automatic redaction using the updated mongodb-redact library
  • Registers known secrets from configuration and user input automatically in the keychain

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/common/keychain.ts New keychain class implementing secret storage and management
src/common/logger.ts Updates all logger classes to accept and use keychain for redaction
src/common/config.ts Adds function to register configuration secrets in root keychain
src/common/session.ts Adds keychain property to session for per-session secret management
src/transports/base.ts Updates logger instantiation to pass keychain instances
src/tools/atlas/create/createDBUser.ts Registers username and password in keychain when creating database users
src/tools/atlas/connect/connectCluster.ts Registers credentials in keychain when connecting to clusters
src/index.ts Updates emergency logger to use keychain
package.json Updates mongodb-redact dependency to version 1.2.0
tests/ Comprehensive test coverage for keychain functionality and integration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@himanshusinghs himanshusinghs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 🚀. The second comment about call to registerKnownSecretsInRootKeychain is something you might wanna think about before merging.

Copy link
Collaborator

@himanshusinghs himanshusinghs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets go 🚀

@kmruiz kmruiz merged commit 526fa3b into main Sep 4, 2025
18 checks passed
@kmruiz kmruiz deleted the mcp-29 branch September 4, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants