From c795f4229078dc2db7af954d4ffc87c6eabf4a03 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 20 Jan 2026 18:52:59 -0500 Subject: [PATCH] fix(auth): handle list response from sql_select in dependencies_v3 - Check if api_key_results is a list before calling .get() - Prevents 500 AttributeError on machine auth verification --- app/routers/dependencies_v3.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/routers/dependencies_v3.py b/app/routers/dependencies_v3.py index 2e5b9d1..baeaaa6 100644 --- a/app/routers/dependencies_v3.py +++ b/app/routers/dependencies_v3.py @@ -34,7 +34,10 @@ def get_account_context_optional( # This identifies the script/app, regardless of the user/account context. if x_aether_api_key: sql = "SELECT * FROM api_key WHERE (public_key = :key OR secret_key = :key) LIMIT 1" - if api_key_rec := sql_select(sql=sql, data={'key': x_aether_api_key}): + if api_key_results := sql_select(sql=sql, data={'key': x_aether_api_key}): + # sql_select returns a list when raw SQL is used + api_key_rec = api_key_results[0] if isinstance(api_key_results, list) else api_key_results + if api_key_rec.get('enable'): now = datetime.now() enable_from = api_key_rec.get('enable_from')