Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add http events
Fang-Pen Lin73f2c2b2e5b1
diff --git a/backend/src/ee/routes/v1/pam-session-router.ts b/backend/src/ee/routes/v1/pam-session-router.tsindex 542fff2f4c..574b8b7c3d 100644--- a/backend/src/ee/routes/v1/pam-session-router.ts+++ b/backend/src/ee/routes/v1/pam-session-router.ts@@ -7,6 +7,7 @@ import { MySQLSessionCredentialsSchema } from "@app/ee/services/pam-resource/mysimport { PostgresSessionCredentialsSchema } from "@app/ee/services/pam-resource/postgres/postgres-resource-schemas";import { SSHSessionCredentialsSchema } from "@app/ee/services/pam-resource/ssh/ssh-resource-schemas";import {+ HttpEventSchema,PamSessionCommandLogSchema,SanitizedSessionSchema,TerminalEventSchema@@ -91,7 +92,7 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {sessionId: z.string().uuid()}),body: z.object({- logs: z.array(z.union([PamSessionCommandLogSchema, TerminalEventSchema]))+ logs: z.array(z.union([PamSessionCommandLogSchema, TerminalEventSchema, HttpEventSchema]))}),response: {200: z.object({diff --git a/backend/src/ee/services/pam-session/pam-session-schemas.ts b/backend/src/ee/services/pam-session/pam-session-schemas.tsindex db24931966..6b5b865df8 100644--- a/backend/src/ee/services/pam-session/pam-session-schemas.ts+++ b/backend/src/ee/services/pam-session/pam-session-schemas.ts@@ -11,6 +11,8 @@ export const PamSessionCommandLogSchema = z.object({// SSH Terminal Event schemasexport const TerminalEventTypeSchema = z.enum(["input", "output", "resize", "error"]);+export const HttpEventTypeSchema = z.enum(["request", "response"]);+export const TerminalEventSchema = z.object({timestamp: z.coerce.date(),eventType: TerminalEventTypeSchema,@@ -18,8 +20,30 @@ export const TerminalEventSchema = z.object({elapsedTime: z.number() // Seconds since session start (for replay)});+export const HttpBaseEventSchema = z.object({+ timestamp: z.coerce.date(),+ requestId: z.string(),+ eventType: TerminalEventTypeSchema,+ headers: z.record(z.string(), z.string())+});++export const HttpRequestEventSchema = HttpBaseEventSchema.extend({+ eventType: z.literal(HttpEventTypeSchema.Values.request),+ method: z.string(),+ url: z.string(),+ body: z.string()+});++export const HttpResponseEventSchema = HttpBaseEventSchema.extend({+ eventType: z.literal(HttpEventTypeSchema.Values.response),+ status: z.string(),+ body: z.string()+});++export const HttpEventSchema = z.discriminatedUnion("eventType", [HttpRequestEventSchema, HttpResponseEventSchema]);+export const SanitizedSessionSchema = PamSessionsSchema.omit({encryptedLogsBlob: true}).extend({- logs: z.array(z.union([PamSessionCommandLogSchema, TerminalEventSchema]))+ logs: z.array(z.union([PamSessionCommandLogSchema, TerminalEventSchema, HttpEventSchema]))});