code stringlengths 14 2.05k | label int64 0 1 | programming_language stringclasses 7
values | cwe_id stringlengths 6 14 | cwe_name stringlengths 5 98 ⌀ | description stringlengths 36 379 ⌀ | url stringlengths 36 48 ⌀ | label_name stringclasses 2
values |
|---|---|---|---|---|---|---|---|
var preparePayload = function (modules, payload) {
var stringifiedPayload = JSON.stringify(payload);
if (modules.cryptoModule) {
var encrypted = modules.cryptoModule.encrypt(stringifiedPayload);
stringifiedPayload = typeof encrypted === 'string' ? encrypted : (0, base64_codec_1.encode)(encrypted... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function __processMessage(modules, message) {
if (!modules.cryptoModule)
return message;
try {
var decryptedData = modules.cryptoModule.decrypt(message);
var decryptedPayload = decryptedData instanceof ArrayBuffer ? JSON.parse(new TextDecoder().decode(decryptedData)) : decryptedData;
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function prepareMessagePayload(modules, messagePayload) {
var stringifiedPayload = JSON.stringify(messagePayload);
if (modules.cryptoModule) {
var encrypted = modules.cryptoModule.encrypt(stringifiedPayload);
stringifiedPayload = typeof encrypted === 'string' ? encrypted : (0, base64_codec_1.enc... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
this.decrypt = function (data, key) {
if (typeof key === 'undefined' && cryptoModule) {
var decrypted = modules.cryptoModule.decrypt(data);
return decrypted instanceof ArrayBuffer ? (0, base64_codec_1.encode)(decrypted) : decrypted;
}
else {
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
this.setCipherKey = function (key) { return modules.config.setCipherKey(key, setup, modules); }; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
this.encryptFile = function (key, file) {
if (arguments.length == 1 && typeof key != 'string' && modules.cryptoModule) {
file = key;
return modules.cryptoModule.encryptFile(file, this.File);
}
return cryptography.encryptFile(key, file, this.Fil... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
this.encrypt = function (data, key) {
if (typeof key === 'undefined' && modules.cryptoModule) {
var encrypted = modules.cryptoModule.encrypt(data);
return typeof encrypted === 'string' ? encrypted : (0, base64_codec_1.encode)(encrypted);
}
else... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
this.decryptFile = function (key, file) {
if (arguments.length == 1 && typeof key != 'string' && modules.cryptoModule) {
file = key;
return modules.cryptoModule.decryptFile(file, this.File);
}
return cryptography.decryptFile(key, file, this.Fil... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function stringToArrayBuffer(str) {
var buf = new ArrayBuffer(str.length * 2);
var bufView = new Uint16Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.onStreamReadable = function (stream, file, File) {
return __awaiter(this, void 0, void 0, function () {
var magicBytes, versionByte, identifier, cryptor, headerSize, _a, _b;
var _c;
return __generator(this, function (_d) {
switch (_d... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.encrypt = function (data) {
var encrypted = this.defaultCryptor.encrypt(data);
if (!encrypted.metadata)
return encrypted.data;
var header = CryptorHeader.from(this.defaultCryptor.identifier, encrypted.metadata);
var headerData = new Uint8Array(heade... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.tryGetIdentifier = function (data) {
if (data.byteLength < 4) {
throw new Error('unknown cryptor error. decryption failed');
}
else {
return data.toString('utf8');
}
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.tryParse = function (encryptedData) {
var sentinel = '';
var version = null;
if (encryptedData.length >= 4) {
sentinel = encryptedData.slice(0, 4);
if (sentinel.toString('utf8') !== CryptorHeader.SENTINEL)
return '';
}
if ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.from = function (id, metadata) {
if (id === CryptorHeader.LEGACY_IDENTIFIER)
return;
return new CryptorHeaderV1(id, metadata.length);
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.validateVersion = function (data) {
if (data && data > CryptorHeader.MAX_VERSION)
throw new Error('decryption error. invalid header version');
return data;
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.decryptLegacyFileStream = function (stream, file, File) {
return __awaiter(this, void 0, void 0, function () {
var cryptor;
return __generator(this, function (_a) {
if (file.contentLength <= 16)
throw new Error('decryption er... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function CryptorHeader() {
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(gene... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.getCryptorFromId = function (id) {
var cryptor = this.getAllCryptors().find(function (c) { return id === c.identifier; });
if (cryptor) {
return cryptor;
}
throw new Error('unknown cryptor error');
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
get: function () {
return this._identifier;
}, | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.getCryptor = function (header) {
if (header === '') {
var cryptor = this.getAllCryptors().find(function (c) { return c.identifier === ''; });
if (cryptor)
return cryptor;
throw new Error('unknown cryptor error');
}
el... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.tryGetMetadataSizeFromStream = function (stream) {
var sizeBuf = stream.read(1);
if (sizeBuf && sizeBuf[0] < 255) {
return sizeBuf[0];
}
if (sizeBuf[0] === 255) {
var nextBuf = stream.read(2);
if (nextBuf.length >= 2) {
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
default: new legacyCryptor_1.default({
cipherKey: config.cipherKey,
useRandomIVs: (_a = config.useRandomIVs) !== null && _a !== void 0 ? _a : true,
}),
cryptors: [new aesCbcCryptor_1.default({ cipherKey: config.cipherKey })],
}); | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.legacyCryptoModule = function (config) {
var _a;
return new this({
default: new legacyCryptor_1.default({
cipherKey: config.cipherKey,
useRandomIVs: (_a = config.useRandomIVs) !== null && _a !== void 0 ? _a : true,
}),
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.isSentinel = function (bytes) {
if (bytes && bytes.byteLength >= 4) {
if (bytes.toString('utf8') == CryptorHeader.SENTINEL)
return true;
}
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: Buffer.from(this.decrypt(file === null || file === void 0 ? void 0 : file.data)),
})];
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.withDefaultCryptor = function (defaultCryptor) {
return new this({ default: defaultCryptor });
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.getAllCryptors = function () {
return __spreadArray([this.defaultCryptor], __read(this.cryptors), false);
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function CryptoModule(cryptoModuleConfiguration) {
var _a;
this.defaultCryptor = cryptoModuleConfiguration.default;
this.cryptors = (_a = cryptoModuleConfiguration.cryptors) !== null && _a !== void 0 ? _a : [];
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
set: function (value) {
this._identifier = value;
}, | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: encryptedData.slice(header.length),
metadata: metadata,
});
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: Buffer.from(this.encrypt(file.data)),
})];
}
if (!(file.data instanceof stream_1.Readable)) return [3 /*break*/, 2];
if (file.contentLength === 0)
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function CryptorHeaderV1(id, metadataLength) {
this._identifier = id;
this._metadataLength = metadataLength;
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.getLegacyCryptor = function () {
return this.getAllCryptors().find(function (c) { return c.identifier === ''; });
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function verb(n) { return function (v) { return step([n, v]); }; } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: Buffer.concat([aes.update(bPlain), aes.final()]),
};
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
get: function () {
return 'aes-256-cbc';
}, | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(gene... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
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 ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
onReadable = function () {
var data = encryptedStream.stream.read();
while (data !== null) {
if (data) {
var bChunk = Buffer.from(data);
var sliceLen = encryptedStream.metadataLength -... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
AesCbcCryptor.prototype.decrypt = function (encryptedData) {
var data = typeof encryptedData.data === 'string' ? new TextEncoder().encode(encryptedData.data) : encryptedData.data;
if (data.byteLength <= 0)
throw new Error('decryption error: empty content');
var aes = (0, crypto_1... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
AesCbcCryptor.prototype.getIv = function () {
return (0, crypto_1.randomBytes)(AesCbcCryptor.BLOCK_SIZE);
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
AesCbcCryptor.prototype.getKey = function () {
var sha = (0, crypto_1.createHash)('sha256');
sha.update(Buffer.from(this.cipherKey, 'utf8'));
return Buffer.from(sha.digest());
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
AesCbcCryptor.prototype.decryptStream = function (encryptedStream) {
return __awaiter(this, void 0, void 0, function () {
var decryptedStream, bIv, aes, onReadable;
var _this = this;
return __generator(this, function (_a) {
decryptedStream = new stream_1.P... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function AesCbcCryptor(configuration) {
this.cipherKey = configuration.cipherKey;
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: Buffer.concat([aes.update(bPlain), aes.final()]),
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function verb(n) { return function (v) { return step([n, v]); }; } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
get: function () {
return '';
}, | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(gene... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
LegacyCryptor.prototype.encrypt = function (data) {
if (data.length === 0)
throw new Error('encryption error. empty content');
return {
data: this.cryptor.encrypt(data),
metadata: null,
};
};
LegacyCryptor.prototype.decrypt = function (encryptedDat... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
data: this.cryptor.encrypt(data),
metadata: null,
};
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
LegacyCryptor.prototype.decrypt = function (encryptedData) {
var data = typeof encryptedData.data === 'string' ? encryptedData.data : (0, base64_codec_1.encode)(encryptedData.data);
return this.cryptor.decrypt(data);
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
LegacyCryptor.prototype.encryptFile = function (file, File) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fileCryptor.encryptFile(this.config.cipherKey, file, File)];
});
});
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
LegacyCryptor.prototype.decryptFile = function (file, File) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fileCryptor.decryptFile(this.config.cipherKey, file, File)];
});
});
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function LegacyCryptor(config) {
this.config = config;
this.cryptor = new index_1.default({ config: config });
this.fileCryptor = new node_1.default();
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function verb(n) { return function (v) { return step([n, v]); }; } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.onStreamReadable = function (stream, file, File) {
return __awaiter(this, void 0, void 0, function () {
var magicBytes, versionByte, identifier, cryptor, headerSize, _a, _b;
var _c;
return __generator(this, function (_d) {
switch (_d... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.encrypt = function (data) {
var encrypted = this.defaultCryptor.encrypt(data);
if (!encrypted.metadata)
return encrypted.data;
var header = CryptorHeader.from(this.defaultCryptor.identifier, encrypted.metadata);
var headerData = new Uint8Array(heade... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.tryGetIdentifier = function (data) {
if (data.byteLength < 4) {
throw new Error('unknown cryptor error. decryption failed');
}
else {
return data.toString('utf8');
}
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.tryParse = function (encryptedData) {
var sentinel = '';
var version = null;
if (encryptedData.length >= 4) {
sentinel = encryptedData.slice(0, 4);
if (sentinel.toString('utf8') !== CryptorHeader.SENTINEL)
return '';
}
if ... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.from = function (id, metadata) {
if (id === CryptorHeader.LEGACY_IDENTIFIER)
return;
return new CryptorHeaderV1(id, metadata.length);
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptorHeader.validateVersion = function (data) {
if (data && data > CryptorHeader.MAX_VERSION)
throw new Error('decryption error. invalid header version');
return data;
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.decryptLegacyFileStream = function (stream, file, File) {
return __awaiter(this, void 0, void 0, function () {
var cryptor;
return __generator(this, function (_a) {
if (file.contentLength <= 16)
throw new Error('decryption er... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
function CryptorHeader() {
} | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(gene... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
... | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
CryptoModule.prototype.getCryptorFromId = function (id) {
var cryptor = this.getAllCryptors().find(function (c) { return id === c.identifier; });
if (cryptor) {
return cryptor;
}
throw new Error('unknown cryptor error');
}; | 1 | JavaScript | CWE-331 | 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. | https://cwe.mitre.org/data/definitions/331.html | safe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.