DuendeSoftware / Support

Support for Duende Software products
20 stars 0 forks source link

Error **Exception reading protected message** getting logged occasionally #1246

Closed malay-khandhediya closed 3 months ago

malay-khandhediya commented 3 months ago

Which version of Duende IdentityServer are you using? v7.0.4

Which version of .NET are you using? net 8.0

Describe the bug Error Exception reading protected message getting logged occasionally

To Reproduce No steps are available as it is getting logged randomly

Expected behavior The error should not be logged. Wanted to understand in which case such an issue occurs.

Log output/exception with stacktrace System.Exception: Illegal base64url string!\n at byte[] IdentityModel.Base64Url.Decode(string arg)\n at Task<Message<TModel>> Duende.IdentityServer.Stores.ProtectedDataMessageStore<TModel>.ReadAsync(string value) in /_/src/IdentityServer/Stores/Default/ProtectedDataMessageStore.cs:line 55

Additional context

This error has been logged 7 times in the last month randomly

RolandGuijt commented 3 months ago

To help us understand where this is coming from can you tell us when this happens?

In the meantime you could look into this: IdentityServer uses ASP.NET Core's Data Protection to encrypt and decrypt data. By default the keys that applications use are isolated per application. To do that by default Data Protection uses the content root path of the application. Could it be that for some reason there is variation in the root path at the 7 times it went wrong?

You could try to explicitly set the application name and see if that helps. You can find an example here.

malay-khandhediya commented 3 months ago

Thanks for your response. We reviewed our data protection registration settings and everything appears to be fine, though we haven't specified an application name explicitly. Additionally, the root path hasn't been modified during the time the errors occurred. As a positive update, we haven't encountered any similar errors in the past 15 days. We'll keep you informed in this thread if the errors resurface.

RolandGuijt commented 3 months ago

OK. Closing for now but feel free to reopen when they resurface.