Skip to content
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

Changed method of generation of passwords and added error handling, along with function return types. #9138

Closed

Conversation

ankitdey-marsh
Copy link

@ankitdey-marsh ankitdey-marsh commented Aug 2, 2024

Fixes #N/A

Short description of what this resolves:

Checks for negative length password, hence added error handling and added return types to all functions in ./app/api/chat/rocket_chat.py

Changes proposed in this pull request:

Used 'secrets' library instead of random , since it is cryptographically secure, added error handling to check for negative length of passwords. Also added return types of all the functions.

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • [ ✔️] My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • [✔️ ] All the functions created/modified in this PR contain relevant docstrings.

Summary by Sourcery

Enhance password generation security by using the 'secrets' library and add error handling for invalid password parameters. Add return type annotations to all functions in app/api/chat/rocket_chat.py.

Enhancements:

  • Switched password generation to use the 'secrets' library for cryptographic security.
  • Added error handling for negative password lengths and empty password character sets.
  • Added return type annotations to all functions in app/api/chat/rocket_chat.py.

Copy link

sourcery-ai bot commented Aug 2, 2024

Reviewer's Guide by Sourcery

This pull request enhances the password generation method by using the 'secrets' library for better security, adds error handling for negative password lengths, and specifies return types for all functions in the rocket_chat.py file.

File-Level Changes

Files Changes
app/api/chat/rocket_chat.py Added return type annotations to all functions, switched to 'secrets' library for password generation, and implemented error handling for negative password lengths.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ankitdey-marsh - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider reviewing the character set used for password generation. A more limited set of special characters might be more user-friendly while still maintaining security.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

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.

1 participant