Skip to content

feat(connection-string-policy): add shared connection string policy checks VSCODE-798 - #863

Open
ivandevp wants to merge 2 commits into
mainfrom
VSCODE-798-connection-string-policy
Open

feat(connection-string-policy): add shared connection string policy checks VSCODE-798#863
ivandevp wants to merge 2 commits into
mainfrom
VSCODE-798-connection-string-policy

Conversation

@ivandevp

@ivandevp ivandevp commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds new package to check connection string policy and be reusable across different clients (i.e. compass, vscode, mcp).

Open Questions

  • The mongodb peer dependency is pinned to a single major on purpose: the type-level checks that keep the lists exhaustive are only meaningful against one set of driver typings. Is this safe to assume?
  • It was suggested that this could live in devtools-connect instead. I went with a separate package to avoid pulling its dependencies into a client that needs none of them, but happy to re-export it from there if preferred.

Checklist

…hecks VSCODE-798

Moves the connection string option checks that lived in the Compass main process into a shared package, so that the VS Code extension and the MCP server can use the same lists.
@ivandevp
ivandevp requested a review from alenakhineika August 31, 2026 15:51
@ivandevp ivandevp self-assigned this Aug 31, 2026
@ivandevp
ivandevp marked this pull request as ready for review August 31, 2026 15:51
Comment thread packages/connection-string-policy/src/connection-string-policy.ts Outdated
'timeoutMS',
'tls', // Only if value is `true` or target host is local.
'tlsCertificateKeyFile',
'tlsCertificateKeyFilePassword',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we move tlsCertificateKeyFile/tlsCRLFile and the other local-file-reading options to the disallowed list? Or how do we make a decision on what goes in which bucket?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I know we tried moving it to the disallowed list but we ended up reverting it in mongodb-js/compass@6fb1568 and I found this thread about it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's worth documenting somewhere around this code I think as this is not the first time this trips people up

Co-authored-by: Alena Khineika <alena.khineika@mongodb.com>
* Check a connection string against the policy list, and report the options that fall
* outside it.
*
* This is *not* a general-purpose connection string validator: it makes no claim about

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we clarify what then it tells us?

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