The Wayback Machine - https://web.archive.org/web/20211111004053/https://github.com/dotnet/aspnetcore/issues/38274
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in AddDataProtection from RC2 #38274

Open
jamesgurung opened this issue Nov 10, 2021 · 2 comments
Open

Regression in AddDataProtection from RC2 #38274

jamesgurung opened this issue Nov 10, 2021 · 2 comments

Comments

Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
@jamesgurung
Copy link

@jamesgurung jamesgurung commented Nov 10, 2021

I have a working app in ASP.NET Core 6 RC2. It stores data protection keys in Azure Blob Storage, and protects them with Key Vault:

builder.Services.AddDataProtection()
  .PersistKeysToAzureBlobStorage(new Uri(config["DataProtectionBlobUri"]))
  .ProtectKeysWithAzureKeyVault(
    new Uri(config["DataProtectionKey"]),
    new ClientSecretCredential(config["MicrosoftTenantId"], config["MicrosoftClientId"], config["MicrosoftClientSecret"])
  );

In the Dockerfile, if I change these lines:

FROM mcr.microsoft.com/dotnet/aspnet:6.0.0-rc.2 AS base
...
FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.2 AS build

to

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
...
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

Then the app still runs, but it seems not to be picking up the keys from Azure correctly. All existing cookies and encrypted strings are rejected (which possibly suggests that the existing keys are not found, and it's generating new random keys at runtime). Reverting to RC2 makes everything work again.

An example error message is, when trying to decrypt a string: The payload was invalid. For more information go to http://aka.ms/dataprotectionwarning

The package versions are:

  • Azure.Extensions.AspNetCore.DataProtection.Blobs v1.2.1
  • Azure.Extensions.AspNetCore.DataProtection.Keys v1.1.0
  • Azure.Storage.Blobs v12.10.0
@Tratcher
Copy link
Member

@Tratcher Tratcher commented Nov 10, 2021

Can you show how config is created in this example? Or show the whole Program.cs for completness? Is the config instance returning the expected values?

Loading

@jamesgurung
Copy link
Author

@jamesgurung jamesgurung commented Nov 10, 2021

Sorry, I should have said:

var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;

I can see that it's returning the right configuration values.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment