Request Affinity key decryption failures #1924
-
We are running a YARP-based API gateway inside of a Kubernetes cluster. Recently we started getting a lot of exceptions in our logs across multiple environments related to {
"Message": "The request affinity key decryption failed.",
"SourceContext": "Yarp.ReverseProxy.SessionAffinity.CookieSessionAffinityPolicy",
"EventId": {
"Id": 38,
"Name": "RequestAffinityKeyDecryptionFailed"
},
"Exception": {
"Type": "System.Security.Cryptography.CryptographicException",
"Message": "The key {3c41e5c9-ba87-4b12-8a17-312e7326b765} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning",
"Source": "Microsoft.AspNetCore.DataProtection",
"TargetSite": "Byte[] UnprotectCore(Byte[], Boolean, UnprotectStatus ByRef)"
}
} Our configurations include Cookie-based session affinity, however we are not managing data protection features ourselves (i.e. no call to Any ideas on why this might be happening? Is it something to be concerned with, and if so, how might we fix it? It doesn't seem to impact actual request proxying so I think it may be harmless... but I wanted to verify anyways. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
There are a few possible causes for this:
The fix for both cases is to configure AddDataProtection to store keys outside of the container in a central location. |
Beta Was this translation helpful? Give feedback.
-
Hi, We are running multiple YARP instances on multiple VMs. I am wondering, what are we trying to protect here? the destination machine name is not a secret. Also, an attacker can use the protected affinity key to DDos a specific destination even without the destination explicit name. It just seems more appropriate to protect secrets and authentication. Is this security by inconvenient? Or am I missing an attack vector for sharing the actual destination name (which is anyway private and inaccessible outside of the datacenter) So, my question is how do we use multiple instances of YARP without some redesign of a new feature to store something outside of the process? Can we choose not to protect the cookie value? when configuring the cookie affinity? If both answers are no, can you please refer me to how we solve it? Will something as simple as this will solve the issue? Thanks, |
Beta Was this translation helpful? Give feedback.
There are a few possible causes for this:
The fix for both cases is to configure AddDataProtection to store keys outside of the container in a central location.