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

removed telegram ip safelist validation #639

Merged
merged 1 commit into from
Oct 26, 2024
Merged
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
10 changes: 5 additions & 5 deletions telegram/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def get_telegram_safe_ips():

@csrf_exempt
def telebot_respond(request):
client_ip = request.META["REMOTE_ADDR"]
# client_ip = request.META["REMOTE_ADDR"]
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Avoid commenting out code - either remove it entirely or keep it active

Commented out code can confuse future maintainers and makes version control history less useful. If this code is no longer needed, it should be removed. If it might be needed later, consider adding a TODO comment explaining why it's disabled.

Suggested change
# client_ip = request.META["REMOTE_ADDR"]
client_ip = request.META["REMOTE_ADDR"]


telegram_ips = get_telegram_safe_ips
# telegram_ips = get_telegram_safe_ips

# Validate the request's IP address against Telegram's IP ranges
if client_ip not in telegram_ips:
raise PermissionDenied("Invalid IP address")
# # Validate the request's IP address against Telegram's IP ranges
# if client_ip not in telegram_ips:
# raise PermissionDenied("Invalid IP address")

if (
request.headers.get("X-Telegram-Bot-Api-Secret-Token")
Expand Down
Loading