- Notifications
You must be signed in to change notification settings - Fork10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
ASP.NET Core Identity adds a new table for passkeys in .NET 10 called AspNetUserPasskeys by default and the primary key for this table is set to have a max length of 1024. This results in a warning when creating the table in SQL Server because the maximum key length for clustered indexes is 900 bytes:
Warning! The maximum key length for a clustered index is 900 bytes. The index 'PK_AspNetUserPasskeys' has maximum length of 1024 bytes. For some combination of large values, the insert/update operation will fail.Expected Behavior
I'm not sure what the best solution would be but I expected the primary key to have a smaller max length than the maximum so that inserts/updates can't fail for large passkeys. So if the CredentialId can't be smaller than 1024 bytes because of the WebAuthn spec then perhaps another column should've been used as the primary key?
Steps To Reproduce
Configure EF Core with SqlServer and add Identity with IdentitySchemaVersions.Version3 and the initial migration will then add the AspNetUserPasskeys table with a primary key that's too large:
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(connectionString));builder.Services.AddDatabaseDeveloperPageExceptionFilter();builder.Services.AddDefaultIdentity<IdentityUser>(options => { options.SignIn.RequireConfirmedAccount = true; options.Stores.SchemaVersion = IdentitySchemaVersions.Version3;}) .AddEntityFrameworkStores<ApplicationDbContext>();Exceptions (if any)
No response
.NET Version
10.0.100
Anything else?
No response