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
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'); } else if (header instanceof CryptorHeaderV1) { return this.getCryptorFromId(header.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
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) { return new Uint16Array([nextBuf[0], nextBuf[1]]).reduce(function (acc, val) { return (acc << 8) + val; }, 0); } } throw new Error('decryption error. Invalid metadata 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
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, }), 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
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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
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."); 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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
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) throw new Error('encryption error. empty content'); return [4 /*yield*/, this.defaultCryptor.encryptStream(file.data)]; case 1: encryptedStream = _a.sent(); header = CryptorHeader.from(this.defaultCryptor.identifier, encryptedStream.metadata); payload = new Uint8Array(header.length); pos = 0; payload.set(header.data, pos); pos += header.length; if (encryptedStream.metadata) { pos -= encryptedStream.metadata.length; payload.set(encryptedStream.metadata, pos); } output = new stream_1.PassThrough(); output.write(payload); encryptedStream.stream.pipe(output); return [2 /*return*/, File.create({ name: file.name, mimeType: 'application/octet-stream', stream: output, })]; case 2: return [2 /*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
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
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-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(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); };
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: (0, base64_codec_1.decode)(this.CryptoJS.AES.encrypt(data, this.encryptedKey, { iv: this.bufferToWordArray(abIv), mode: this.CryptoJS.mode.CBC, }).ciphertext.toString(this.CryptoJS.enc.Base64)),
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: (0, base64_codec_1.decode)(this.CryptoJS.AES.encrypt(data, this.encryptedKey, { iv: this.bufferToWordArray(abIv), mode: this.CryptoJS.mode.CBC, }).ciphertext.toString(this.CryptoJS.enc.Base64)),
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
AesCbcCryptor.prototype.decrypt = function (encryptedData) { var iv = this.bufferToWordArray(new Uint8ClampedArray(encryptedData.metadata)); var data = this.bufferToWordArray(new Uint8ClampedArray(encryptedData.data)); return AesCbcCryptor.encoder.encode(this.CryptoJS.AES.decrypt({ ciphertext: data }, this.encryptedKey, { iv: iv, mode: this.CryptoJS.mode.CBC, }).toString(this.CryptoJS.enc.Utf8)).buffer; };
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 crypto.getRandomValues(new Uint8Array(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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
AesCbcCryptor.prototype.getKey = function () { return __awaiter(this, void 0, void 0, function () { var bKey, abHash; return __generator(this, function (_a) { switch (_a.label) { case 0: bKey = AesCbcCryptor.encoder.encode(this.cipherKey); return [4 /*yield*/, crypto.subtle.digest('SHA-256', bKey.buffer)]; case 1: abHash = _a.sent(); return [2 /*return*/, crypto.subtle.importKey('raw', abHash, this.algo, true, ['encrypt', 'decrypt'])]; } }); }); };
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."); 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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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 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
AesCbcCryptor.prototype.bufferToWordArray = function (b) { var wa = []; var i; for (i = 0; i < b.length; i += 1) { wa[(i / 4) | 0] |= b[i] << (24 - 8 * i); } return this.CryptoJS.lib.WordArray.create(wa, b.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
AesCbcCryptor.prototype.encryptFileData = function (data) { return __awaiter(this, void 0, void 0, function () { var key, iv; var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.getKey()]; case 1: key = _b.sent(); iv = this.getIv(); _a = {}; return [4 /*yield*/, crypto.subtle.encrypt({ name: this.algo, iv: iv }, key, data)]; case 2: return [2 /*return*/, (_a.data = _b.sent(), _a.metadata = iv, _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
AesCbcCryptor.prototype.decryptFileData = function (encryptedData) { return __awaiter(this, void 0, void 0, function () { var key; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getKey()]; case 1: key = _a.sent(); return [2 /*return*/, crypto.subtle.decrypt({ name: this.algo, iv: encryptedData.metadata }, key, encryptedData.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
function AesCbcCryptor(configuration) { this.cipherKey = configuration.cipherKey; this.CryptoJS = hmac_sha256_1.default; this.encryptedKey = this.CryptoJS.SHA256(this.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
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(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); };
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) { var stringData = typeof data === 'string' ? data : new TextDecoder().decode(data); return { data: this.cryptor.encrypt(stringData), metadata: null, }; }; 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); }; LegacyCryptor.prototype.encryptFile = function (file, File) { var _a; return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_b) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore: can not detect cipherKey from old Config return [2 /*return*/, this.fileCryptor.encryptFile((_a = this.config) === null || _a === void 0 ? void 0 : _a.cipherKey, file, File)]; }); }); }; LegacyCryptor.prototype.decryptFile = function (file, File) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore: can not detect cipherKey from old Config return [2 /*return*/, this.fileCryptor.decryptFile(this.config.cipherKey, file, File)]; }); }); }; return LegacyCryptor; }());
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
data: this.cryptor.encrypt(stringData), 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.encryptFile = function (file, File) { var _a; return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_b) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore: can not detect cipherKey from old Config return [2 /*return*/, this.fileCryptor.encryptFile((_a = this.config) === null || _a === void 0 ? void 0 : _a.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) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore: can not detect cipherKey from old Config 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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
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."); 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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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 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 web_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.encrypt = function (data) { var encrypted = this.defaultCryptor.encrypt(data); if (!encrypted.metadata) return encrypted.data; var headerData = this.getHeaderData(encrypted); return this.concatArrayBuffer(headerData, encrypted.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
data: data.slice(header.length), metadata: metadata, })]; case 2: return [2 /*return*/, _b.apply(_a, [(_c.data = _d.sent(), _c)])]; } });
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.byteLength); };
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
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
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 }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; };
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(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); };
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]; } } return to.concat(ar || Array.prototype.slice.call(from)); };
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 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'); } else if (header instanceof CryptorHeaderV1) { return this.getCryptorFromId(header.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.getFileData = function (input) { if (input instanceof ArrayBuffer) { return input; } if (typeof input === 'string') { return CryptoModule.encoder.encode(input); } throw new Error('Cannot decrypt/encrypt file. In browsers file decryption supports only string or ArrayBuffer'); };
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
CryptoModule.prototype.getHeaderData = function (encrypted) { if (!encrypted.metadata) return; var header = CryptorHeader.from(this.defaultCryptor.identifier, encrypted.metadata); var headerData = new Uint8Array(header.length); var pos = 0; headerData.set(header.data, pos); pos += header.length - encrypted.metadata.byteLength; headerData.set(new Uint8Array(encrypted.metadata), pos); return headerData.buffer; };
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
CryptorHeader.tryParse = function (data) { var encryptedData = new Uint8Array(data); var sentinel = ''; var version = null; if (encryptedData.byteLength >= 4) { sentinel = encryptedData.slice(0, 4); if (this.decoder.decode(sentinel) !== CryptorHeader.SENTINEL) return ''; } if (encryptedData.byteLength >= 5) { version = encryptedData[4]; } else { throw new Error('decryption error. invalid header version'); } if (version > CryptorHeader.MAX_VERSION) throw new Error('unknown cryptor error'); var identifier = ''; var pos = 5 + CryptorHeader.IDENTIFIER_LENGTH; if (encryptedData.byteLength >= pos) { identifier = encryptedData.slice(5, pos); } else { throw new Error('decryption error. invalid crypto identifier'); } var metadataLength = null; if (encryptedData.byteLength >= pos + 1) { metadataLength = encryptedData[pos]; } else { throw new Error('decryption error. invalid metadata length'); } pos += 1; if (metadataLength === 255 && encryptedData.byteLength >= pos + 2) { metadataLength = new Uint16Array(encryptedData.slice(pos, pos + 2)).reduce(function (acc, val) { return (acc << 8) + val; }, 0); pos += 2; } return new CryptorHeaderV1(this.decoder.decode(identifier), 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.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, }), 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
data: this.concatArrayBuffer(this.getHeaderData(encrypted), encrypted.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.concatArrayBuffer = function (ab1, ab2) { var tmp = new Uint8Array(ab1.byteLength + ab2.byteLength); tmp.set(new Uint8Array(ab1), 0); tmp.set(new Uint8Array(ab2), ab1.byteLength); return tmp.buffer; };
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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
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
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."); 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 = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: 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
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
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
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
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
transform: function (chunk, _, cb) { if (!inited) { inited = true; this.push(Buffer.concat([bIv, chunk])); } else { this.push(chunk); } cb(); },
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
NodeCryptography.prototype.encryptStream = function (key, stream) { return __awaiter(this, void 0, void 0, function () { var bIv, aes, inited; return __generator(this, function (_a) { bIv = this.getIv(); aes = (0, crypto_1.createCipheriv)('aes-256-cbc', key, bIv).setAutoPadding(true); inited = false; return [2 /*return*/, stream.pipe(aes).pipe(new stream_1.Transform({ transform: function (chunk, _, cb) { if (!inited) { inited = true; this.push(Buffer.concat([bIv, chunk])); } else { this.push(chunk); } cb(); }, }))]; }); }); };
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
NodeCryptography.prototype.encryptFile = function (key, file, File) { return __awaiter(this, void 0, void 0, function () { var bKey, _a, _b, _c, _d; var _e, _f; return __generator(this, function (_g) { switch (_g.label) { case 0: bKey = this.getKey(key); if (!(file.data instanceof Buffer)) return [3 /*break*/, 2]; if (file.data.byteLength <= 0) throw new Error('encryption error. empty content'); _b = (_a = File).create; _e = { name: file.name, mimeType: 'application/octet-stream' }; return [4 /*yield*/, this.encryptBuffer(bKey, file.data)]; case 1: return [2 /*return*/, _b.apply(_a, [(_e.data = _g.sent(), _e)])]; case 2: if (!(file.data instanceof stream_1.Readable)) return [3 /*break*/, 4]; if (file.contentLength === 0) throw new Error('encryption error. empty content'); _d = (_c = File).create; _f = { name: file.name, mimeType: 'application/octet-stream' }; return [4 /*yield*/, this.encryptStream(bKey, file.data)]; case 3: return [2 /*return*/, _d.apply(_c, [(_f.stream = _g.sent(), _f)])]; case 4: throw new Error('Cannot encrypt this file. In Node.js file encryption supports only string, Buffer or Stream.'); } }); }); };
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
NodeCryptography.prototype.decryptBuffer = function (key, ciphertext) { var bIv = ciphertext.slice(0, NodeCryptography.IV_LENGTH); var bCiphertext = ciphertext.slice(NodeCryptography.IV_LENGTH); if (bCiphertext.byteLength <= 0) throw new Error('decryption error: empty content'); var aes = (0, crypto_1.createDecipheriv)(this.algo, key, bIv); return Buffer.concat([aes.update(bCiphertext), 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
WebCryptography.prototype.decryptArrayBuffer = function (key, ciphertext) { return __awaiter(this, void 0, void 0, function () { var abIv, data; return __generator(this, function (_a) { switch (_a.label) { case 0: abIv = ciphertext.slice(0, 16); if (ciphertext.slice(WebCryptography.IV_LENGTH).byteLength <= 0) throw new Error('decryption error: empty content'); return [4 /*yield*/, crypto.subtle.decrypt({ name: 'AES-CBC', iv: abIv }, key, ciphertext.slice(WebCryptography.IV_LENGTH))]; case 1: data = _a.sent(); return [2 /*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
WebCryptography.prototype.encryptString = function (key, plaintext) { return __awaiter(this, void 0, void 0, function () { var abIv, abPlaintext, abPayload, ciphertext; return __generator(this, function (_a) { switch (_a.label) { case 0: abIv = crypto.getRandomValues(new Uint8Array(16)); abPlaintext = WebCryptography.encoder.encode(plaintext).buffer; return [4 /*yield*/, crypto.subtle.encrypt({ name: 'AES-CBC', iv: abIv }, key, abPlaintext)]; case 1: abPayload = _a.sent(); ciphertext = concatArrayBuffer(abIv.buffer, abPayload); return [2 /*return*/, WebCryptography.decoder.decode(ciphertext)]; } }); }); };
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
WebCryptography.prototype.decryptFile = function (key, file, File) { return __awaiter(this, void 0, void 0, function () { var bKey, abCipherdata, abPlaindata; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getKey(key)]; case 1: bKey = _a.sent(); return [4 /*yield*/, file.data.arrayBuffer()]; case 2: abCipherdata = _a.sent(); return [4 /*yield*/, this.decryptArrayBuffer(bKey, abCipherdata)]; case 3: abPlaindata = _a.sent(); return [2 /*return*/, File.create({ name: file.name, data: abPlaindata, })]; } }); }); };
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