Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ django-admin-tools
# Cryptography for JWT parsing and validation
python-jose

# django X-Forwarded-For
django-xff



## Data storage
Expand Down
107 changes: 56 additions & 51 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,6 @@ dj-database-url==0.5.0 \
--hash=sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163 \
--hash=sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9
# via -r requirements.in
django==3.2.4 \
--hash=sha256:66c9d8db8cc6fe938a28b7887c1596e42d522e27618562517cc8929eb7e7f296 \
--hash=sha256:ea735cbbbb3b2fba6d4da4784a0043d84c67c92f1fdf15ad6db69900e792c10f
# via
# -r requirements.in
# django-cors-headers
# django-debug-toolbar
# django-migration-linter
# django-reversion
# django-sql-dashboard
# django-stubs
# django-stubs-ext
django-admin-tools==0.9.1 \
--hash=sha256:cb32332f93e6ab4549d4d625587fe405f98e82e31b349ea000b809eaa1aa56cd \
--hash=sha256:f54cfed4e8eceb62c57962e41c0a8d202e40c18f4fe1ebeeef3507d8f027e8d7
Expand All @@ -207,28 +195,45 @@ django-migration-linter==2.5.3 \
--hash=sha256:32cfb5423dcdb77dbbb452f45cef56172a234bd34b9967f03536bfcb1f1ba8a9 \
--hash=sha256:fb71ca0edec938c512a60e660e35fd05958153be1686bcfd5a500900287ececf
# via -r requirements.in
django-reversion-compare==0.14.0 \
--hash=sha256:72609a2e6bdc4e0e7116081cd2b3711103dff7897cc2bbe78386639413c90c9b \
--hash=sha256:d0981c3a0c8dc8fdd6964432e4397f2fe33d521aee29cb1f232b37e6a71c61bf
# via -r requirements.in
django-reversion==3.0.9 \
--hash=sha256:1b57127a136b969f4b843a915c72af271febe7f336469db6c27121f8adcad35c \
--hash=sha256:a5af55f086a3f9c38be2f049c251e06005b9ed48ba7a109473736b1fc95a066f
# via
# -r requirements.in
# django-reversion-compare
django-reversion-compare==0.14.0 \
--hash=sha256:72609a2e6bdc4e0e7116081cd2b3711103dff7897cc2bbe78386639413c90c9b \
--hash=sha256:d0981c3a0c8dc8fdd6964432e4397f2fe33d521aee29cb1f232b37e6a71c61bf
# via -r requirements.in
django-sql-dashboard==0.16 \
--hash=sha256:48cfba2b9aa20c711d8477d01d0fee6b4600fed2dc1cc41c440be54617a15b7f \
--hash=sha256:d6aaedb490dea74b99b5e87ed023846db0ae2d0e363e61a58d37a4c84256fa93
# via -r requirements.in
django-stubs==1.8.0 \
--hash=sha256:717967d7fee0a6af0746724a0be80d72831a982a40fa8f245a6a46f4cafd157b \
--hash=sha256:bde9e44e3c4574c2454e74a3e607cc3bc23b0441bb7d1312cd677d5e30984b74
# via -r requirements.in
django-stubs-ext==0.2.0 \
--hash=sha256:bd4a1e36ef2ba0ef15801933c85c68e59b383302c873795c6ecfc25950c7ecdb \
--hash=sha256:c14f297835a42c1122421ec7e2d06579996b29d33b8016002762afa5d78863af
# via django-stubs
django-stubs==1.8.0 \
--hash=sha256:717967d7fee0a6af0746724a0be80d72831a982a40fa8f245a6a46f4cafd157b \
--hash=sha256:bde9e44e3c4574c2454e74a3e607cc3bc23b0441bb7d1312cd677d5e30984b74
# via -r requirements.in
django-xff==1.3.0 \
--hash=sha256:46af595516c21966ce7d4233fe91f771c16285625566b49ac34e90737107111c \
--hash=sha256:c352f06acc8e5be9c9ffb109635ddfcc952157aee86acf9064d2457c5f818803
# via -r requirements.in
django==3.2.4 \
--hash=sha256:66c9d8db8cc6fe938a28b7887c1596e42d522e27618562517cc8929eb7e7f296 \
--hash=sha256:ea735cbbbb3b2fba6d4da4784a0043d84c67c92f1fdf15ad6db69900e792c10f
# via
# -r requirements.in
# django-cors-headers
# django-debug-toolbar
# django-migration-linter
# django-reversion
# django-sql-dashboard
# django-stubs
# django-stubs-ext
# django-xff
dnspython==2.1.0 \
--hash=sha256:95d12f6ef0317118d2a1a6fc49aac65ffec7eb8087474158f42f26a639135216 \
--hash=sha256:e4a87f0b573201a0f3727fa18a516b055fd1107e0e5477cded4a2de497df1dd4
Expand Down Expand Up @@ -429,14 +434,14 @@ iniconfig==1.1.1 \
--hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \
--hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32
# via pytest
ipython==7.24.1 \
--hash=sha256:9bc24a99f5d19721fb8a2d1408908e9c0520a17fff2233ffe82620847f17f1b6 \
--hash=sha256:d513e93327cf8657d6467c81f1f894adc125334ffe0e4ddd1abbb1c78d828703
# via -r requirements.in
ipython-genutils==0.2.0 \
--hash=sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8 \
--hash=sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8
# via traitlets
ipython==7.24.1 \
--hash=sha256:9bc24a99f5d19721fb8a2d1408908e9c0520a17fff2233ffe82620847f17f1b6 \
--hash=sha256:d513e93327cf8657d6467c81f1f894adc125334ffe0e4ddd1abbb1c78d828703
# via -r requirements.in
isort==5.9.1 \
--hash=sha256:83510593e07e433b77bd5bff0f6f607dbafa06d1a89022616f02d8b699cfcd56 \
--hash=sha256:8e2c107091cfec7286bc0f68a547d0ba4c094d460b732075b6fba674f1035c0c
Expand Down Expand Up @@ -490,6 +495,13 @@ mccabe==0.6.1 \
--hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \
--hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f
# via flake8
mypy-extensions==0.4.3 \
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8
# via
# black
# mypy
# typing-inspect
mypy==0.902 \
--hash=sha256:0190fb77e93ce971954c9e54ea61de2802065174e5e990c9d4c1d0f54fbeeca2 \
--hash=sha256:0756529da2dd4d53d26096b7969ce0a47997123261a5432b48cc6848a2cb0bd4 \
Expand Down Expand Up @@ -517,13 +529,6 @@ mypy==0.902 \
# via
# -r requirements.in
# django-stubs
mypy-extensions==0.4.3 \
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8
# via
# black
# mypy
# typing-inspect
numba==0.53.1 \
--hash=sha256:0ef9d1f347b251282ae46e5a5033600aa2d0dfa1ee8c16cb8137b8cd6f79e221 \
--hash=sha256:17146885cbe4e89c9d4abd4fcb8886dee06d4591943dc4343500c36ce2fcfa69 \
Expand Down Expand Up @@ -722,17 +727,17 @@ py==1.10.0 \
--hash=sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3 \
--hash=sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a
# via pytest
pyasn1-modules==0.2.8 \
--hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \
--hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74
# via google-auth
pyasn1==0.4.8 \
--hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \
--hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba
# via
# pyasn1-modules
# python-jose
# rsa
pyasn1-modules==0.2.8 \
--hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \
--hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74
# via google-auth
pycodestyle==2.7.0 \
--hash=sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068 \
--hash=sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef
Expand Down Expand Up @@ -783,14 +788,6 @@ pyparsing==2.4.7 \
--hash=sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1 \
--hash=sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b
# via packaging
pytest==6.2.3 \
--hash=sha256:671238a46e4df0f3498d1c3270e5deb9b32d25134c99b7d75370a68cfbe9b634 \
--hash=sha256:6ad9c7bdf517a808242b998ac20063c41532a570d088d77eec1ee12b0b5574bc
# via
# pytest-cov
# pytest-django
# pytest-dotenv
# pytest-httpx
pytest-cov==2.12.1 \
--hash=sha256:261bb9e47e65bd099c89c3edf92972865210c36813f80ede5277dceb77a4a62a \
--hash=sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7
Expand All @@ -807,6 +804,14 @@ pytest-httpx==0.12.0 \
--hash=sha256:1e135b8779060091fa1c87d8aff7904921e8bea95fce5e971a0262764d064b12 \
--hash=sha256:e262932f2d3ce380da8273c7bacbcfdc2c94e167fa94da29571caaf1f4d3ba27
# via -r requirements.in
pytest==6.2.3 \
--hash=sha256:671238a46e4df0f3498d1c3270e5deb9b32d25134c99b7d75370a68cfbe9b634 \
--hash=sha256:6ad9c7bdf517a808242b998ac20063c41532a570d088d77eec1ee12b0b5574bc
# via
# pytest-cov
# pytest-django
# pytest-dotenv
# pytest-httpx
python-dateutil==2.8.1 \
--hash=sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c \
--hash=sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a
Expand Down Expand Up @@ -908,6 +913,14 @@ regex==2021.4.4 \
--hash=sha256:fa4537fb4a98fe8fde99626e4681cc644bdcf2a795038533f9f711513a862ae6 \
--hash=sha256:fd45ff9293d9274c5008a2054ecef86a9bfe819a67c7be1afb65e69b405b3042
# via black
requests-mock==1.9.3 \
--hash=sha256:0a2d38a117c08bb78939ec163522976ad59a6b7fdd82b709e23bb98004a44970 \
--hash=sha256:8d72abe54546c1fc9696fa1516672f1031d72a55a1d66c85184f972a24ba0eba
# via -r requirements.in
requests-oauthlib==1.3.0 \
--hash=sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d \
--hash=sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a
# via social-auth-core
requests==2.25.1 \
--hash=sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804 \
--hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e
Expand All @@ -919,14 +932,6 @@ requests==2.25.1 \
# requests-mock
# requests-oauthlib
# social-auth-core
requests-mock==1.9.3 \
--hash=sha256:0a2d38a117c08bb78939ec163522976ad59a6b7fdd82b709e23bb98004a44970 \
--hash=sha256:8d72abe54546c1fc9696fa1516672f1031d72a55a1d66c85184f972a24ba0eba
# via -r requirements.in
requests-oauthlib==1.3.0 \
--hash=sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d \
--hash=sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a
# via social-auth-core
rfc3986[idna2008]==1.4.0 \
--hash=sha256:112398da31a3344dc25dbf477d8df6cb34f9278a94fee2625d89e4514be8bb9d \
--hash=sha256:af9147e9aceda37c91a05f4deb128d4b4b49d6b199775fd2d2927768abdc8f50
Expand Down
2 changes: 1 addition & 1 deletion vaccinate/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def replacement_view_function(request, *args, **kwargs):
method=request.method,
path=request.path,
query_string=request.META.get("QUERY_STRING") or "",
remote_ip=request.META.get("REMOTE_ADDR") or "",
remote_ip=request.META.get("HTTP_REMOTE_ADDR") or "", #HTTP_X_FORWARDED_FOR might be more ideal when running on google cloud run https://twitter.com/altonpowers/status/1382618742044164096
post_body=post_body,
post_body_json=post_body_json,
response_status=response.status_code,
Expand Down
3 changes: 3 additions & 0 deletions vaccinate/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"django.middleware.security.SecurityMiddleware",
"corsheaders.middleware.CorsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
'xff.middleware.XForwardedForMiddleware',
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
Expand All @@ -172,6 +173,8 @@
# Swap this out later for CORS_ALLOWED_ORIGINS = ["https://example.com", ...]
CORS_ALLOW_ALL_ORIGINS = True

XFF_TRUSTED_PROXY_DEPTH = 1

if RUNNING_IN_GCLOUD:
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_SSL_REDIRECT = True
Expand Down