Skip to content

fix: resolve NameError in export_folder_link, secure RNG, and update deprecated mongo method#181

Open
Gaoc3 wants to merge 1 commit into
Mayuri-Chan:mainfrom
Gaoc3:main
Open

fix: resolve NameError in export_folder_link, secure RNG, and update deprecated mongo method#181
Gaoc3 wants to merge 1 commit into
Mayuri-Chan:mainfrom
Gaoc3:main

Conversation

@Gaoc3

@Gaoc3 Gaoc3 commented Jul 5, 2026

Copy link
Copy Markdown

Overview

This Pull Request addresses several bugs and deprecations discovered during a static analysis of the codebase.

Fixes Included

  1. NameError & Logic Bug in export_folder_link.py

    • Crash Fix: Added the missing types import to prevent a NameError crash when types.ExportedFolderLink._parse(r) is called.
    • Logic Fix: Fixed a copy-paste error where folder.included_chats was mistakenly appended to the peers list for both excluded_chats and pinned_chats conditions.
  2. Deprecation in mongo_storage.py

    • Fix: Replaced the deprecated remove({}) method with delete_many({}). remove() was removed in PyMongo v4.0+, causing silent failures within the try-except block when remove_peers=True is used.
  3. Insecure RNG in prime.py

    • Security Fix: Replaced random.randint with the cryptographically secure secrets.randbelow for prime generation.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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