-
Notifications
You must be signed in to change notification settings - Fork 111
feat: add dictionary-based redaction for secrets in logs #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
There was a problem hiding this 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.
There was a problem hiding this 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.
It hides the idea of having a root keychain for external users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets go 🚀
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