mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-06-24 05:35:10 +00:00
Move user credentials into HTTP request headers to prevent them being logged in the server logs
This commit is contained in:
@@ -12,15 +12,15 @@ class LookupCredentials:
|
||||
hamqth_session_id: str = "" # alternative to username/password
|
||||
|
||||
|
||||
def extract_credentials(query_params):
|
||||
"""Build a LookupCredentials from HTTP query params; returns None if no usable credentials are present."""
|
||||
def extract_credentials(headers):
|
||||
"""Build a LookupCredentials from HTTP request headers; returns None if no usable credentials are present."""
|
||||
creds = LookupCredentials(
|
||||
qrz_username=query_params.get("qrz_username", ""),
|
||||
qrz_password=query_params.get("qrz_password", ""),
|
||||
qrz_session_key=query_params.get("qrz_session_key", ""),
|
||||
hamqth_username=query_params.get("hamqth_username", ""),
|
||||
hamqth_password=query_params.get("hamqth_password", ""),
|
||||
hamqth_session_id=query_params.get("hamqth_session_id", ""),
|
||||
qrz_username=headers.get("X-QRZ-Username", ""),
|
||||
qrz_password=headers.get("X-QRZ-Password", ""),
|
||||
qrz_session_key=headers.get("X-QRZ-Session-Key", ""),
|
||||
hamqth_username=headers.get("X-HamQTH-Username", ""),
|
||||
hamqth_password=headers.get("X-HamQTH-Password", ""),
|
||||
hamqth_session_id=headers.get("X-HamQTH-Session-ID", ""),
|
||||
)
|
||||
has_qrz = creds.qrz_session_key or (creds.qrz_username and creds.qrz_password)
|
||||
has_hamqth = creds.hamqth_session_id or (creds.hamqth_username and creds.hamqth_password)
|
||||
|
||||
Reference in New Issue
Block a user