fix: omit audit log entries for 401s on /api/auth/me

Token expiry probes against /api/auth/me are expected behaviour during
the refresh flow and should not generate unauthorized access audit events.
This commit is contained in:
2026-02-23 20:09:36 -08:00
committed by Naomi Carrigan
parent fa4c1d8958
commit b81b77ac2f
+2 -2
View File
@@ -22,8 +22,8 @@ export async function app(fastify: FastifyInstance, opts: AppOptions) {
});
}
// Log unauthorized access attempts
if (error.statusCode === 401 || error.statusCode === 403) {
// Log unauthorized access attempts (exclude /api/auth/me as 401s there are expected during token refresh)
if ((error.statusCode === 401 || error.statusCode === 403) && request.url !== '/api/auth/me') {
await AuditService.log({
action: AuditAction.unauthorizedAccess,
category: AuditCategory.security,