code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
get lokadIdHex() { return "534c5000"; }
1
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
function buildBinary(isDownloaded) { var buildString = "node-gyp configure build --IBM_DB_HOME=\"$IBM_DB_HOME\""; if(isDownloaded) { buildString = buildString + " --IS_DOWNLOADED=true"; } else { buildString = buildString + " --IS_DOWNLOADED=false"; } if( platform == 'win32') { buildString = buildString + " --IBM_DB_HOME_WIN=%IBM_DB_HOME%"; } var childProcess = exec(buildString, function (error, stdout, stderr) { console.log(stdout); if (error !== null) { console.log(error); process.exit(1); } if(platform == 'darwin' && arch == 'x64') { // Run the install_name_tool var nameToolCommand = "install_name_tool -change libdb2.dylib $IBM_DB_HOME/lib/libdb2.dylib ./build/Release/odbc_bindings.node" ; var nameToolCmdProcess = exec(nameToolCommand , function (error1, stdout1, stderr1) { if (error1 !== null) { console.log('Error setting up the lib path to ' + 'odbc_bindings.node file.Error trace:\n'+error1); process.exit(1); } }); } removeUsedPackages(); }); } //buildBinary
1
TypeScript
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
function addNumericalSeparator(val) { let res = ''; let i = val.length; const start = val[0] === '-' ? 1 : 0; for (; i >= start + 4; i -= 3) res = `_${val.slice(i - 3, i)}${res}`; return `${val.slice(0, i)}${res}`; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
constructor(options?: MessageChunkerOptions) { options = options || {}; this.sequenceNumberGenerator = new SequenceNumberGenerator(); this.maxMessageSize = options.maxMessageSize || 16 *1024*1024; this.update(options); }
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
closeSocket() { if (this.dataSocket) { const socket = this.dataSocket; this.dataSocket.end(() => socket && socket.destroy()); this.dataSocket = null; } }
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
getDownloadUrl(fileId, accessToken) { return `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/` + `file/download?fileId=${fileId}&accessToken=${accessToken}`; }
0
TypeScript
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
handler: function ({log} = {}) { if (!this.server.options.pasv_url) { return this.reply(502); } this.connector = new PassiveConnector(this); return this.connector.setupServer() .then((server) => { let address = this.server.options.pasv_url; // Allow connecting from local if (isLocalIP(this.ip)) { address = this.ip; } const {port} = server.address(); const host = address.replace(/\./g, ','); const portByte1 = port / 256 | 0; const portByte2 = port % 256; return this.reply(227, `PASV OK (${host},${portByte1},${portByte2})`); }) .catch((err) => { log.error(err); return this.reply(425); }); },
0
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
postUrl = `${config().baseUrl}/users/${user.id}`; } const subscription = !isNew ? await ctx.joplin.models.subscription().byUserId(userId) : null; const view: View = defaultView('user', 'Profile'); view.content.user = user; view.content.isNew = isNew; view.content.buttonTitle = isNew ? 'Create user' : 'Update profile'; view.content.error = error; view.content.postUrl = postUrl; view.content.showDisableButton = !isNew && !!owner.is_admin && owner.id !== user.id && user.enabled; view.content.csrfTag = await createCsrfTag(ctx); if (subscription) { view.content.subscription = subscription; view.content.showCancelSubscription = !isNew; view.content.showUpdateSubscriptionBasic = !isNew && !!owner.is_admin && user.account_type !== AccountType.Basic; view.content.showUpdateSubscriptionPro = !isNew && user.account_type !== AccountType.Pro; } view.content.showRestoreButton = !isNew && !!owner.is_admin && !user.enabled; view.content.showResetPasswordButton = !isNew && owner.is_admin && user.enabled; view.content.canSetEmail = isNew || owner.is_admin; view.content.canShareFolderOptions = yesNoDefaultOptions(user, 'can_share_folder'); view.jsFiles.push('zxcvbn'); view.cssFiles.push('index/user'); if (config().accountTypesEnabled) { view.content.showAccountTypes = true; view.content.accountTypes = accountTypeOptions().map((o: any) => { o.selected = user.account_type === o.value; return o; }); } return view; });
1
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
let Q = async A => { A };
1
TypeScript
CWE-119
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
https://cwe.mitre.org/data/definitions/119.html
safe
readByte: () => { if (buffer && pos < buffer.length) return buffer[pos++]; },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
getDownloadUrl(file) { return this.importExport.getDownloadUrl(file.id, file.accessToken); },
0
TypeScript
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
export function escape_attribute_value(value) { return typeof value === 'string' ? escape(value, true) : value; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function OpenSSH_Public(type, comment, pubPEM, pubSSH, algo) { this.type = type; this.comment = comment; this[SYM_PRIV_PEM] = null; this[SYM_PUB_PEM] = pubPEM; this[SYM_PUB_SSH] = pubSSH; this[SYM_HASH_ALGO] = algo; this[SYM_DECRYPTED] = false; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function genOpenSSLECDSAPriv(oid, pub, priv) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); // version asnWriter.writeInt(0x01, Ber.Integer); // privateKey asnWriter.writeBuffer(priv, Ber.OctetString); // parameters (optional) asnWriter.startSequence(0xA0); asnWriter.writeOID(oid); asnWriter.endSequence(); // publicKey (optional) asnWriter.startSequence(0xA1); asnWriter.startSequence(Ber.BitString); asnWriter.writeByte(0x00); // XXX: hack to write a raw buffer without a tag -- yuck asnWriter._ensure(pub.length); asnWriter._buf.set(pub, asnWriter._offset); asnWriter._offset += pub.length; // end hack asnWriter.endSequence(); asnWriter.endSequence(); asnWriter.endSequence(); return makePEM('EC PRIVATE', asnWriter.buffer); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
([ key, value ]) => ({ [key]: spawn.bind(null, `show -s --format=%${value}`) }), ),
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
ivLen: (ivLen !== 0 || (flags & CIPHER_STREAM) ? ivLen : blockLen), authLen, discardLen, stream: !!(flags & CIPHER_STREAM), };
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export async function recursiveReadDir(dir: string): Promise<string[]> { const subdirs = await readdir(dir); const files = await Promise.all( subdirs.map(async subdir => { const res = resolve(dir, subdir); return (await stat(res)).isDirectory() ? recursiveReadDir(res) : [res]; }), ); return files.reduce((a, f) => a.concat(f), []); }
0
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
TEST_F(AsStringGraphTest, FillWithChar1) { TF_ASSERT_OK(Init(DT_INT64, /*fill=*/"-", /*width=*/4)); AddInputFromArray<int64>(TensorShape({3}), {-42, 0, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({3})); test::FillValues<tstring>(&expected, {"-42 ", "0 ", "42 "}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
'hmac-sha2-512-96': info('sha512', 64, 12, false), }; })();
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function indexer(set) { return function(obj, i) { "use strict"; try { if (obj && i && obj.hasOwnProperty(i)) { return obj[i]; } else if (obj && i && set) { obj[i] = {}; return obj[i]; } return; } catch(ex) { console.error(ex); return; } }; }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
this.serversUpdatedListener = ({ servers }) => { // Update status log line with new `garden dashboard` server, if any for (const { host, command } of servers) { if (command === "dashboard") { this.showUrl(host) return } } // No active explicit dashboard processes, show own URL instead this.showUrl(this.getUrl()) }
0
TypeScript
CWE-306
Missing Authentication for Critical Function
The software does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
vulnerable
async function validateSPLTokenTransfer( message: Message, meta: ConfirmedTransactionMeta, recipient: Recipient, splToken: SPLToken ): Promise<[BigNumber, BigNumber]> { const recipientATA = await getAssociatedTokenAddress(splToken, recipient); const accountIndex = message.accountKeys.findIndex((pubkey) => pubkey.equals(recipientATA)); if (accountIndex === -1) throw new ValidateTransferError('recipient not found'); const preBalance = meta.preTokenBalances?.find((x) => x.accountIndex === accountIndex); const postBalance = meta.postTokenBalances?.find((x) => x.accountIndex === accountIndex); return [ new BigNumber(preBalance?.uiTokenAmount.uiAmountString || 0), new BigNumber(postBalance?.uiTokenAmount.uiAmountString || 0), ]; }
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
return function sign(data, algo) { const pem = this[SYM_PRIV_PEM]; if (pem === null) return new Error('No private key available'); if (!algo || typeof algo !== 'string') algo = this[SYM_HASH_ALGO]; try { return sign_(algo, data, pem); } catch (ex) { return ex; } };
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
return new Error(errMsg); } privPEM = makePEM('EC PRIVATE', privBlob); const pubBlob = genOpenSSLECDSAPubFromPriv(ecSSLName, ecPriv); pubPEM = genOpenSSLECDSAPub(ecOID, pubBlob); pubSSH = genOpenSSHECDSAPub(ecOID, pubBlob); break; } return new OpenSSH_Old_Private(type, '', privPEM, pubPEM, pubSSH, algo, decrypted); };
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
constructor(env?: NodeJS.ProcessEnv) { if (!env) { env = process.env; } // Enable config file if (env.config) { const configFile = path.resolve(process.cwd(), env.config); confinit.applyConfigFile(this, configFile); } // Enable environment variables confinit.applyEnvVariables(this, process.env, "cfg_"); // Enable command arguments confinit.applyCommandArgs(this, process.argv); confinit.validate(this); }
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
userPassword: bcrypt.hashSync(req.body.userPassword, 10), isAdmin: isAdmin }; // check for existing user db.users.findOne({'userEmail': req.body.userEmail}, (err, user) => { if(user){ // user already exists with that email address console.error(colors.red('Failed to insert user, possibly already exists: ' + err)); req.session.message = 'A user with that email address already exists'; req.session.messageType = 'danger'; res.redirect('/admin/user/new'); return; } // email is ok to be used. db.users.insert(doc, (err, doc) => { // show the view if(err){ if(doc){ console.error(colors.red('Failed to insert user: ' + err)); req.session.message = 'User exists'; req.session.messageType = 'danger'; res.redirect('/admin/user/edit/' + doc._id); return; } console.error(colors.red('Failed to insert user: ' + err)); req.session.message = 'New user creation failed'; req.session.messageType = 'danger'; res.redirect('/admin/user/new'); return; } req.session.message = 'User account inserted'; req.session.messageType = 'success'; // if from setup we add user to session and redirect to login. // Otherwise we show users screen if(urlParts.path === '/admin/setup'){ req.session.user = req.body.userEmail; res.redirect('/admin/login'); return; } res.redirect('/admin/users'); }); }); });
0
TypeScript
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
vulnerable
WebContents.prototype.sendToFrame = function (frame, channel, ...args) { if (typeof channel !== 'string') { throw new Error('Missing required channel argument'); } else if (!(typeof frame === 'number' || Array.isArray(frame))) { throw new Error('Missing required frame argument (must be number or array)'); } return this._sendToFrame(false /* internal */, frame, channel, args); };
1
TypeScript
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
safe
body: JSON.stringify({ ...keys, _method: 'POST', email: 'someemail@somedomain.com', }), }); await this.user.fetch({ useMasterKey: true }); const passwordResetResponse = await request({ url: `${serverURL}/apps/test/request_password_reset?username=someemail@somedomain.com&token[$regex]=`, method: 'GET', }); expect(passwordResetResponse.status).toEqual(302); expect(passwordResetResponse.headers.location).toMatch( `\\/invalid\\_link\\.html` ); await request({ url: `${serverURL}/apps/test/request_password_reset`, method: 'POST', body: { token: { $regex: '' }, username: 'someemail@somedomain.com', new_password: 'newpassword', }, }); try { await Parse.User.logIn('someemail@somedomain.com', 'newpassword'); fail('should not work'); } catch (e) { expect(e.code).toEqual(101); expect(e.message).toEqual('Invalid username/password.'); } });
1
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
function simulateOpenSecureChannel(callback: SimpleCallback) { clientChannel.create("fake://foobar:123", (err?: Error) => { if (param.shouldFailAtClientConnection) { if (!err) { return callback(new Error(" Should have failed here !")); } callback(); } else { if (err) { return callback(err); } setImmediate(() => callback()); } }); }
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
provisionCallback: (user, renew, cb) => { cb(null, 'zzz'); } }); xoauth2.getToken(false, function(err, accessToken) { expect(err).to.not.exist; expect(accessToken).to.equal('zzz'); done(); }); });
0
TypeScript
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The software constructs a string for a command to executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.
https://cwe.mitre.org/data/definitions/88.html
vulnerable
function bigIntFromBuffer(buf) { return BigInt(`0x${buf.hexSlice(0, buf.length)}`); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function _setPath(document, keyPath, value) { if (!document) { throw new Error('No document was provided.'); } let {indexOfDot, currentKey, remainingKeyPath} = computeStateInformation(keyPath); if (indexOfDot >= 0) { // If there is a '.' in the keyPath, recur on the subdoc and ... if (!document[currentKey] && Array.isArray(document)) { // If this is an array and there are multiple levels of keys to iterate over, recur. return document.forEach((doc) => _setPath(doc, keyPath, value)); } else if (!document[currentKey]) { // If the currentKey doesn't exist yet, populate it document[currentKey] = {}; } _setPath(document[currentKey], remainingKeyPath, value); } else if (Array.isArray(document)) { // If this "document" is actually an array, then we can loop over each of the values and set the path return document.forEach((doc) => _setPath(doc, remainingKeyPath, value)); } else { // Otherwise, we can set the path directly document[keyPath] = value; } return document; }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
readBool: () => { if (buffer && pos < buffer.length) return !!buffer[pos++]; },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
const filter = obj => { if (!obj) { return; } let protectedFields = classLevelPermissions?.protectedFields || []; if (!client.hasMasterKey && !Array.isArray(protectedFields)) { protectedFields = getDatabaseController(this.config).addProtectedFields( classLevelPermissions, res.object.className, query, aclGroup, clientAuth ); } return DatabaseController.filterSensitiveData( client.hasMasterKey, aclGroup, clientAuth, op, classLevelPermissions, res.object.className, protectedFields, obj, query ); };
1
TypeScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
const replaceCharactersWithSpaces = (text) => { const re = new RegExp(`[${settings.CHARACTERS_TO_REPLACE_WITH_SPACES}]`, 'g'); const newText = text.replace(re, ' ').trim(); return newText; };
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export async function git(path: string): Promise<BlameResult> { const blamedLines: { [line: string]: BlamedLine } = {}; const pathToGit: string = await which('git'); const result = execa.sync(pathToGit, ['blame', '-w', path]); result.stdout.split('\n').forEach(line => { if (line !== '') { const blamedLine = convertStringToObject(line); if (blamedLine.line) { blamedLines[blamedLine.line] = blamedLine; } } }); return { [path]: blamedLines }; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function sendResponse(response1: Response) { try { assert(response1 instanceof ResponseClass); if (message.session) { const counterName = ResponseClass.name.replace("Response", ""); message.session.incrementRequestTotalCounter(counterName); } return channel.send_response("MSG", response1, message); } catch (err) { warningLog(err); // istanbul ignore next if (err instanceof Error) { // istanbul ignore next errorLog( "Internal error in issuing response\nplease contact support@sterfive.com", message.request.toString(), "\n", response1.toString() ); } // istanbul ignore next throw err; } }
0
TypeScript
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
vulnerable
tooltipText: (c: FormatterContext, d: LineChartDatum) => string;
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void testUnwrapDoesntLeaveTarget() throws Exception { File file = File.createTempFile("temp", null); File tmpDir = file.getParentFile(); try { ZipUtil.iterate(badFileBackslashes, new ZipUtil.BackslashUnpacker(tmpDir)); fail(); } catch (ZipException e) { assertTrue(true); } }
1
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
...new Set(utxos.filter((txOut) => { if (txOut.slpTransactionDetails && txOut.slpUtxoJudgement !== SlpUtxoJudgement.UNKNOWN && txOut.slpUtxoJudgement !== SlpUtxoJudgement.UNSUPPORTED_TYPE && txOut.slpUtxoJudgement !== SlpUtxoJudgement.NOT_SLP) { return true; } return false; }).map((txOut) => txOut.txid)),
1
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
function buildBinary(isDownloaded) { var buildString = "node-gyp configure build --IBM_DB_HOME=\"$IBM_DB_HOME\""; if(isDownloaded) { buildString = buildString + " --IS_DOWNLOADED=true"; } else { buildString = buildString + " --IS_DOWNLOADED=false"; } if( platform == 'win32') { buildString = buildString + " --IBM_DB_HOME_WIN=%IBM_DB_HOME%"; } var childProcess = exec(buildString, function (error, stdout, stderr) { console.log(stdout); if (error !== null) { console.log(error); process.exit(1); } if(platform == 'darwin' && arch == 'x64') { // Run the install_name_tool var nameToolCommand = "install_name_tool -change libdb2.dylib $IBM_DB_HOME/lib/libdb2.dylib ./build/Release/odbc_bindings.node" var nameToolCmdProcess = exec(nameToolCommand , function (error1, stdout1, stderr1) { if (error1 !== null) { console.log('Error setting up the lib path to ' + 'odbc_bindings.node file.Error trace:\n'+error1); process.exit(1); } }); } removeUsedPackages(); }); } //buildBinary
0
TypeScript
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
testSplitMaliciousUriUsername() { const uri = 'https://malicious.com\\@test.google.com'; assertEquals('https', utils.getScheme(uri)); assertEquals('malicious.com', utils.getDomain(uri)); assertEquals('malicious.com', utils.getDomainEncoded(uri)); assertNull(utils.getPort(uri)); assertEquals('\\@test.google.com', utils.getPathEncoded(uri)); assertEquals('\\@test.google.com', utils.getPath(uri)); assertNull(utils.getQueryData(uri)); assertNull(utils.getFragmentEncoded(uri)); assertNull(utils.getFragment(uri)); },
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
link: new ApolloLink((operation, forward) => { return forward(operation).map(response => { const context = operation.getContext(); const { response: { headers }, } = context; expect(headers.get('access-control-allow-origin')).toEqual('*'); checked = true; return response; }); }).concat(
1
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
from: db.getServerTitle() + " <" + db.getReturnAddress() + ">", subject: subject, text: text, }; sendEmail(sendOptions); };
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
read(data) { return this._zlib.writeSync(data, false); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function escapeShellArg(arg) { return arg.replace(/'/g, `'\\''`); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
const {type, store = JsonEntityStore.from(type), ...next} = options; const propertiesMap = getPropertiesStores(store); let keys = Object.keys(src); const additionalProperties = propertiesMap.size ? !!store.schema.get("additionalProperties") || options.additionalProperties : true; const out: any = new type(src); propertiesMap.forEach((propStore) => { const key = propStore.parent.schema.getAliasOf(propStore.propertyName) || propStore.propertyName; keys = keys.filter((k) => k !== key); let value = alterValue(propStore.schema, src[key], {...options, self: src}); next.type = propStore.computedType; if (propStore.schema.hasGenerics) { next.nestedGenerics = propStore.schema.nestedGenerics; } else if (propStore.schema.isGeneric && options.nestedGenerics) { const [genericTypes = [], ...nestedGenerics] = options.nestedGenerics; const genericLabels = propStore.parent.schema.genericLabels || []; next.type = genericTypes[genericLabels.indexOf(propStore.schema.genericType)] || Object; next.nestedGenerics = nestedGenerics; } value = deserialize(value, { ...next, collectionType: propStore.collectionType }); if (value !== undefined) { out[propStore.propertyName] = value; } }); if (additionalProperties) { keys.forEach((key) => { out[key] = src[key]; }); } return out; }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
export async function validateTransfer( connection: Connection, signature: TransactionSignature, { recipient, amount, splToken, reference, memo }: ValidateTransferFields, options?: { commitment?: Finality } ): Promise<TransactionResponse> { const response = await connection.getTransaction(signature, options); if (!response) throw new ValidateTransferError('not found'); const message = response.transaction.message; const meta = response.meta; if (!meta) throw new ValidateTransferError('missing meta'); if (meta.err) throw meta.err; const [preAmount, postAmount] = splToken ? await validateSPLTokenTransfer(message, meta, recipient, splToken) : await validateSystemTransfer(message, meta, recipient); if (postAmount.minus(preAmount).lt(amount)) throw new ValidateTransferError('amount not transferred'); if (reference) { if (!Array.isArray(reference)) { reference = [reference]; } for (const pubkey of reference) { if (!message.accountKeys.some((accountKey) => accountKey.equals(pubkey))) throw new ValidateTransferError('reference not found'); } } // FIXME: add memo check return response; }
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
.catch(error => { // There was an error with the session token const result = {}; if (error && error.code === Parse.Error.INVALID_SESSION_TOKEN) { result.error = error; this.authCache.set( sessionToken, Promise.resolve(result), this.config.cacheTimeout ); } else {
1
TypeScript
CWE-672
Operation on a Resource after Expiration or Release
The software uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked.
https://cwe.mitre.org/data/definitions/672.html
safe
Object.keys(data).forEach((key) => { obj.add(deserializer(data[key], baseType) as T); });
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
export declare function setDeepProperty(obj: { [key: string]: any; }, propertyPath: string, value: any): void; export declare function getDeepProperty(obj: any, propertyPath: string): any;
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
Server.loadMyself((anyMe: Me | NU, stuffForMe?: StuffForMe) => { // @ifdef DEBUG // Might happen if there was no weakSessionId, and also, no cookie. dieIf(!anyMe, 'TyE4032SMH57'); // @endif const newMe = anyMe as Me; if (isInSomeEmbCommentsIframe()) { // Tell the embedded comments or embedded editor iframe that we just logged in, // also include the session id, so Talkyard's script on the embedding page // can remember it — because cookies and localstorage in an iframe typically // get disabled by tracker blockers (they block 3rd party cookies). const mainWin = getMainWin(); const typs: PageSession = mainWin.typs; const weakSessionId = typs.weakSessionId; const store: Store = ReactStore.allData(); const settings: SettingsVisibleClientSide = store.settings; const rememberEmbSess = settings.rememberEmbSess !== false && // If we got logged in automatically, then logout will be automatic too // — could be surprising if we had to click buttons to log out, // when we didn't need to do that, to log in. typs.sessType !== SessionType.AutoTokenSiteCustomSso; if (mainWin !== window) { mainWin.theStore.me = _.cloneDeep(newMe); } sendToOtherIframes([ 'justLoggedIn', { user: newMe, stuffForMe, weakSessionId, pubSiteId: eds.pubSiteId, // [JLGDIN] sessionType: null, rememberEmbSess }]); } setNewMe(newMe, stuffForMe); if (afterwardsCallback) { afterwardsCallback(); } });
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
function normalizeConfigFile(data: ParsedIniData): ParsedIniData { const map: ParsedIniData = {}; for (const key of Object.keys(data)) { let matches: Array<string> | null; if (key === "default") { map.default = data.default; } else if ((matches = profileKeyRegex.exec(key))) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const [_1, _2, normalizedKey] = matches; if (normalizedKey) { map[normalizedKey] = data[key]; } } } return map; }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
skip: (n) => { if (buffer && n > 0) pos += n; },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function bigIntToBuffer(bn) { let hex = bn.toString(16); if ((hex.length & 1) !== 0) { hex = `0${hex}`; } else { const sigbit = hex.charCodeAt(0); // BER/DER integers require leading zero byte to denote a positive value // when first byte >= 0x80 if (sigbit === 56 || (sigbit >= 97 && sigbit <= 102)) hex = `00${hex}`; } return Buffer.from(hex, 'hex'); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function addEmailAddresses(userId: UserId, emailAddress: string, success: UserAcctRespHandler) { postJsonSuccess('/-/add-email-address', success, { userId, emailAddress }); }
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
html: html({ url, host, email }), }) },
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
constructor( private readonly ptarmiganService: PtarmiganService, private readonly bitcoinService: BitcoinService, private readonly cacheService: CacheService, private readonly invoicesGateway: InvoicesGateway ) { }
0
TypeScript
CWE-295
Improper Certificate Validation
The software does not validate, or incorrectly validates, a certificate.
https://cwe.mitre.org/data/definitions/295.html
vulnerable
function ivIncrement(iv) { ++iv[11] >>> 8 && ++iv[10] >>> 8 && ++iv[9] >>> 8 && ++iv[8] >>> 8 && ++iv[7] >>> 8 && ++iv[6] >>> 8 && ++iv[5] >>> 8 && ++iv[4] >>> 8; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
verifyEmail(req) { const { token, username } = req.query; const appId = req.params.appId; const config = Config.get(appId); if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } if (!token || !username) { return this.invalidLink(req); } const userController = config.userController; return userController.verifyEmail(username, token).then( () => { const params = qs.stringify({ username }); return Promise.resolve({ status: 302, location: `${config.verifyEmailSuccessURL}?${params}`, }); }, () => { return this.invalidVerificationLink(req); } ); }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function addSockListeners() { if (!accept && !reject) { sock.once('connect', onconnect); sock.on('data', ondata); sock.once('error', onerror); sock.once('close', onclose); } else { var chan; sock.once('connect', function() { chan = accept(); var isDone = false; function onDone() { if (isDone) return; sock.destroy(); isDone = true; } chan.once('end', onDone) .once('close', onDone) .on('data', function(data) { sock.write(data); }); sock.on('data', function(data) { chan.write(data); }); }); sock.once('close', function() { if (!chan) reject(); }); } }
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
func cssGogsMinCssMap() (*asset, error) { bytes, err := cssGogsMinCssMapBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "css/gogs.min.css.map", size: 22926, mode: os.FileMode(0644), modTime: time.Unix(1584214336, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x89, 0xb2, 0x95, 0x91, 0xfb, 0x5c, 0xda, 0xff, 0x63, 0x54, 0xc5, 0x91, 0xbf, 0x7a, 0x5a, 0xb5, 0x3d, 0xf, 0xf, 0x84, 0x41, 0x2d, 0xc3, 0x18, 0xf5, 0x74, 0xd7, 0xa9, 0x84, 0x70, 0xce}} return a, nil }
0
TypeScript
CWE-281
Improper Preservation of Permissions
The software does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.
https://cwe.mitre.org/data/definitions/281.html
vulnerable
export async function loadFromGit(input: Input): Promise<string | never> { try { return await new Promise((resolve, reject) => { exec(createCommand(input), { encoding: 'utf-8', maxBuffer: 1024 * 1024 * 1024 }, (error, stdout) => { if (error) { reject(error); } else { resolve(stdout); } }); }); } catch (error) { throw createLoadError(error); } }
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
constructor() { super(); this.proc = undefined; this.buffer = null; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
timingSafeEquals: (a, b) => { if (a.length !== b.length) { timingSafeEqual_(a, a); return false; } return timingSafeEqual_(a, b); },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function cloneMirrorTask(repo: string | undefined, directory: string | undefined, customArgs: string[]): StringTask<string> { append(customArgs,'--mirror'); return cloneTask(repo, directory, customArgs); }
0
TypeScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The software constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
html: html({ url, host, theme }), }) const failed = result.rejected.concat(result.pending).filter(Boolean) if (failed.length) { throw new Error(`Email(s) (${failed.join(", ")}) could not be sent`) } }, options, } }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
session: session.fromPartition('about-window'), spellcheck: false, webviewTag: false, }, width: WINDOW_SIZE.WIDTH, }); aboutWindow.setMenuBarVisibility(false); // Prevent any kind of navigation // will-navigate is broken with sandboxed env, intercepting requests instead // see https://github.com/electron/electron/issues/8841 aboutWindow.webContents.session.webRequest.onBeforeRequest(async ({url}, callback) => { // Only allow those URLs to be opened within the window if (ABOUT_WINDOW_ALLOWLIST.includes(url)) { return callback({cancel: false}); } // Open HTTPS links in browser instead if (url.startsWith('https://')) { await shell.openExternal(url); } else { logger.info(`Attempt to open URL "${url}" in window prevented.`); callback({redirectURL: ABOUT_HTML}); } }); // Locales ipcMain.on(EVENT_TYPE.ABOUT.LOCALE_VALUES, (event, labels: locale.i18nLanguageIdentifier[]) => { if (aboutWindow) { const isExpected = event.sender.id === aboutWindow.webContents.id; if (isExpected) { const resultLabels: Record<string, string> = {}; labels.forEach(label => (resultLabels[label] = locale.getText(label))); event.sender.send(EVENT_TYPE.ABOUT.LOCALE_RENDER, resultLabels); } } }); // Close window via escape aboutWindow.webContents.on('before-input-event', (_event, input) => { if (input.type === 'keyDown' && input.key === 'Escape') { if (aboutWindow) { aboutWindow.close(); } } }); aboutWindow.on('closed', () => (aboutWindow = undefined)); await aboutWindow.loadURL(ABOUT_HTML); if (aboutWindow) { aboutWindow.webContents.send(EVENT_TYPE.ABOUT.LOADED, { copyright: config.copyright, electronVersion: config.version, productName: config.name, webappVersion, }); } } aboutWindow.show(); };
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function onconnect() { var buf; if (isSigning) { /* byte SSH2_AGENTC_SIGN_REQUEST string key_blob string data uint32 flags */ var p = 9; buf = Buffer.allocUnsafe(4 + 1 + 4 + keylen + 4 + datalen + 4); writeUInt32BE(buf, buf.length - 4, 0); buf[4] = SIGN_REQUEST; writeUInt32BE(buf, keylen, 5); key.copy(buf, p); writeUInt32BE(buf, datalen, p += keylen); data.copy(buf, p += 4); writeUInt32BE(buf, 0, p += datalen); sock.write(buf); } else { /* byte SSH2_AGENTC_REQUEST_IDENTITIES */ sock.write(Buffer.from([0, 0, 0, 1, REQUEST_IDENTITIES])); } }
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
use: path => { useCount++; expect(path).toEqual('somepath'); },
1
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
static buildGenesisOpReturn(config: configBuildGenesisOpReturn, type = 0x01) { let hash; try { hash = config.hash!.toString('hex') } catch (_) { hash = null } return SlpTokenType1.buildGenesisOpReturn( config.ticker, config.name, config.documentUri, hash, config.decimals, config.batonVout, config.initialQuantity, type ) }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
declare function getSetCookie(cookieName: string, value?: string, options?: any): string; // backw compat, later, do once per file instead (don't want a global 'r'). // // ReactDOMFactories looks like: // // var ReactDOMFactories = { // a: createDOMFactory('a'), // abbr: ... // // function createDOMFactory(type) { // var factory = React.createElement.bind(null, type); // factory.type = type; // makes: `<Foo />.type === Foo` work // return factory; // }; // // and React.createElement(type: keyof ReactHTML, props, ...children) returns: // DetailedReactHTMLElement<P, T> // const r: { [elmName: string]: (props?: any, ...children) => RElm } = ReactDOMFactories;
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
var cleanUrl = function(url) { url = decodeURIComponent(url); while(url.indexOf('..') >= 0) { url = url.replace('..', ''); } return url; };
1
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
_resolvePath(path = '.') { // Unix separators normalize nicer on both unix and win platforms const resolvedPath = path.replace(WIN_SEP_REGEX, '/'); // Join cwd with new path const joinedPath = nodePath.isAbsolute(resolvedPath) ? nodePath.normalize(resolvedPath) : nodePath.join('/', this.cwd, resolvedPath); // Create local filesystem path using the platform separator const fsPath = nodePath.resolve(nodePath.join(this.root, joinedPath) .replace(UNIX_SEP_REGEX, nodePath.sep) .replace(WIN_SEP_REGEX, nodePath.sep)); // Create FTP client path using unix separator const clientPath = joinedPath.replace(WIN_SEP_REGEX, '/'); return { clientPath, fsPath }; }
1
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
content: Buffer.concat(buffers), mimeType: resp.headers["content-type"] || null, }); });
0
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
([ key, value ]) => ({ [key]: exec.bind(null, value) }), ),
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
export function createCatalogWriteAction() { return createTemplateAction<{ name?: string; entity: Entity }>({ id: 'catalog:write', description: 'Writes the catalog-info.yaml for your template', schema: { input: { type: 'object', properties: { entity: { title: 'Entity info to write catalog-info.yaml', description: 'You can provide the same values used in the Entity schema.', type: 'object', }, }, }, }, async handler(ctx) { ctx.logStream.write(`Writing catalog-info.yaml`); const { entity } = ctx.input; await fs.writeFile( resolvePath(ctx.workspacePath, 'catalog-info.yaml'), yaml.stringify(entity), ); }, }); }
0
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
use: (path) => { useCount++; expect(path).toEqual('somepath'); }, }) ).not.toThrow(); expect(useCount).toBeGreaterThan(0); });
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
async resolve(_source, _args, context, queryInfo) { try { const { config, info } = context; return await getUserFromSessionToken( config, info, queryInfo, 'user.', false ); } catch (e) { parseGraphQLSchema.handleError(e); } },
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function parseIni(iniData: string): ParsedIniData { const map: ParsedIniData = {}; let currentSection: string | undefined; for (let line of iniData.split(/\r?\n/)) { line = line.split(/(^|\s)[;#]/)[0]; // remove comments const section = line.match(/^\s*\[([^\[\]]+)]\s*$/); if (section) { currentSection = section[1]; } else if (currentSection) { const item = line.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/); if (item) { map[currentSection] = map[currentSection] || {}; map[currentSection][item[1]] = item[2]; } } } return map; }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
function setPath(document, keyPath, value) { if (!document) { throw new Error('No document was provided.'); } let {indexOfDot, currentKey, remainingKeyPath} = computeStateInformation(keyPath); // if (currentKey === '__proto__' || currentKey === 'prototype' && Object.prototype.hasOwnProperty.call(document, currentKey)) { if (currentKey === '__proto__') { // Refuse to modify anything on __proto__, return the document return document; } else if (indexOfDot >= 0) { // If there is a '.' in the keyPath, recur on the subdoc and ... if (!document[currentKey] && Array.isArray(document)) { // If this is an array and there are multiple levels of keys to iterate over, recur. return document.forEach((doc) => setPath(doc, keyPath, value)); } else if (!document[currentKey]) { // If the currentKey doesn't exist yet, populate it document[currentKey] = {}; } setPath(document[currentKey], remainingKeyPath, value); } else if (Array.isArray(document)) { // If this "document" is actually an array, then we can loop over each of the values and set the path return document.forEach((doc) => setPath(doc, remainingKeyPath, value)); } else { // Otherwise, we can set the path directly document[keyPath] = value; } return document; }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
requestResetPassword(req) { const config = req.config; if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } const { username, token } = req.query; if (!username || !token) { return this.invalidLink(req); } return config.userController.checkResetTokenValidity(username, token).then( () => { const params = qs.stringify({ token, id: config.applicationId, username, app: config.appName, }); return Promise.resolve({ status: 302, location: `${config.choosePasswordURL}?${params}`, }); }, () => { return this.invalidLink(req); } ); }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function detailedDataTableMapper(entry) { const project = Projects.findOne({ _id: entry.projectId }) const mapping = [project ? project.name : '', dayjs.utc(entry.date).format(getGlobalSetting('dateformat')), entry.task, projectUsers.findOne() ? projectUsers.findOne().users.find((elem) => elem._id === entry.userId)?.profile?.name : ''] if (getGlobalSetting('showCustomFieldsInDetails')) { if (CustomFields.find({ classname: 'time_entry' }).count() > 0) { for (const customfield of CustomFields.find({ classname: 'time_entry' }).fetch()) { mapping.push(entry[customfield[customFieldType]]) } } if (CustomFields.find({ classname: 'project' }).count() > 0) { for (const customfield of CustomFields.find({ classname: 'project' }).fetch()) { mapping.push(project[customfield[customFieldType]]) } } } if (getGlobalSetting('showCustomerInDetails')) { mapping.push(project ? project.customer : '') } if (getGlobalSetting('useState')) { mapping.push(entry.state) } mapping.push(Number(timeInUserUnit(entry.hours))) mapping.push(entry._id) return mapping }
0
TypeScript
CWE-1236
Improper Neutralization of Formula Elements in a CSV File
The software saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by spreadsheet software.
https://cwe.mitre.org/data/definitions/1236.html
vulnerable
get: (path) => { useCount++; expect(path).toEqual('somepath'); },
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
on(eventName: "message", eventHandler: (message: Buffer) => void): this;
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
etsyApiFetch(endpoint, options) { this._assumeField('endpoint', endpoint); return new Promise((resolve, reject) => { const getQueryString = queryString.stringify(this.getOptions(options)); fetch(`${this.apiUrl}${endpoint}?${getQueryString}`) .then(response => EtsyClient._response(response, resolve, reject)) .catch(reject); }); }
0
TypeScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
var getDefaultObject = function () { return { nested: { thing: { foo: 'bar' }, is: { cool: true } }, dataUndefined: undefined, dataDate: now, dataNumber: 42, dataString: 'foo', dataNull: null, dataBoolean: true }; };
0
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
vulnerable
export function parse(data: string, params?: IParseConfig): IIniObject { const { delimiter = '=', comment = ';', nothrow = false, autoTyping = true, dataSections = [], } = { ...params }; let typeParser: ICustomTyping; if (typeof autoTyping === 'function') { typeParser = autoTyping; } else { typeParser = autoTyping ? <ICustomTyping> autoType : (val) => val; } const lines: string[] = data.split(/\r?\n/g); let lineNumber = 0; let currentSection: string = ''; let isDataSection: boolean = false; const result: IIniObject = {}; for (const rawLine of lines) { lineNumber += 1; const line: string = rawLine.trim(); if ((line.length === 0) || (line.startsWith(comment))) { continue; } else if (line[0] === '[') { const match = line.match(sectionNameRegex); if (match !== null) { currentSection = match[1].trim(); isDataSection = dataSections.includes(currentSection); if (!(currentSection in result)) { result[currentSection] = (isDataSection) ? [] : {}; } continue; } } else if (isDataSection) { (<IniValue[]>result[currentSection]).push(rawLine); continue; } else if (line.includes(delimiter)) { const posOfDelimiter: number = line.indexOf(delimiter); const name = line.slice(0, posOfDelimiter).trim(); const rawVal = line.slice(posOfDelimiter + 1).trim(); const val = typeParser(rawVal, currentSection, name); if (currentSection !== '') { (<IIniObjectSection>result[currentSection])[name] = val; } else { result[name] = val; } continue; } const error = new ParsingError(line, lineNumber); if (!nothrow) { throw error; } else if ($Errors in result) { (<ParsingError[]>result[$Errors]).push(error); } else { result[$Errors] = [error]; } } return result; }
0
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
vulnerable
function foo() { var_dump(substr_compare("\x00", "\x00\x00\x00\x00\x00\x00\x00\x00", 0, 65535, false)); }
1
TypeScript
CWE-125
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/125.html
safe
constructor(connection, {root, cwd} = {}) { this.connection = connection; this.cwd = nodePath.normalize(cwd ? nodePath.join(nodePath.sep, cwd) : nodePath.sep); this._root = nodePath.resolve(root || process.cwd()); }
0
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
Object.keys(data).forEach((key) => { obj.set(key, ctx.next(data[key]) as T); });
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
text: () => string ): { destroy: () => void; update: (t: () => string) => void } {
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
@action gotoUrl = (_url) => { let url = (_url || this.nextUrl).trim().replace(/\/+$/, ''); if (!hasProtocol.test(url)) { url = `https://${url}`; } return this.generateToken(url).then(() => { transaction(() => { this.setNextUrl(url); this.setCurrentUrl(this.nextUrl); }); }); }
1
TypeScript
CWE-346
Origin Validation Error
The software does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
safe
export function setByKeyPath(obj, keyPath, value) { if (!obj || keyPath === undefined) return; if ('isFrozen' in Object && Object.isFrozen(obj)) return; if (typeof keyPath !== 'string' && 'length' in keyPath) { assert(typeof value !== 'string' && 'length' in value); for (var i = 0, l = keyPath.length; i < l; ++i) { setByKeyPath(obj, keyPath[i], value[i]); } } else { var period = keyPath.indexOf('.'); if (period !== -1) { var currentKeyPath = keyPath.substr(0, period); var remainingKeyPath = keyPath.substr(period + 1); if (remainingKeyPath === "") if (value === undefined) { if (isArray(obj) && !isNaN(parseInt(currentKeyPath))) obj.splice(currentKeyPath, 1); else delete obj[currentKeyPath]; } else obj[currentKeyPath] = value; else { var innerObj = obj[currentKeyPath]; if (!innerObj) innerObj = (obj[currentKeyPath] = {}); setByKeyPath(innerObj, remainingKeyPath, value); } } else { if (value === undefined) { if (isArray(obj) && !isNaN(parseInt(keyPath))) obj.splice(keyPath, 1); else delete obj[keyPath]; } else obj[keyPath] = value; } } }
0
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
vulnerable
function applyCommandArgs(configuration, argv) { if (!argv || !argv.length) { return; } argv = argv.slice(2); const parsedArgv = yargs(argv); const argvKeys = Object.keys(parsedArgv); if (!argvKeys.length) { return; } debug("Appling command arguments:", parsedArgv); if (parsedArgv.config) { const configFile = path.resolve(process.cwd(), parsedArgv.config); applyConfigFile(configuration, configFile); } for (const key in parsedArgv) { if (!parsedArgv.hasOwnProperty(key)) { continue; } const configKey = key .replace(/_/g, "."); debug(`Found config value from cmd args '${key}' to '${configKey}'`); setDeepProperty(configuration, configKey, parsedArgv[key]); } }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
function foo() { var_dump(substr_compare("\x00", "\x00\x00\x00\x00\x00\x00\x00\x00", 0, 65535, false)); }
1
TypeScript
CWE-190
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
https://cwe.mitre.org/data/definitions/190.html
safe
alloc(payloadSize, force) { return Buffer.allocUnsafe(payloadSize); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
Object.keys(req.query as any).length ? validateOrReject(Object.assign(new Validators.Query(), req.query as any), validatorOptions) : null ])
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function genOpenSSHECDSAPub(oid, Q) { let curveName; switch (oid) { case '1.2.840.10045.3.1.7': // prime256v1/secp256r1 curveName = 'nistp256'; break; case '1.3.132.0.34': // secp384r1 curveName = 'nistp384'; break; case '1.3.132.0.35': // secp521r1 curveName = 'nistp521'; break; default: return; } const publicKey = Buffer.allocUnsafe(4 + 19 + 4 + 8 + 4 + Q.length); writeUInt32BE(publicKey, 19, 0); publicKey.utf8Write(`ecdsa-sha2-${curveName}`, 4, 19); writeUInt32BE(publicKey, 8, 23); publicKey.utf8Write(curveName, 27, 8); writeUInt32BE(publicKey, Q.length, 35); publicKey.set(Q, 39); return publicKey; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function cloneTask(repo: string | undefined, directory: string | undefined, customArgs: string[]): StringTask<string> { const commands = ['clone', ...customArgs]; if (typeof repo === 'string') { commands.push(repo); } if (typeof directory === 'string') { commands.push(directory); } return straightThroughStringTask(commands); }
0
TypeScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The software constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable