From 1183a63e05bd402677fe94cf0f4b12abfee9e7e4 Mon Sep 17 00:00:00 2001 From: Zack Lee Date: Mon, 30 Sep 2024 19:07:21 +0900 Subject: [PATCH] Add 'System' Username to Audit Logs Generated with API Requests --- backend/packages/Upgrade/src/auth/AuthService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/packages/Upgrade/src/auth/AuthService.ts b/backend/packages/Upgrade/src/auth/AuthService.ts index 115ccd4eb0..68af28267e 100644 --- a/backend/packages/Upgrade/src/auth/AuthService.ts +++ b/backend/packages/Upgrade/src/auth/AuthService.ts @@ -44,10 +44,11 @@ export class AuthService { if (!tokenInfo || !serviceAccountIds.includes(tokenInfo.aud)) { throw new Error('Invalid or unauthorized access token'); } + payload = { + hd: env.google.domainName, + email: 'system@gmail.com', + }; request.logger.info({ message: 'Access token validated' }); - // For service account access tokens, we'll return null - // We might want to implement specific handling for service accounts here - return null; } catch (error) { request.logger.error(error); throw error;