Skip to content

Commit

Permalink
Merge pull request #2971 from Infisical/daniel/audit-log-timestamp-bug
Browse files Browse the repository at this point in the history
fix(audit-logs): time conversion bug
  • Loading branch information
DanielHougaard authored Jan 10, 2025
2 parents 4552ce6 + 17249d6 commit 662e79a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/ee/services/audit-log/audit-log-dal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export const auditLogDALFactory = (db: TDbClient) => {

// Filter by date range
if (startDate) {
void sqlQuery.where(`${TableName.AuditLog}.createdAt`, ">=", startDate);
void sqlQuery.whereRaw(`"${TableName.AuditLog}"."createdAt" >= ?::timestamptz`, [startDate]);
}
if (endDate) {
void sqlQuery.where(`${TableName.AuditLog}.createdAt`, "<=", endDate);
void sqlQuery.whereRaw(`"${TableName.AuditLog}"."createdAt" <= ?::timestamptz`, [endDate]);
}

// we timeout long running queries to prevent DB resource issues (2 minutes)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/hooks/api/auditLogs/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EventType, UserAgentType } from "./enums";
export const eventToNameMap: { [K in EventType]: string } = {
[EventType.GET_SECRETS]: "List secrets",
[EventType.GET_SECRET]: "Read secret",
[EventType.DELETE_SECRETS]: "Delete secrets",
[EventType.CREATE_SECRET]: "Create secret",
[EventType.UPDATE_SECRET]: "Update secret",
[EventType.DELETE_SECRET]: "Delete secret",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/hooks/api/auditLogs/enums.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export enum UserAgentType {

export enum EventType {
GET_SECRETS = "get-secrets",
DELETE_SECRETS = "delete-secrets",
GET_SECRET = "get-secret",
CREATE_SECRET = "create-secret",
UPDATE_SECRET = "update-secret",
Expand Down

0 comments on commit 662e79a

Please sign in to comment.