Skip to content

Commit b82f7b2

Browse files
authored
Ensure fatal exceptions do not cause key regeneration (#8778)
1 parent cc8270d commit b82f7b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/WebJobs.Script.WebHost/Security/SecretManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public async virtual Task<HostSecretsInfo> GetHostSecretsAsync()
9595
// so we read the secrets running them through the appropriate readers
9696
hostSecrets = ReadHostSecrets(hostSecrets);
9797
}
98-
catch (CryptographicException)
98+
catch (CryptographicException ex) when (!ex.InnerException.IsFatal())
9999
{
100100
_traceWriter.Verbose(Resources.TraceNonDecryptedHostSecretRefresh);
101101
await PersistSecretsAsync(hostSecrets, null, true);
@@ -161,7 +161,7 @@ public async virtual Task<IDictionary<string, string>> GetFunctionSecretsAsync(s
161161
// Read all secrets, which will run the keys through the appropriate readers
162162
secrets.Keys = secrets.Keys.Select(k => _keyValueConverterFactory.ReadKey(k)).ToList();
163163
}
164-
catch (CryptographicException)
164+
catch (CryptographicException ex) when (!ex.InnerException.IsFatal())
165165
{
166166
string messageNonDecrypted = string.Format(Resources.TraceNonDecryptedFunctionSecretRefresh, functionName);
167167
_traceWriter.Info(messageNonDecrypted, traceProperties);

0 commit comments

Comments
 (0)