We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c4dc450 commit 45fda0dCopy full SHA for 45fda0d
1 file changed
webhooks.py
@@ -56,14 +56,17 @@ def index():
56
# Allow Github IPs only
57
if config.get('github_ips_only', True):
58
src_ip = ip_address(
59
- u'{}'.format(request.remote_addr) # Fix stupid ipaddress issue
+ u'{}'.format(request.access_route[0]) # Fix stupid ipaddress issue
60
)
61
whitelist = requests.get('https://api.github.com/meta').json()['hooks']
62
63
for valid_ip in whitelist:
64
if src_ip in ip_network(valid_ip):
65
break
66
else:
67
+ logging.error('IP {} not allowed'.format(
68
+ src_ip
69
+ ))
70
abort(403)
71
72
# Enforce secret
0 commit comments