Language: JavaScript
Label: safe
CWE: CWE-331 \u2014 Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.

Code:
    AesCbcCryptor.prototype.encryptStream = function (stream) {
        return __awaiter(this, void 0, void 0, function () {
            var output, bIv, aes;
            return __generator(this, function (_a) {
                output = new stream_1.PassThrough();
                bIv = this.getIv();
                if (stream.readable === false)
                    throw new Error('encryption error. empty stream');
                aes = (0, crypto_1.createCipheriv)(this.algo, this.getKey(), bIv);
                stream.pipe(aes).pipe(output);
                return [2 /*return*/, {
                        stream: output,
                        metadata: bIv,
                        metadataLength: AesCbcCryptor.BLOCK_SIZE,
                    }];
            });
        });
    };