generated from nhcarrigan/template
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:
+2
-2
@@ -22,8 +22,8 @@ export async function app(fastify: FastifyInstance, opts: AppOptions) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log unauthorized access attempts
|
// Log unauthorized access attempts (exclude /api/auth/me as 401s there are expected during token refresh)
|
||||||
if (error.statusCode === 401 || error.statusCode === 403) {
|
if ((error.statusCode === 401 || error.statusCode === 403) && request.url !== '/api/auth/me') {
|
||||||
await AuditService.log({
|
await AuditService.log({
|
||||||
action: AuditAction.unauthorizedAccess,
|
action: AuditAction.unauthorizedAccess,
|
||||||
category: AuditCategory.security,
|
category: AuditCategory.security,
|
||||||
|
|||||||
Reference in New Issue
Block a user