diff options
author | 2021-12-25 17:38:42 +0000 | |
---|---|---|
committer | 2021-12-25 17:38:42 +0000 | |
commit | 623056ab36b68dee796281be63edf209c545d83c (patch) | |
tree | fd462eae1170fcf49855a867c96dd6d6cbdb0b73 /backend/routes/forms/submit.py | |
parent | Merge pull request #104 from python-discord/Pin-platform-in-Dockerfile (diff) |
Hash Cf-Connecting-IP if given, else remote host
Diffstat (limited to 'backend/routes/forms/submit.py')
-rw-r--r-- | backend/routes/forms/submit.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/backend/routes/forms/submit.py b/backend/routes/forms/submit.py index d0ce22c..8d9f4e5 100644 --- a/backend/routes/forms/submit.py +++ b/backend/routes/forms/submit.py @@ -116,7 +116,11 @@ class SubmitForm(Route): if constants.FormFeatures.DISABLE_ANTISPAM.value not in form.features: ip_hash_ctx = hashlib.md5() - ip_hash_ctx.update(request.client.host.encode()) + ip_hash_ctx.update( + request.headers.get( + "Cf-Connecting-IP", request.client.host + ).encode() + ) ip_hash = binascii.hexlify(ip_hash_ctx.digest()) user_agent_hash_ctx = hashlib.md5() user_agent_hash_ctx.update(request.headers["User-Agent"].encode()) |