Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions info.py → Bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ def is_enabled(value, default):
#---------------------------------------------------------------
#--------------------------------------------------------------- ,
SESSION = environ.get('SESSION', 'Media_search')
API_ID = int(environ.get('API_ID', '21484'))
API_HASH = environ.get('API_HASH', 'db6286a041adf07ef4244e')
BOT_TOKEN = environ.get('BOT_TOKEN', '7807I9ygow9sLqNQuI7hsWPm5FLNfBr9c')
API_ID = int(environ.get('API_ID', '32130352'))
API_HASH = environ.get('API_HASH', 'fddbf986bb12dee0c05b32594188d75e')
BOT_TOKEN = environ.get('BOT_TOKEN', '8293394314:AAGNYE5w99XbCfV9zZRlhSBIVsLRIgWZr-A')
Comment on lines +16 to +18
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove committed secrets and require env vars at startup.

Line 16, Line 17, Line 18, Line 28, and Line 29 currently include hardcoded credentials/tokens (including DB credentials in URI). This is a critical secret-leak risk.

🔐 Proposed fix (fail-fast required envs, no secret defaults)
+def get_required_env(name):
+    value = environ.get(name)
+    if not value:
+        raise RuntimeError(f"Missing required environment variable: {name}")
+    return value
+
-API_ID = int(environ.get('API_ID', '32130352'))
-API_HASH = environ.get('API_HASH', 'fddbf986bb12dee0c05b32594188d75e')
-BOT_TOKEN = environ.get('BOT_TOKEN', '8293394314:AAGNYE5w99XbCfV9zZRlhSBIVsLRIgWZr-A')
+API_ID = int(get_required_env('API_ID'))
+API_HASH = get_required_env('API_HASH')
+BOT_TOKEN = get_required_env('BOT_TOKEN')

-DATABASE_URI = environ.get('DATABASE_URI', "mongodb+srv://manuthakur:[email protected]/?appName=manuthakur")
-DATABASE_NAME = environ.get('DATABASE_NAME', "manuthakur")
+DATABASE_URI = get_required_env('DATABASE_URI')
+DATABASE_NAME = get_required_env('DATABASE_NAME')

Also applies to: 28-29

🧰 Tools
🪛 Gitleaks (8.30.0)

[high] 17-17: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Bot.py` around lines 16 - 18, The file currently embeds secrets as default
values for API_ID, API_HASH, BOT_TOKEN (and the DB URI at the later lines), so
replace those getenv calls that use hardcoded defaults with fail-fast required
env lookups (e.g., use environ[...] or an equivalent that raises when missing)
for API_ID, API_HASH, BOT_TOKEN and the DB connection variables referenced later
(lines ~28-29), remove all hardcoded tokens/credentials from the code, and
ensure the application raises a clear error at startup if any required
environment variable is not set so secrets must be provided via
environment/config management.

#---------------------------------------------------------------
#---------------------------------------------------------------
ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '5016109398').split()]
USERNAME = environ.get('USERNAME', "https://t.me/Innocent_babe_dead") # ADMIN USERNAME
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', '-1002190681742'))
MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://t.me/+K2kgCBgaat80YWQ9')
CHANNELS = [int(ch) if id_pattern.search(ch) else ch for ch in environ.get('CHANNELS', '-1002190681742').split()]
ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '8553992570').split()]
USERNAME = environ.get('USERNAME', "https://t.me/manuthakur01") # ADMIN USERNAME
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', '-1003885974344'))
MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013')
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix malformed default URL for movie group link.

Line 24 default value has a double scheme (https://https://...), so it resolves to an invalid URL when MOVIE_GROUP_LINK is unset.

🔧 Proposed fix
-MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013')
+MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://t.me/funchannel013')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013')
MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://t.me/funchannel013')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Bot.py` at line 24, Default for MOVIE_GROUP_LINK in Bot.py contains a
duplicated scheme ("https://https://...") making the URL invalid; update the
MOVIE_GROUP_LINK default to a valid URL (e.g., replace the current default with
"https://t.me/funchannel013") so environ.get('MOVIE_GROUP_LINK', ...) returns a
correct link when unset and ensure no extra scheme or whitespace remains.

CHANNELS = [int(ch) if id_pattern.search(ch) else ch for ch in environ.get('CHANNELS', '-1003828167659').split()]
#---------------------------------------------------------------
#---------------------------------------------------------------
DATABASE_URI = environ.get('DATABASE_URI', "mongodb+srv:learningbajority&appName=learningbots")
DATABASE_NAME = environ.get('DATABASE_NAME', "learningbots")
DATABASE_URI = environ.get('DATABASE_URI', "mongodb+srv://manuthakur:[email protected]/?appName=manuthakur")
DATABASE_NAME = environ.get('DATABASE_NAME', "manuthakur")
COLLECTION_NAME = environ.get('COLLECTION_NAME', 'Telegram_files')
#---------------------------------------------------------------
#---------------------------------------------------------------
Expand Down