Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

greptile review fixes + schema generate

x0322056a7d84f05295
diff --git a/backend/src/db/schemas/pam-resources.ts b/backend/src/db/schemas/pam-resources.ts
index bc3d45fcb8..d34017d0fe 100644
--- a/backend/src/db/schemas/pam-resources.ts
+++ b/backend/src/db/schemas/pam-resources.ts
@@ -13,7 +13,7 @@ export const PamResourcesSchema = z.object({
id: z.string().uuid(),
projectId: z.string(),
name: z.string(),
- gatewayId: z.string(),
+ gatewayId: z.string().uuid(),
resourceType: z.string(),
encryptedConnectionDetails: zodBuffer,
createdAt: z.date(),
diff --git a/backend/src/db/schemas/pam-sessions.ts b/backend/src/db/schemas/pam-sessions.ts
index a35f01eaf8..12e4adfcff 100644
--- a/backend/src/db/schemas/pam-sessions.ts
+++ b/backend/src/db/schemas/pam-sessions.ts
@@ -23,7 +23,7 @@ export const PamSessionsSchema = z.object({
actorUserAgent: z.string(),
status: z.string(),
encryptedLogsBlob: zodBuffer.nullable().optional(),
- expiresAt: z.date().nullable().optional(),
+ expiresAt: z.date(),
startedAt: z.date().nullable().optional(),
endedAt: z.date().nullable().optional(),
createdAt: z.date(),
diff --git a/backend/src/ee/routes/v1/pam-session-router.ts b/backend/src/ee/routes/v1/pam-session-router.ts
index ac888b4365..6e60704da3 100644
--- a/backend/src/ee/routes/v1/pam-session-router.ts
+++ b/backend/src/ee/routes/v1/pam-session-router.ts
@@ -138,7 +138,8 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
event: {
type: EventType.PAM_SESSION_END,
metadata: {
- sessionId: req.params.sessionId
+ sessionId: req.params.sessionId,
+ accountName: session.accountName
}
}
});
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 6f46a4947f..bc50283d4d 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -3726,6 +3726,7 @@ interface PamSessionEndEvent {
type: EventType.PAM_SESSION_END;
metadata: {
sessionId: string;
+ accountName: string;
};
}
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index 2b2335281d..76fcfdd54f 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -405,6 +405,7 @@ export const pamAccountServiceFactory = ({
);
const user = await userDAL.findById(actor.id);
+ if (!user) throw new NotFoundError({ message: `User with ID '${actor.id}' not found` });
const gatewayConnectionDetails = await gatewayV2Service.getPAMConnectionDetails({
gatewayId,
diff --git a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
index b0f93110c9..80a50a9a4c 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
@@ -4,7 +4,7 @@ import { PamAccountsSchema, PamResourcesSchema } from "@app/db/schemas";
import { slugSchema } from "@app/server/lib/schemas";
// Resources
-export const BasePamResoureSchema = PamResourcesSchema.omit({
+export const BasePamResourceSchema = PamResourcesSchema.omit({
encryptedConnectionDetails: true,
resourceType: true
});
diff --git a/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts b/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
index 520443248c..a97e3f2e7e 100644
--- a/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
@@ -6,7 +6,7 @@ import {
BaseCreatePamResourceSchema,
BasePamAccountSchema,
BasePamAccountSchemaWithResource,
- BasePamResoureSchema,
+ BasePamResourceSchema,
BaseUpdatePamAccountSchema,
BaseUpdatePamResourceSchema
} from "../pam-resource-schemas";
@@ -18,7 +18,7 @@ import {
// Resources
export const PostgresResourceConnectionDetailsSchema = BaseSqlResourceConnectionDetailsSchema;
-const BasePostgresResourceSchema = BasePamResoureSchema.extend({ resourceType: z.literal(PamResource.Postgres) });
+const BasePostgresResourceSchema = BasePamResourceSchema.extend({ resourceType: z.literal(PamResource.Postgres) });
export const PostgresResourceSchema = BasePostgresResourceSchema.extend({
connectionDetails: PostgresResourceConnectionDetailsSchema