Skip to content

fix: instruct models not to generate passwords for createDBUser #177

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

Merged
merged 6 commits into from
May 1, 2025

Conversation

nirinchev
Copy link
Collaborator

While testing, noticed that models will generate overly simplistic passwords with the atlas-create-db-user tool, which is not ideal. This changes the args description to instruct the model not to attempt generating a password and instead we're generating one.

@Copilot Copilot AI review requested due to automatic review settings April 30, 2025 10:44
@nirinchev nirinchev requested review from blva, fmenezes and a team as code owners April 30, 2025 10:44
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 refines the password handling for the database user creation tool by instructing models not to generate passwords and instead relying on a secure password generator if one isn’t supplied.

  • Updated tests to verify both supplied and generated password flows.
  • Removed redundant password generation code from connectCluster in favor of a common utility.
  • Modified argument description and success message in createDBUser tool to clearly communicate password handling.

Reviewed Changes

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

Show a summary per file
File Description
tests/integration/tools/atlas/dbUsers.test.ts Updates test cases and assertions to account for generated password output.
tests/integration/helpers.ts Replaces Array.isArray check with the toBeArray matcher for improved readability.
src/tools/atlas/metadata/connectCluster.ts Removes redundant secure password generation in favor of a centralized utility.
src/tools/atlas/create/createDBUser.ts Adjusts argument descriptions and conditional logic for password generation, updating the success message accordingly.
src/common/atlas/generatePassword.ts Introduces a new secure password generator utility using crypto.
Comments suppressed due to low confidence (1)

src/tools/atlas/create/createDBUser.ts:83

  • The success message contains a spelling error; 'sucessfully' should be corrected to 'successfully'.
text: `User "${username}" created sucessfully${shouldGeneratePassword ? ` with password: `${password}` : ""}.`,

@nirinchev nirinchev merged commit 333c36a into main May 1, 2025
16 checks passed
@nirinchev nirinchev deleted the ni/create-user branch May 1, 2025 11:17
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