Skip to content

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

Improve code quality

carlosmonastyrski0513307d9843
diff --git a/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts b/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
index 25237122bf..af1e2c85ad 100644
--- a/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
+++ b/backend/src/db/migrations/20250305131152_add-actor-id-to-secret-versions-v2.ts
@@ -3,49 +3,22 @@ import { Knex } from "knex";
import { TableName } from "@app/db/schemas";
export async function up(knex: Knex): Promise<void> {
- const hasSecretVersionV2UserActorId = await knex.schema.hasColumn(TableName.SecretVersionV2, "userActorId");
- const hasSecretVersionV2IdentityActorId = await knex.schema.hasColumn(TableName.SecretVersionV2, "identityActorId");
- const hasSecretVersionV2ActorType = await knex.schema.hasColumn(TableName.SecretVersionV2, "actorType");
-
- if (!hasSecretVersionV2UserActorId) {
+ if (!(await knex.schema.hasColumn(TableName.SecretVersionV2, "userActorId"))) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.uuid("userActorId");
t.foreign("userActorId").references("id").inTable(TableName.Users);
- });
- }
-
- if (!hasSecretVersionV2IdentityActorId) {
- await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.uuid("identityActorId");
t.foreign("identityActorId").references("id").inTable(TableName.Identity);
- });
- }
- if (!hasSecretVersionV2ActorType) {
- await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.string("actorType");
});
}
}
export async function down(knex: Knex): Promise<void> {
- const hasSecretVersionV2UserActorId = await knex.schema.hasColumn(TableName.SecretVersionV2, "userActorId");
- const hasSecretVersionV2IdentityActorId = await knex.schema.hasColumn(TableName.SecretVersionV2, "identityActorId");
- const hasSecretVersionV2ActorType = await knex.schema.hasColumn(TableName.SecretVersionV2, "actorType");
-
- if (hasSecretVersionV2UserActorId) {
+ if (await knex.schema.hasColumn(TableName.SecretVersionV2, "userActorId")) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("userActorId");
- });
- }
-
- if (hasSecretVersionV2IdentityActorId) {
- await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("identityActorId");
- });
- }
-
- if (hasSecretVersionV2ActorType) {
- await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("actorType");
});
}
diff --git a/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts b/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts
index 40ac4493fe..b057d81106 100644
--- a/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts
+++ b/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts
@@ -380,6 +380,7 @@ export const secretSnapshotServiceFactory = ({
envId,
id,
tags,
+ // exclude the bottom fields from the secret - they are for versioning only.
userActorId,
identityActorId,
actorType,