Skip to content

Harden get_subscription_payload against malformed tokens and improve public IP detection with multiple HTTP and socket fallbacks - #22

Merged
ImMohammad20000 merged 2 commits into
PasarGuard:nextfrom
zZedix:next
Oct 5, 2025

Conversation

@zZedix

@zZedix zZedix commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

Improves resilience of get_subscription_payload by validating decoded token format
and preventing IndexError/ValueError for tampered or malformed tokens.

Added split and numeric validation for custom token decoding
Ensures consistent None return instead of 500 on invalid input
Keeps behavior unchanged for valid subscription tokens

Improve public IP detection with multiple HTTP and socket fallbacks

Add layered fallback strategy using ipify, icanhazip, and ifconfig.io with IPv4 enforcement.
Falls back to UDP socket check when HTTP methods fail, and defaults to 127.0.0.1.
Ensures IPv6 is disabled for reliability and includes proper socket cleanup.

@zZedix zZedix changed the title Harden get_subscription_payload against malformed tokens and mprove public IP detection with multiple HTTP and socket fallbacks Harden get_subscription_payload against malformed tokens and improve public IP detection with multiple HTTP and socket fallbacks Oct 5, 2025
@ImMohammad20000
ImMohammad20000 merged commit 7413107 into PasarGuard:next Oct 5, 2025
9 checks passed
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.

2 participants