diff --git a/app/Transformers/Api/Client/ActivityLogTransformer.php b/app/Transformers/Api/Client/ActivityLogTransformer.php index 25a7562f8..c8345e26a 100644 --- a/app/Transformers/Api/Client/ActivityLogTransformer.php +++ b/app/Transformers/Api/Client/ActivityLogTransformer.php @@ -18,6 +18,10 @@ class ActivityLogTransformer extends BaseClientTransformer public function transform(ActivityLog $model): array { return [ + // This is not for security, it is only to provide a unique identifier to + // the front-end for each entry to improve rendering performance since there + // is nothing else sufficiently unique to key off at this point. + 'id' => sha1($model->id), 'batch' => $model->batch, 'event' => $model->event, 'is_api' => !is_null($model->api_key_id), diff --git a/resources/scripts/api/definitions/user/models.d.ts b/resources/scripts/api/definitions/user/models.d.ts index f42697eec..a5b40ca67 100644 --- a/resources/scripts/api/definitions/user/models.d.ts +++ b/resources/scripts/api/definitions/user/models.d.ts @@ -20,6 +20,7 @@ interface SSHKey extends Model { } interface ActivityLog extends Model<'actor'> { + id: string; batch: UUID | null; event: string; ip: string | null; diff --git a/resources/scripts/api/definitions/user/transformers.ts b/resources/scripts/api/definitions/user/transformers.ts index bc747a936..1fa62d3f9 100644 --- a/resources/scripts/api/definitions/user/transformers.ts +++ b/resources/scripts/api/definitions/user/transformers.ts @@ -31,6 +31,7 @@ export default class Transformers { const { actor } = attributes.relationships || {}; return { + id: attributes.id, batch: attributes.batch, event: attributes.event, ip: attributes.ip, diff --git a/resources/scripts/components/dashboard/activity/ActivityLogContainer.tsx b/resources/scripts/components/dashboard/activity/ActivityLogContainer.tsx index 60d486111..f10701f81 100644 --- a/resources/scripts/components/dashboard/activity/ActivityLogContainer.tsx +++ b/resources/scripts/components/dashboard/activity/ActivityLogContainer.tsx @@ -49,7 +49,7 @@ export default () => { ) : (