mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: added audit logs for kms backup and other minor edits
This commit is contained in:
@@ -281,7 +281,13 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
||||
projectId: req.params.workspaceId
|
||||
});
|
||||
|
||||
// TODO: add audit log
|
||||
await server.services.auditLog.createAuditLog({
|
||||
...req.auditLogInfo,
|
||||
projectId: req.params.workspaceId,
|
||||
event: {
|
||||
type: EventType.GET_PROJECT_KMS_BACKUP
|
||||
}
|
||||
});
|
||||
|
||||
return backup;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,8 @@ export enum EventType {
|
||||
UPDATE_KMS = "update-kms",
|
||||
DELETE_KMS = "delete-kms",
|
||||
GET_KMS = "get-kms",
|
||||
UPDATE_PROJECT_KMS = "update-project-kms"
|
||||
UPDATE_PROJECT_KMS = "update-project-kms",
|
||||
GET_PROJECT_KMS_BACKUP = "get-project-kms-backup"
|
||||
}
|
||||
|
||||
interface UserActorMetadata {
|
||||
@@ -1223,6 +1224,10 @@ interface UpdateProjectKmsEvent {
|
||||
};
|
||||
}
|
||||
|
||||
interface GetProjectKmsBackupEvent {
|
||||
type: EventType.GET_PROJECT_KMS_BACKUP;
|
||||
}
|
||||
|
||||
export type Event =
|
||||
| GetSecretsEvent
|
||||
| GetSecretEvent
|
||||
@@ -1329,4 +1334,5 @@ export type Event =
|
||||
| UpdateKmsEvent
|
||||
| DeleteKmsEvent
|
||||
| GetKmsEvent
|
||||
| UpdateProjectKmsEvent;
|
||||
| UpdateProjectKmsEvent
|
||||
| GetProjectKmsBackupEvent;
|
||||
|
||||
@@ -598,8 +598,8 @@ export const kmsServiceFactory = ({
|
||||
const kmsEncryptor = await encryptWithKmsKey({ kmsId: kmsKeyIdForEncrypt });
|
||||
const { cipherTextBlob: encryptedSecretManagerDataKey } = await kmsEncryptor({ plainText: secretManagerDataKey });
|
||||
|
||||
// format: projectId.kmsFunction.kmsId.Base64(encryptedDataKey)
|
||||
const secretManagerBackup = `${projectId}.secretManager.${kmsKeyIdForEncrypt}.${encryptedSecretManagerDataKey.toString(
|
||||
// format: version.projectId.kmsFunction.kmsId.Base64(encryptedDataKey)
|
||||
const secretManagerBackup = `v1.${projectId}.secretManager.${kmsKeyIdForEncrypt}.${encryptedSecretManagerDataKey.toString(
|
||||
"base64"
|
||||
)}`;
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ export const projectServiceFactory = ({
|
||||
const plan = await licenseService.getPlan(actorOrgId);
|
||||
if (!plan.externalKms) {
|
||||
throw new BadRequestError({
|
||||
message: "Failed to create KMS backup due to plan restriction. Upgrade to the enterprise plan."
|
||||
message: "Failed to get KMS backup due to plan restriction. Upgrade to the enterprise plan."
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ export const EncryptionTab = () => {
|
||||
|
||||
const { secretManager } = await fetchProjectKmsBackup(currentWorkspace.id);
|
||||
|
||||
const [, kmsFunction] = secretManager.split(".");
|
||||
const [, , kmsFunction] = secretManager.split(".");
|
||||
const file = secretManager;
|
||||
|
||||
const blob = new Blob([file], { type: "text/plain;charset=utf-8" });
|
||||
|
||||
Reference in New Issue
Block a user