Skip to content

Fix critical security vulnerabilities and bugs#498

Open
YashejShah wants to merge 1 commit intoTeamUltroid:mainfrom
YashejShah:fix/security-and-bugs
Open

Fix critical security vulnerabilities and bugs#498
YashejShah wants to merge 1 commit intoTeamUltroid:mainfrom
YashejShah:fix/security-and-bugs

Conversation

@YashejShah
Copy link

@YashejShah YashejShah commented Mar 11, 2026

Summary

  • Fix SQL injection in PostgreSQL adapter (SqlDB) — column names are now validated against a strict identifier regex before interpolation
  • Eliminate eval() RCE vectors — replaced unsafe eval() with ast.literal_eval() in json_parser, _get_value, and nightmode; built a safe AST-based math evaluator for the calculator plugin
  • Fix command injection via user-controlled ADDONS_URL — all subprocess.run(shell=True) calls converted to list-form (no shell)
  • Replace os.system() calls with subprocess.check_call() in _database.py for safer package installation
  • Fix Terminal.terminate() bug — process was popped from dict before .kill() was called, so it never actually killed anything
  • Fix _auto_remove_processes — was a @property with an infinite while loop iterating PIDs as if they were process objects; replaced with a proper cleanup method
  • Fix __dict__ property override in BaseClient that broke Python introspection; renamed to as_dict()
  • Fix infinite retry loops in fast_uploader/fast_downloader — now limited to 3 retries with proper error reporting
  • Fix mediainfo() missing else — "video as doc" always overwrote "video" regardless of streaming support check
  • Fix ThreadPoolExecutor leakrun_async was creating a new executor per call; now uses a shared instance
  • Fix missing f-string in ssgen.py that printed literal {ultroid.session.save()} instead of the actual session
  • Pin dependency versions in requirements.txt to prevent supply-chain issues

Test plan

  • Verify bot starts normally with Redis/Mongo/SQL database backends
  • Test .calc command with basic math expressions
  • Test .bash and .eval commands (owner only)
  • Test nightmode scheduling with custom times
  • Test file upload/download via bot
  • Verify addon loading works with ADDONS_URL set
  • Confirm no regressions in plugin loading

🤖 Generated with Claude Code

Security fixes:
- Fix SQL injection in SqlDB by validating column names as identifiers
- Replace eval() with ast.literal_eval() in json_parser, _get_value, nightmode
- Replace eval() with safe AST-based math evaluator in calculator plugin
- Fix command injection via ADDONS_URL by using list-form subprocess calls
- Replace all os.system() calls with subprocess.check_call() in _database.py
- Remove all shell=True subprocess calls in loader.py

Bug fixes:
- Fix Terminal.terminate() pop-then-access bug that never killed processes
- Fix _auto_remove_processes infinite loop and wrong key iteration
- Fix __dict__ property override breaking Python introspection in BaseClient
- Fix infinite retry loops in fast_uploader/fast_downloader (max 3 retries)
- Fix mediainfo() missing else branch that always overwrote "video" result
- Fix ThreadPoolExecutor leak by using a shared executor instance
- Fix missing f-string prefix in ssgen.py session output
- Pin dependency versions in requirements.txt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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