Skip to content

Commit f074b8a

Browse files
committed
Log IP address of any unauth request made
1 parent 6a986c5 commit f074b8a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

frontend/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ def wrapper(*args, **kwargs):
197197
try:
198198
extract_key(request, 'api_key')
199199
except (KeyNotFound, InvalidKeyValue):
200+
ip = request.environ.get(
201+
'HTTP_X_FORWARDED_FOR',
202+
request.remote_addr
203+
)
204+
LOGGER.warning(f'Unauthorised request from {ip}')
200205
return return_api({}, 'ApiKeyInvalid', 401)
201206

202207
diffuse_timers()

0 commit comments

Comments
 (0)