mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Add audit logs to project ssh config endpoints
This commit is contained in:
@@ -248,6 +248,8 @@ export enum EventType {
|
|||||||
DELETE_SLACK_INTEGRATION = "delete-slack-integration",
|
DELETE_SLACK_INTEGRATION = "delete-slack-integration",
|
||||||
GET_PROJECT_SLACK_CONFIG = "get-project-slack-config",
|
GET_PROJECT_SLACK_CONFIG = "get-project-slack-config",
|
||||||
UPDATE_PROJECT_SLACK_CONFIG = "update-project-slack-config",
|
UPDATE_PROJECT_SLACK_CONFIG = "update-project-slack-config",
|
||||||
|
GET_PROJECT_SSH_CONFIG = "get-project-ssh-config",
|
||||||
|
UPDATE_PROJECT_SSH_CONFIG = "update-project-ssh-config",
|
||||||
INTEGRATION_SYNCED = "integration-synced",
|
INTEGRATION_SYNCED = "integration-synced",
|
||||||
CREATE_CMEK = "create-cmek",
|
CREATE_CMEK = "create-cmek",
|
||||||
UPDATE_CMEK = "update-cmek",
|
UPDATE_CMEK = "update-cmek",
|
||||||
@@ -1986,6 +1988,25 @@ interface GetProjectSlackConfig {
|
|||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface GetProjectSshConfig {
|
||||||
|
type: EventType.GET_PROJECT_SSH_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
id: string;
|
||||||
|
projectId: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UpdateProjectSshConfig {
|
||||||
|
type: EventType.UPDATE_PROJECT_SSH_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
id: string;
|
||||||
|
projectId: string;
|
||||||
|
defaultUserSshCaId?: string | null;
|
||||||
|
defaultHostSshCaId?: string | null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface IntegrationSyncedEvent {
|
interface IntegrationSyncedEvent {
|
||||||
type: EventType.INTEGRATION_SYNCED;
|
type: EventType.INTEGRATION_SYNCED;
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -2670,6 +2691,8 @@ export type Event =
|
|||||||
| GetSlackIntegration
|
| GetSlackIntegration
|
||||||
| UpdateProjectSlackConfig
|
| UpdateProjectSlackConfig
|
||||||
| GetProjectSlackConfig
|
| GetProjectSlackConfig
|
||||||
|
| GetProjectSshConfig
|
||||||
|
| UpdateProjectSshConfig
|
||||||
| IntegrationSyncedEvent
|
| IntegrationSyncedEvent
|
||||||
| CreateCmekEvent
|
| CreateCmekEvent
|
||||||
| UpdateCmekEvent
|
| UpdateCmekEvent
|
||||||
|
|||||||
@@ -644,7 +644,17 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
projectId: req.params.workspaceId
|
projectId: req.params.workspaceId
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: consider adding audit logs
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: sshConfig.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.GET_PROJECT_SSH_CONFIG,
|
||||||
|
metadata: {
|
||||||
|
id: sshConfig.id,
|
||||||
|
projectId: sshConfig.projectId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return sshConfig;
|
return sshConfig;
|
||||||
}
|
}
|
||||||
@@ -654,7 +664,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
url: "/:workspaceId/ssh-config",
|
url: "/:workspaceId/ssh-config",
|
||||||
config: {
|
config: {
|
||||||
rateLimit: readLimit
|
rateLimit: writeLimit
|
||||||
},
|
},
|
||||||
schema: {
|
schema: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
@@ -686,6 +696,20 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
...req.body
|
...req.body
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: sshConfig.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.UPDATE_PROJECT_SSH_CONFIG,
|
||||||
|
metadata: {
|
||||||
|
id: sshConfig.id,
|
||||||
|
projectId: sshConfig.projectId,
|
||||||
|
defaultUserSshCaId: sshConfig.defaultUserSshCaId,
|
||||||
|
defaultHostSshCaId: sshConfig.defaultHostSshCaId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return sshConfig;
|
return sshConfig;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user