Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add UpdatedByUserId column to manifests (#2159)

Leendert de Borst4f2c50c2c729
diff --git a/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs b/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs
index 1ae8fe874..90ac97e23 100644
--- a/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs
+++ b/apps/server/AliasVault.Api/Controllers/V1/VaultController.cs
@@ -191,6 +191,7 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbCont
currentManifest.CredentialsCount = model.CredentialsCount;
currentManifest.EmailClaimsCount = model.EmailAddressList.Count;
currentManifest.Client = ClientHeader;
+ currentManifest.UpdatedByUserId = user.Id;
currentManifest.CreatedAt = timeProvider.UtcNow;
currentManifest.UpdatedAt = timeProvider.UtcNow;
@@ -292,6 +293,7 @@ public class VaultController(ILogger<VaultController> logger, IAliasServerDbCont
currentManifest.EncryptionType = Defaults.EncryptionType;
currentManifest.EncryptionSettings = Defaults.EncryptionSettings;
currentManifest.Client = ClientHeader;
+ currentManifest.UpdatedByUserId = user.Id;
currentManifest.CreatedAt = timeProvider.UtcNow;
currentManifest.UpdatedAt = timeProvider.UtcNow;
diff --git a/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs b/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs
index d32933ece..d3259ca41 100644
--- a/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs
+++ b/apps/server/AliasVault.Api/Controllers/V2/VaultController.cs
@@ -438,6 +438,7 @@ public class VaultController(
row.FileSize = FileHelper.BytesToKilobytes(row.ManifestBlob.Length);
row.CredentialsCount = mw.CredentialsCount;
row.Client = ClientHeader;
+ row.UpdatedByUserId = user.Id;
row.UpdatedAt = timeProvider.UtcNow;
// Every manifest counts the aliases the push filed against it, shared manifests included. One
diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
index d45686d32..c42e7fc3a 100644
--- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
+++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs
@@ -404,6 +404,11 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(e => e.OwnerGroupId);
+
+ builder.HasOne(e => e.UpdatedByUser)
+ .WithMany()
+ .HasForeignKey(e => e.UpdatedByUserId)
+ .OnDelete(DeleteBehavior.SetNull);
});
// Configure VaultManifestsHistory - superseded revisions, composite key (ManifestId, RevisionNumber).
@@ -415,6 +420,10 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon
.WithMany()
.HasForeignKey(e => e.ManifestId)
.OnDelete(DeleteBehavior.Cascade);
+ builder.HasOne(e => e.UpdatedByUser)
+ .WithMany()
+ .HasForeignKey(e => e.UpdatedByUserId)
+ .OnDelete(DeleteBehavior.SetNull);
});
// Configure VaultManifestAccessKey: a per-(holder, manifest) encrypted-VEK access path (AccountKey row or grant).
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
index 713c1a768..9223ffd5e 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
@@ -1176,6 +1176,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1191,6 +1195,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1349,6 +1355,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1362,6 +1372,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1683,7 +1695,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -1723,7 +1742,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs
index 10f7fc3e3..b407bd83b 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs
@@ -162,6 +162,7 @@ namespace AliasServerDb.Migrations
migrationBuilder.AddColumn<byte[]>(name: "ManifestBlob", table: "VaultManifests", type: "bytea", nullable: true);
migrationBuilder.AddColumn<string>(name: "ManifestCiphertextHash", table: "VaultManifests", type: "character varying(64)", maxLength: 64, nullable: true);
migrationBuilder.AddColumn<int>(name: "KeyVersion", table: "VaultManifests", type: "integer", nullable: false, defaultValue: 0);
+ migrationBuilder.AddColumn<string>(name: "UpdatedByUserId", table: "VaultManifests", type: "character varying(255)", maxLength: 255, nullable: true);
// A manifest-v1 revision carries no vault blob and no SRP credentials, so the columns that only the legacy
// sqlite-blob format fills become nullable. NULL is the sole "not applicable" marker; the empty string is not.
@@ -194,6 +195,7 @@ namespace AliasServerDb.Migrations
CredentialsCount = table.Column<int>(type: "integer", nullable: false),
EmailClaimsCount = table.Column<int>(type: "integer", nullable: false),
Client = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
+ UpdatedByUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
VaultBlob = table.Column<string>(type: "text", nullable: true),
@@ -263,6 +265,8 @@ namespace AliasServerDb.Migrations
migrationBuilder.AddPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests", column: "ManifestId");
migrationBuilder.CreateIndex(name: "IX_VaultManifests_OwnerGroupId", table: "VaultManifests", column: "OwnerGroupId");
+ migrationBuilder.CreateIndex(name: "IX_VaultManifests_UpdatedByUserId", table: "VaultManifests", column: "UpdatedByUserId");
+ migrationBuilder.CreateIndex(name: "IX_VaultManifestsHistory_UpdatedByUserId", table: "VaultManifestsHistory", column: "UpdatedByUserId");
migrationBuilder.AddForeignKey(
name: "FK_VaultManifests_Groups_OwnerGroupId",
@@ -279,6 +283,22 @@ namespace AliasServerDb.Migrations
principalTable: "VaultManifests",
principalColumn: "ManifestId",
onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VaultManifests_AliasVaultUsers_UpdatedByUserId",
+ table: "VaultManifests",
+ column: "UpdatedByUserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.SetNull);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VaultManifestsHistory_AliasVaultUsers_UpdatedByUserId",
+ table: "VaultManifestsHistory",
+ column: "UpdatedByUserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.SetNull);
}
/// <summary>
@@ -391,16 +411,10 @@ namespace AliasServerDb.Migrations
/// <param name="migrationBuilder">Migration builder.</param>
private static void AddAlgorithmToPublicKeys(MigrationBuilder migrationBuilder)
{
- migrationBuilder.AddColumn<string>(name: "Algorithm", table: "VaultManifestDeliveryKeys", type: "character varying(30)", maxLength: 30, nullable: true);
- migrationBuilder.AddColumn<string>(name: "Algorithm", table: "MobileLoginRequests", type: "character varying(30)", maxLength: 30, nullable: true);
-
- migrationBuilder.Sql("""
- UPDATE "VaultManifestDeliveryKeys" SET "Algorithm" = 'rsa-oaep-sha256';
- UPDATE "MobileLoginRequests" SET "Algorithm" = 'rsa-oaep-sha256';
- """);
-
- migrationBuilder.AlterColumn<string>(name: "Algorithm", table: "VaultManifestDeliveryKeys", type: "character varying(30)", maxLength: 30, nullable: false, oldClrType: typeof(string), oldType: "character varying(30)", oldMaxLength: 30, oldNullable: true);
- migrationBuilder.AlterColumn<string>(name: "Algorithm", table: "MobileLoginRequests", type: "character varying(30)", maxLength: 30, nullable: false, oldClrType: typeof(string), oldType: "character varying(30)", oldMaxLength: 30, oldNullable: true);
+ migrationBuilder.AddColumn<string>(name: "Algorithm", table: "VaultManifestDeliveryKeys", type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "rsa-oaep-sha256");
+ migrationBuilder.AddColumn<string>(name: "Algorithm", table: "MobileLoginRequests", type: "character varying(30)", maxLength: 30, nullable: false, defaultValue: "rsa-oaep-sha256");
+ migrationBuilder.AlterColumn<string>(name: "Algorithm", table: "VaultManifestDeliveryKeys", type: "character varying(30)", maxLength: 30, nullable: false, oldClrType: typeof(string), oldType: "character varying(30)", oldMaxLength: 30, oldDefaultValue: "rsa-oaep-sha256");
+ migrationBuilder.AlterColumn<string>(name: "Algorithm", table: "MobileLoginRequests", type: "character varying(30)", maxLength: 30, nullable: false, oldClrType: typeof(string), oldType: "character varying(30)", oldMaxLength: 30, oldDefaultValue: "rsa-oaep-sha256");
}
/// <summary>
@@ -829,8 +843,11 @@ namespace AliasServerDb.Migrations
/// <param name="migrationBuilder">Migration builder.</param>
private static void RestoreManifestsToVaults(MigrationBuilder migrationBuilder)
{
+ migrationBuilder.DropForeignKey(name: "FK_VaultManifestsHistory_AliasVaultUsers_UpdatedByUserId", table: "VaultManifestsHistory");
+ migrationBuilder.DropForeignKey(name: "FK_VaultManifests_AliasVaultUsers_UpdatedByUserId", table: "VaultManifests");
migrationBuilder.DropForeignKey(name: "FK_VaultManifestsHistory_VaultManifests_ManifestId", table: "VaultManifestsHistory");
migrationBuilder.DropForeignKey(name: "FK_VaultManifests_Groups_OwnerGroupId", table: "VaultManifests");
+ migrationBuilder.DropIndex(name: "IX_VaultManifests_UpdatedByUserId", table: "VaultManifests");
migrationBuilder.DropIndex(name: "IX_VaultManifests_OwnerGroupId", table: "VaultManifests");
// A shared manifest has no owning user, so there is no "Vaults" row it can become.
@@ -868,6 +885,7 @@ namespace AliasServerDb.Migrations
migrationBuilder.DropColumn(name: "StorageFormat", table: "VaultManifests");
migrationBuilder.DropColumn(name: "ManifestBlob", table: "VaultManifests");
migrationBuilder.DropColumn(name: "ManifestCiphertextHash", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "UpdatedByUserId", table: "VaultManifests");
// The pre-manifest schema has no "not applicable" marker: an unset column reads as the empty string.
migrationBuilder.Sql("""
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.Designer.cs
index 7e75d803f..9a13b2f0a 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.Designer.cs
@@ -1201,6 +1201,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1216,6 +1220,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1374,6 +1380,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1387,6 +1397,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1683,7 +1695,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -1723,7 +1742,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.cs
index d9270c874..5425227aa 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810154523_EmailMultiManifestAndStorageV2.cs
@@ -51,18 +51,6 @@ namespace AliasServerDb.Migrations
constraints: table =>
{
table.PrimaryKey("PK_EmailClaimLinks", x => new { x.EmailClaimId, x.VaultManifestId });
- table.ForeignKey(
- name: "FK_EmailClaimLinks_EmailClaims_EmailClaimId",
- column: x => x.EmailClaimId,
- principalTable: "EmailClaims",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_EmailClaimLinks_VaultManifests_VaultManifestId",
- column: x => x.VaultManifestId,
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
@@ -76,20 +64,16 @@ namespace AliasServerDb.Migrations
constraints: table =>
{
table.PrimaryKey("PK_EmailDecryptionKeys", x => new { x.EmailId, x.VaultManifestDeliveryKeyId });
- table.ForeignKey(
- name: "FK_EmailDecryptionKeys_Emails_EmailId",
- column: x => x.EmailId,
- principalTable: "Emails",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId",
- column: x => x.VaultManifestDeliveryKeyId,
- principalTable: "VaultManifestDeliveryKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
});
+ migrationBuilder.Sql("""
+ INSERT INTO "EmailDecryptionKeys" ("EmailId", "VaultManifestDeliveryKeyId", "EncryptedSymmetricKey")
+ SELECT "Id", "EncryptionKeyId", "EncryptedSymmetricKey" FROM "Emails";
+
+ INSERT INTO "EmailClaimLinks" ("EmailClaimId", "VaultManifestId", "State")
+ SELECT "Id", "VaultManifestId", CASE WHEN "Disabled" THEN 'Removed' ELSE 'Active' END FROM "EmailClaims" WHERE "VaultManifestId" IS NOT NULL;
+ """);
+
migrationBuilder.CreateIndex(
name: "IX_EmailClaimLinks_VaultManifestId_EmailClaimId",
table: "EmailClaimLinks",
@@ -100,16 +84,37 @@ namespace AliasServerDb.Migrations
table: "EmailDecryptionKeys",
columns: new[] { "VaultManifestDeliveryKeyId", "EmailId" });
- // Every existing email gets exactly one decryption key (its current key), every claim one link (its current
- // manifest). A tombstoned claim (VaultManifestId already null) simply gets zero links. A disabled claim
- // kept its manifest reference purely as an ownership record, which is what 'Removed' now indicates.
- migrationBuilder.Sql("""
- INSERT INTO "EmailDecryptionKeys" ("EmailId", "VaultManifestDeliveryKeyId", "EncryptedSymmetricKey")
- SELECT "Id", "EncryptionKeyId", "EncryptedSymmetricKey" FROM "Emails";
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmailClaimLinks_EmailClaims_EmailClaimId",
+ table: "EmailClaimLinks",
+ column: "EmailClaimId",
+ principalTable: "EmailClaims",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
- INSERT INTO "EmailClaimLinks" ("EmailClaimId", "VaultManifestId", "State")
- SELECT "Id", "VaultManifestId", CASE WHEN "Disabled" THEN 'Removed' ELSE 'Active' END FROM "EmailClaims" WHERE "VaultManifestId" IS NOT NULL;
- """);
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmailClaimLinks_VaultManifests_VaultManifestId",
+ table: "EmailClaimLinks",
+ column: "VaultManifestId",
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmailDecryptionKeys_Emails_EmailId",
+ table: "EmailDecryptionKeys",
+ column: "EmailId",
+ principalTable: "Emails",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmailDecryptionKeys_VaultManifestDeliveryKeys_DeliveryKeyId",
+ table: "EmailDecryptionKeys",
+ column: "VaultManifestDeliveryKeyId",
+ principalTable: "VaultManifestDeliveryKeys",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
migrationBuilder.DropForeignKey(name: "FK_EmailClaims_VaultManifests_VaultManifestId", table: "EmailClaims");
migrationBuilder.DropForeignKey(name: "FK_Emails_VaultManifestDeliveryKeys_EncryptionKeyId", table: "Emails");
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.Designer.cs
index cad9f2044..2d3ab5487 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.Designer.cs
@@ -1201,6 +1201,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1216,6 +1220,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1374,6 +1380,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1387,6 +1397,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1683,7 +1695,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -1723,7 +1742,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.cs b/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.cs
index df2fa457a..a365db748 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260817222545_ReorderTableColumns.cs
@@ -66,7 +66,9 @@ namespace AliasServerDb.Migrations
ALTER TABLE "VaultDataBuckets" DROP CONSTRAINT "FK_VaultDataBuckets_VaultManifests_ManifestId";
ALTER TABLE "VaultManifestAccessKeys" DROP CONSTRAINT "FK_VaultManifestAccessKeys_AliasVaultUsers_UserId";
ALTER TABLE "VaultManifestDeliveryKeys" DROP CONSTRAINT "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId";
+ ALTER TABLE "VaultManifests" DROP CONSTRAINT "FK_VaultManifests_AliasVaultUsers_UpdatedByUserId";
ALTER TABLE "VaultManifests" DROP CONSTRAINT "FK_VaultManifests_Groups_OwnerGroupId";
+ ALTER TABLE "VaultManifestsHistory" DROP CONSTRAINT "FK_VaultManifestsHistory_AliasVaultUsers_UpdatedByUserId";
ALTER TABLE "VaultManifestsHistory" DROP CONSTRAINT "FK_VaultManifestsHistory_VaultManifests_ManifestId";
""");
}
@@ -290,6 +292,7 @@ namespace AliasServerDb.Migrations
"CredentialsCount" integer NOT NULL,
"EmailClaimsCount" integer NOT NULL,
"Client" character varying(255),
+ "UpdatedByUserId" character varying(255),
"CreatedAt" timestamp with time zone NOT NULL,
"UpdatedAt" timestamp with time zone NOT NULL,
"VaultBlob" text,
@@ -302,8 +305,8 @@ namespace AliasServerDb.Migrations
ALTER TABLE "VaultManifests_reordered" ALTER COLUMN "ManifestBlob" SET STORAGE EXTERNAL;
- INSERT INTO "VaultManifests_reordered" ("ManifestId", "OwnerGroupId", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "KeyVersion", "RevisionNumber", "FileSize", "CredentialsCount", "EmailClaimsCount", "Client", "CreatedAt", "UpdatedAt", "VaultBlob", "Version", "Salt", "Verifier", "EncryptionType", "EncryptionSettings")
- SELECT "ManifestId", "OwnerGroupId", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "KeyVersion", "RevisionNumber", "FileSize", "CredentialsCount", "EmailClaimsCount", "Client", "CreatedAt", "UpdatedAt", "VaultBlob", "Version", "Salt", "Verifier", "EncryptionType", "EncryptionSettings"
+ INSERT INTO "VaultManifests_reordered" ("ManifestId", "OwnerGroupId", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "KeyVersion", "RevisionNumber", "FileSize", "CredentialsCount", "EmailClaimsCount", "Client", "UpdatedByUserId", "CreatedAt", "UpdatedAt", "VaultBlob", "Version", "Salt", "Verifier", "EncryptionType", "EncryptionSettings")
+ SELECT "ManifestId", "OwnerGroupId", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "KeyVersion", "RevisionNumber", "FileSize", "CredentialsCount", "EmailClaimsCount", "Client", "UpdatedByUserId", "CreatedAt", "UpdatedAt", "VaultBlob", "Version", "Salt", "Verifier", "EncryptionType", "EncryptionSettings"
FROM "VaultManifests";
DROP TABLE "VaultManifests";
@@ -311,6 +314,7 @@ namespace AliasServerDb.Migrations
ALTER TABLE "VaultManifests" ADD CONSTRAINT "PK_VaultManifests" PRIMARY KEY ("ManifestId");
CREATE INDEX "IX_VaultManifests_OwnerGroupId" ON "VaultManifests" ("OwnerGroupId");
+ CREATE INDEX "IX_VaultManifests_UpdatedByUserId" ON "VaultManifests" ("UpdatedByUserId");
""");
}
@@ -372,7 +376,9 @@ namespace AliasServerDb.Migrations
ALTER TABLE "VaultDataBuckets" ADD CONSTRAINT "FK_VaultDataBuckets_VaultManifests_ManifestId" FOREIGN KEY ("ManifestId") REFERENCES "VaultManifests"("ManifestId") ON DELETE CASCADE;
ALTER TABLE "VaultManifestAccessKeys" ADD CONSTRAINT "FK_VaultManifestAccessKeys_AliasVaultUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AliasVaultUsers"("Id") ON DELETE CASCADE;
ALTER TABLE "VaultManifestDeliveryKeys" ADD CONSTRAINT "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId" FOREIGN KEY ("VaultManifestId") REFERENCES "VaultManifests"("ManifestId") ON DELETE CASCADE;
+ ALTER TABLE "VaultManifests" ADD CONSTRAINT "FK_VaultManifests_AliasVaultUsers_UpdatedByUserId" FOREIGN KEY ("UpdatedByUserId") REFERENCES "AliasVaultUsers"("Id") ON DELETE SET NULL;
ALTER TABLE "VaultManifests" ADD CONSTRAINT "FK_VaultManifests_Groups_OwnerGroupId" FOREIGN KEY ("OwnerGroupId") REFERENCES "Groups"("Id") ON DELETE CASCADE;
+ ALTER TABLE "VaultManifestsHistory" ADD CONSTRAINT "FK_VaultManifestsHistory_AliasVaultUsers_UpdatedByUserId" FOREIGN KEY ("UpdatedByUserId") REFERENCES "AliasVaultUsers"("Id") ON DELETE SET NULL;
ALTER TABLE "VaultManifestsHistory" ADD CONSTRAINT "FK_VaultManifestsHistory_VaultManifests_ManifestId" FOREIGN KEY ("ManifestId") REFERENCES "VaultManifests"("ManifestId") ON DELETE CASCADE;
""");
}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsClientActionsAndCapabilityRules.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsClientActionsAndCapabilityRules.Designer.cs
index 23f6c749f..8113929ef 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsClientActionsAndCapabilityRules.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260820120455_AddGroupInvitationsClientActionsAndCapabilityRules.Designer.cs
@@ -1386,6 +1386,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1401,6 +1405,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1579,6 +1585,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1592,6 +1602,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1956,7 +1968,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -2007,7 +2026,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260917154825_MobileLoginRequestVerification.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260917154825_MobileLoginRequestVerification.Designer.cs
index e6a9164bf..420741629 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260917154825_MobileLoginRequestVerification.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260917154825_MobileLoginRequestVerification.Designer.cs
@@ -1406,6 +1406,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1421,6 +1425,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1599,6 +1605,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1612,6 +1622,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1976,7 +1988,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -2027,7 +2046,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
index 8ed92f225..ef9479aaa 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextModelSnapshot.cs
@@ -1403,6 +1403,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1418,6 +1422,8 @@ namespace AliasServerDb.Migrations
b.HasIndex("OwnerGroupId");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifests");
});
@@ -1596,6 +1602,10 @@ namespace AliasServerDb.Migrations
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
+ b.Property<string>("UpdatedByUserId")
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)");
+
b.Property<string>("VaultBlob")
.HasColumnType("text");
@@ -1609,6 +1619,8 @@ namespace AliasServerDb.Migrations
b.HasKey("ManifestId", "RevisionNumber");
+ b.HasIndex("UpdatedByUserId");
+
b.ToTable("VaultManifestsHistory", (string)null);
});
@@ -1973,7 +1985,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("OwnerGroup");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
@@ -2024,7 +2043,14 @@ namespace AliasServerDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AliasServerDb.AliasVaultUser", "UpdatedByUser")
+ .WithMany()
+ .HasForeignKey("UpdatedByUserId")
+ .OnDelete(DeleteBehavior.SetNull);
+
b.Navigation("Manifest");
+
+ b.Navigation("UpdatedByUser");
});
modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
diff --git a/apps/server/Databases/AliasServerDb/VaultManifestBase.cs b/apps/server/Databases/AliasServerDb/VaultManifestBase.cs
index 3c72eb67d..f252938e6 100644
--- a/apps/server/Databases/AliasServerDb/VaultManifestBase.cs
+++ b/apps/server/Databases/AliasServerDb/VaultManifestBase.cs
@@ -125,6 +125,18 @@ public abstract class VaultManifestBase : IVaultRevision
[StringLength(255)]
public string? Client { get; set; }
+ /// <summary>
+ /// Gets or sets the user whose push wrote this revision. Null for legacy revisions.
+ /// </summary>
+ [StringLength(255)]
+ public string? UpdatedByUserId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the navigation property to the user whose push wrote this revision.
+ /// </summary>
+ [ForeignKey("UpdatedByUserId")]
+ public virtual AliasVaultUser? UpdatedByUser { get; set; }
+
/// <summary>
/// Gets or sets the timestamp at which this revision was created.
/// </summary>
@@ -164,6 +176,7 @@ public abstract class VaultManifestBase : IVaultRevision
EncryptionType = source.EncryptionType;
EncryptionSettings = source.EncryptionSettings;
Client = source.Client;
+ UpdatedByUserId = source.UpdatedByUserId;
CreatedAt = source.CreatedAt;
UpdatedAt = source.UpdatedAt;
}