From 1878614c17043a1e6094b76e89b4ef81906145dd Mon Sep 17 00:00:00 2001 From: Mackenzie Halliday Date: Thu, 12 Dec 2024 16:02:30 -0500 Subject: [PATCH] Squash 1420 --- .talismanrc | 2 +- app/dao/api_key_dao.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.talismanrc b/.talismanrc index 6de2a12db1..565dfae0c0 100644 --- a/.talismanrc +++ b/.talismanrc @@ -14,7 +14,7 @@ fileignoreconfig: - filename: app/constants.py checksum: 44390d0a1258b184cf84dc9b6e97bd0768af84a9aa346ba963aa7735fc8bcb36 - filename: app/dao/api_key_dao.py - checksum: ab93313f306c8a3f6576141e8f32d9fc99b0de7da8d44a1ddbe6ea55d167dcdb + checksum: c44cbd8ae02fb1d551a1f0941365c11977564a6444950ee2b0282ee4b5fd1314 - filename: app/letters/utils.py checksum: 5e6071b9cab380f9f3ee172f8c731061241200f53453a9863f22bb5eaa05e6af - filename: app/notifications/process_notifications.py diff --git a/app/dao/api_key_dao.py b/app/dao/api_key_dao.py index 87b0aaba7b..1e1e8b8066 100644 --- a/app/dao/api_key_dao.py +++ b/app/dao/api_key_dao.py @@ -1,12 +1,12 @@ +import secrets import uuid from datetime import datetime, timedelta -from app import db -from app.models import ApiKey +from sqlalchemy import func, or_, select +from app import db from app.dao.dao_utils import transactional, version_class - -from sqlalchemy import or_, func, select +from app.models import ApiKey @transactional @@ -15,7 +15,7 @@ def save_model_api_key(api_key): if not api_key.id: api_key.id = uuid.uuid4() # must be set now so version history model can use same id if not api_key.secret: - api_key.secret = uuid.uuid4() + api_key.secret = secrets.token_urlsafe(64) db.session.add(api_key)