Steps to reproduce
- Static code security scan. Example:
private static void WriteEncryptionHeader(Stream stream, long crcValue)
{
byte[] cryptBuffer = new byte[ZipConstants.CryptoHeaderSize];
var rnd = new Random();
rnd.NextBytes(cryptBuffer);
cryptBuffer[11] = (byte)(crcValue >> 24);
stream.Write(cryptBuffer, 0, cryptBuffer.Length);
}
Expected behavior
Replace all uses of System.Random() with a cryptographic version such as that provided by RNGCryptoServiceProvider.
Actual behavior
SharpZipLib fails security scans.
Version of SharpZipLib
1.3.0
Obtained from (only keep the relevant lines)
- Package installed using NuGet