-
Notifications
You must be signed in to change notification settings - Fork 10.3k
EphemeralDataProtectionProvider isn't used by XmlKeyManager #54234
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
Comments
Another possible low-effort approach you can take today is to change the log level for these specific types when you're not concerned about their output: https://github.com/martincostello/dependabot-helper/blob/415acd4ddbad4ea5c615c39014c9a37d7fdf81c6/src/DependabotHelper/appsettings.json#L33 |
Yeah, we recognize that we could set logging for |
My point was mainly that there's easier options than implementing your own XML repository if it's bugging you. Another option is to use the https://www.nuget.org/packages/Amazon.AspNetCore.DataProtection.SSM package and have the Lambda not use ephemeral keys by reading/storing them in SSM. There's also a similar community package that uses S3, but that's been deprecated for a while. |
Thanks for the package link...I was unaware of it... |
This appears to express the same concern as #47410. Any objection to dup'ing against that issue? |
I'm taking that as "no objection". |
Is there an existing issue for this?
Describe the bug
Was noticing the following warning messages, from
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager
in the logs for our C# API application running as an AWS Lambda FunctionThis issue, Explicitly specifying UseEphemeralDataProtectionProvider should NOT log a warning
And this issue An error occurred while reading the key ring
Along with the documentation
Led us to expect that adding
builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider();
Would get rid of the Warnings, however it had no effect.
I'm no expert, but looking at the code it seems that
XmlKeyManager
is not really connected toEphemeralDataProtectionProvider
or if it is, theAddDataProtection()
is setting up the XmlKeyManager before thebuilder.Services.Replace(ServiceDescriptor.Singleton<IDataProtectionProvider, EphemeralDataProtectionProvider>());
line inUseEphemeralDataProtectionProvider
kicks in.Or maybe we are missing something else somewhere.
Expected Behavior
Given a C# API application, that handles authorization via JWT bearer tokens, we need an easy way to start it without seeing warning messages from an
XmlKeyManager
that we don't actually need as far as we can tell.When running in AWS Lambda, we can prevent the first two message
By setting the
APPLOCALDATA
environment variable to a writable location, `"/tmp/".But it would seem that the only current way to prevent the third is to
ProtectKeysWithCertificate()
and a x.509 certificateBoth of which seem to be way overkill.
Steps To Reproduce
Here's a basic app created from a AWS template.
https://github.com/charles-wilt/Lambda.Minimal
I added the
builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider();
line toProgram.cs
When started, you can see that the
XmlKeyManager
is still being stood up with defaults...Exceptions (if any)
No response
.NET Version
7.0.400
Anything else?
No response
The text was updated successfully, but these errors were encountered: