mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: added audit logs
This commit is contained in:
@@ -166,7 +166,10 @@ export enum EventType {
|
|||||||
CREATE_CERTIFICATE_TEMPLATE = "create-certificate-template",
|
CREATE_CERTIFICATE_TEMPLATE = "create-certificate-template",
|
||||||
UPDATE_CERTIFICATE_TEMPLATE = "update-certificate-template",
|
UPDATE_CERTIFICATE_TEMPLATE = "update-certificate-template",
|
||||||
DELETE_CERTIFICATE_TEMPLATE = "delete-certificate-template",
|
DELETE_CERTIFICATE_TEMPLATE = "delete-certificate-template",
|
||||||
GET_CERTIFICATE_TEMPLATE = "get-certificate-template"
|
GET_CERTIFICATE_TEMPLATE = "get-certificate-template",
|
||||||
|
CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG = "create-certificate-template-est-config",
|
||||||
|
UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG = "update-certificate-template-est-config",
|
||||||
|
GET_CERTIFICATE_TEMPLATE_EST_CONFIG = "get-certificate-template-est-config"
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UserActorMetadata {
|
interface UserActorMetadata {
|
||||||
@@ -1420,6 +1423,29 @@ interface OrgAdminAccessProjectEvent {
|
|||||||
}; // no metadata yet
|
}; // no metadata yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CreateCertificateTemplateEstConfig {
|
||||||
|
type: EventType.CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
isEnabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UpdateCertificateTemplateEstConfig {
|
||||||
|
type: EventType.UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
isEnabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetCertificateTemplateEstConfig {
|
||||||
|
type: EventType.GET_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export type Event =
|
export type Event =
|
||||||
| GetSecretsEvent
|
| GetSecretsEvent
|
||||||
| GetSecretEvent
|
| GetSecretEvent
|
||||||
@@ -1547,4 +1573,7 @@ export type Event =
|
|||||||
| CreateCertificateTemplate
|
| CreateCertificateTemplate
|
||||||
| UpdateCertificateTemplate
|
| UpdateCertificateTemplate
|
||||||
| GetCertificateTemplate
|
| GetCertificateTemplate
|
||||||
| DeleteCertificateTemplate;
|
| DeleteCertificateTemplate
|
||||||
|
| CreateCertificateTemplateEstConfig
|
||||||
|
| UpdateCertificateTemplateEstConfig
|
||||||
|
| GetCertificateTemplateEstConfig;
|
||||||
|
|||||||
@@ -241,6 +241,18 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
...req.body
|
...req.body
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: estConfig.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG,
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: estConfig.certificateTemplateId,
|
||||||
|
isEnabled: estConfig.isEnabled as boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return estConfig;
|
return estConfig;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -276,6 +288,18 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
...req.body
|
...req.body
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: estConfig.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG,
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: estConfig.certificateTemplateId,
|
||||||
|
isEnabled: estConfig.isEnabled as boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return estConfig;
|
return estConfig;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -308,6 +332,17 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
actorOrgId: req.permission.orgId
|
actorOrgId: req.permission.orgId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: estConfig.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.GET_CERTIFICATE_TEMPLATE_EST_CONFIG,
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: estConfig.certificateTemplateId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return estConfig;
|
return estConfig;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ export const certificateTemplateServiceFactory = ({
|
|||||||
isEnabled
|
isEnabled
|
||||||
});
|
});
|
||||||
|
|
||||||
return estConfig;
|
return { ...estConfig, projectId: certTemplate.projectId };
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateEstConfiguration = async ({
|
const updateEstConfiguration = async ({
|
||||||
@@ -331,7 +331,7 @@ export const certificateTemplateServiceFactory = ({
|
|||||||
|
|
||||||
const estConfig = await certificateTemplateEstConfigDAL.updateById(originalCaEstConfig.id, updatedData);
|
const estConfig = await certificateTemplateEstConfigDAL.updateById(originalCaEstConfig.id, updatedData);
|
||||||
|
|
||||||
return estConfig;
|
return { ...estConfig, projectId: certTemplate.projectId };
|
||||||
};
|
};
|
||||||
|
|
||||||
const getEstConfiguration = async (dto: TGetEstConfigurationDTO) => {
|
const getEstConfiguration = async (dto: TGetEstConfigurationDTO) => {
|
||||||
@@ -388,7 +388,8 @@ export const certificateTemplateServiceFactory = ({
|
|||||||
id: estConfig.id,
|
id: estConfig.id,
|
||||||
isEnabled: estConfig.isEnabled,
|
isEnabled: estConfig.isEnabled,
|
||||||
caChain: decryptedCaChain.toString(),
|
caChain: decryptedCaChain.toString(),
|
||||||
hashedPassphrase: estConfig.hashedPassphrase
|
hashedPassphrase: estConfig.hashedPassphrase,
|
||||||
|
projectId: certTemplate.projectId
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ export const eventToNameMap: { [K in EventType]: string } = {
|
|||||||
[EventType.CREATE_CERTIFICATE_TEMPLATE]: "Create certificate template",
|
[EventType.CREATE_CERTIFICATE_TEMPLATE]: "Create certificate template",
|
||||||
[EventType.UPDATE_CERTIFICATE_TEMPLATE]: "Update certificate template",
|
[EventType.UPDATE_CERTIFICATE_TEMPLATE]: "Update certificate template",
|
||||||
[EventType.DELETE_CERTIFICATE_TEMPLATE]: "Delete certificate template",
|
[EventType.DELETE_CERTIFICATE_TEMPLATE]: "Delete certificate template",
|
||||||
[EventType.GET_CERTIFICATE_TEMPLATE]: "Get certificate template"
|
[EventType.GET_CERTIFICATE_TEMPLATE]: "Get certificate template",
|
||||||
|
[EventType.GET_CERTIFICATE_TEMPLATE_EST_CONFIG]: "Get certificate template EST configuration",
|
||||||
|
[EventType.CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG]:
|
||||||
|
"Create certificate template EST configuration",
|
||||||
|
[EventType.UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG]:
|
||||||
|
"Update certificate template EST configuration"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const userAgentTTypeoNameMap: { [K in UserAgentType]: string } = {
|
export const userAgentTTypeoNameMap: { [K in UserAgentType]: string } = {
|
||||||
|
|||||||
@@ -86,5 +86,8 @@ export enum EventType {
|
|||||||
CREATE_CERTIFICATE_TEMPLATE = "create-certificate-template",
|
CREATE_CERTIFICATE_TEMPLATE = "create-certificate-template",
|
||||||
UPDATE_CERTIFICATE_TEMPLATE = "update-certificate-template",
|
UPDATE_CERTIFICATE_TEMPLATE = "update-certificate-template",
|
||||||
DELETE_CERTIFICATE_TEMPLATE = "delete-certificate-template",
|
DELETE_CERTIFICATE_TEMPLATE = "delete-certificate-template",
|
||||||
GET_CERTIFICATE_TEMPLATE = "get-certificate-template"
|
GET_CERTIFICATE_TEMPLATE = "get-certificate-template",
|
||||||
|
CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG = "create-certificate-template-est-config",
|
||||||
|
UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG = "update-certificate-template-est-config",
|
||||||
|
GET_CERTIFICATE_TEMPLATE_EST_CONFIG = "get-certificate-template-est-config"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -719,6 +719,29 @@ interface DeleteCertificateTemplate {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CreateCertificateTemplateEstConfig {
|
||||||
|
type: EventType.CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
isEnabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UpdateCertificateTemplateEstConfig {
|
||||||
|
type: EventType.UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
isEnabled: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetCertificateTemplateEstConfig {
|
||||||
|
type: EventType.GET_CERTIFICATE_TEMPLATE_EST_CONFIG;
|
||||||
|
metadata: {
|
||||||
|
certificateTemplateId: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export type Event =
|
export type Event =
|
||||||
| GetSecretsEvent
|
| GetSecretsEvent
|
||||||
| GetSecretEvent
|
| GetSecretEvent
|
||||||
@@ -791,7 +814,10 @@ export type Event =
|
|||||||
| CreateCertificateTemplate
|
| CreateCertificateTemplate
|
||||||
| UpdateCertificateTemplate
|
| UpdateCertificateTemplate
|
||||||
| GetCertificateTemplate
|
| GetCertificateTemplate
|
||||||
| DeleteCertificateTemplate;
|
| DeleteCertificateTemplate
|
||||||
|
| UpdateCertificateTemplateEstConfig
|
||||||
|
| CreateCertificateTemplateEstConfig
|
||||||
|
| GetCertificateTemplateEstConfig;
|
||||||
|
|
||||||
export type AuditLog = {
|
export type AuditLog = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -428,6 +428,20 @@ export const LogsTableRow = ({ auditLog }: Props) => {
|
|||||||
<p>{`Certificate Template ID: ${event.metadata.certificateTemplateId}`}</p>
|
<p>{`Certificate Template ID: ${event.metadata.certificateTemplateId}`}</p>
|
||||||
</Td>
|
</Td>
|
||||||
);
|
);
|
||||||
|
case EventType.CREATE_CERTIFICATE_TEMPLATE_EST_CONFIG:
|
||||||
|
case EventType.UPDATE_CERTIFICATE_TEMPLATE_EST_CONFIG:
|
||||||
|
return (
|
||||||
|
<Td>
|
||||||
|
<p>{`Certificate Template ID: ${event.metadata.certificateTemplateId}`}</p>
|
||||||
|
<p>{`Enabled: ${event.metadata.isEnabled}`}</p>
|
||||||
|
</Td>
|
||||||
|
);
|
||||||
|
case EventType.GET_CERTIFICATE_TEMPLATE_EST_CONFIG:
|
||||||
|
return (
|
||||||
|
<Td>
|
||||||
|
<p>{`Certificate Template ID: ${event.metadata.certificateTemplateId}`}</p>
|
||||||
|
</Td>
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return <Td />;
|
return <Td />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user