Skip to content

Conversation

@gagik
Copy link
Collaborator

@gagik gagik commented Nov 18, 2025

This will let us use mongodb-redact as one source of truth for redacting logic in both @mongosh/history and @mongosh/logging

@gagik gagik force-pushed the gagik/add-command branch from 386b4dd to 7209ba0 Compare November 18, 2025 11:51
@gagik gagik changed the base branch from gagik/fix-redact to main November 18, 2025 11:51
@gagik gagik force-pushed the gagik/add-command branch from 7209ba0 to 8b3ea74 Compare November 18, 2025 11:52
@gagik gagik marked this pull request as draft November 18, 2025 12:02
@gagik gagik changed the title feat(mongodb-react): add shouldRedactCommand MONGOSH-2991 feat(mongodb-react): add shouldRedactCommand, redactUriCredentials MONGOSH-2991 Nov 18, 2025
@gagik gagik force-pushed the gagik/add-command branch from 8b3ea74 to 7e75778 Compare November 18, 2025 12:19
"dependencies": {
"regexp.escape": "^2.0.1"
"regexp.escape": "^2.0.1",
"mongodb-connection-string-url": "^3.0.1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

by the way this is now at 7.0.0, I'm keeping at same version as mongosh to minimize side effects for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

What you can do, if you want to, is to specify

Suggested change
"mongodb-connection-string-url": "^3.0.1"
"mongodb-connection-string-url": "^3.0.1 || ^7.0.0"

and give control to the user of this package, since it's pretty reasonable to assume that both of these would work just fine

"dependencies": {
"regexp.escape": "^2.0.1"
"regexp.escape": "^2.0.1",
"mongodb-connection-string-url": "^3.0.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What you can do, if you want to, is to specify

Suggested change
"mongodb-connection-string-url": "^3.0.1"
"mongodb-connection-string-url": "^3.0.1 || ^7.0.0"

and give control to the user of this package, since it's pretty reasonable to assume that both of these would work just fine

@@ -0,0 +1,5 @@
import { redactConnectionString } from 'mongodb-connection-string-url';

export function redactUriCredentials(uri: string): string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this redactConnectionString to keep identifier continuity? Or is there a specific reason that this should be named redactUriCredentials? Being able to grep for something and find all instances of that thing is generally quite helpful

(in this particular case, "URI credentials" might also be a bit misleading because in the context of URIs, credentials refer to username and password specifically, but we also filter out known credentials in the connection string like AWS session tokens or private key file passwords because we're aware of connection string semantics here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it was meant to be redactURICredentials solely because mongosh history's function this is copying was named that, so not really a deep reason.
redactConnectionString sounds better to me

@gagik gagik merged commit adcb741 into main Nov 18, 2025
33 checks passed
@gagik gagik deleted the gagik/add-command branch November 18, 2025 15:43
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.

3 participants