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
function genOpenSSLECDSAPubFromPriv(curveName, priv) { const tempECDH = createECDH(curveName); tempECDH.setPrivateKey(priv); return tempECDH.getPublicKey(); }
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
readString: (dest, maxLen) => { if (typeof dest === 'number') { maxLen = dest; dest = undefined; } const len = self.readUInt32BE(); if (len === undefined) return; if ((buffer.length - pos) < len || (typeof maxLen === 'number' && len > maxLen)) { return; } if (dest) { if (Buffer.isBuffer(dest)) return bufferCopy(buffer, dest, pos, pos += len); return buffer.utf8Slice(pos, pos += len); } return bufferSlice(buffer, pos, pos += len); },
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 setProp(obj: {[key: string]: any}, property: string, value: any): void { if (!obj.hasOwnProperty(property)) { throw new Error(`Property '${property}' is not valid`); } obj[property] = value; }
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
async validate(token: string) { const apiToken = await this.authService.validateApiToken(token); if (!apiToken) { throw new UnauthorizedException(); } return apiToken; }
1
TypeScript
CWE-295
Improper Certificate Validation
The software does not validate, or incorrectly validates, a certificate.
https://cwe.mitre.org/data/definitions/295.html
safe
const filter = (val) => { return filterXSS(val, { // @ts-ignore whiteList: [], stripIgnoreTag: true, stripIgnoreTagBody: ["script"] }) }
1
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
safe
get(`/-/load-email-addrs-login-methods?userId=${userId}`, response => { success(response); });
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
export function orderLinks<T extends NameAndType>(links: T[]) { const [provided, unknown] = partition<T>(links, isProvided); return [ ...sortBy(provided, link => PROVIDED_TYPES.indexOf(link.type)), ...sortBy(unknown, link => link.name && link.name.toLowerCase()) ]; }
1
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
safe
parseKey: (data, passphrase) => { if (Buffer.isBuffer(data)) data = data.utf8Slice(0, data.length).trim(); else if (typeof data !== 'string') return new Error('Key data must be a Buffer or string'); else data = data.trim(); // eslint-disable-next-line eqeqeq if (passphrase != undefined) { if (typeof passphrase === 'string') passphrase = Buffer.from(passphrase); else if (!Buffer.isBuffer(passphrase)) return new Error('Passphrase must be a string or Buffer when supplied'); } let ret; // Private keys if ((ret = OpenSSH_Private.parse(data, passphrase)) !== null) return ret; if ((ret = OpenSSH_Old_Private.parse(data, passphrase)) !== null) return ret; if ((ret = PPK_Private.parse(data, passphrase)) !== null) return ret; // Public keys if ((ret = OpenSSH_Public.parse(data)) !== null) return ret; if ((ret = RFC4716_Public.parse(data)) !== null) return ret; return new Error('Unsupported key format'); }
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
body: JSON.stringify({ ...keys, _SessionToken: { $regex: this.partialSessionToken, }, _method: 'GET', }), }); fail('should not work'); } catch (e) { expect(e.data.code).toEqual(209); expect(e.data.error).toEqual('Invalid session token'); } });
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
create = (profile) => { const rockUpdateFields = this.mapApollosFieldsToRock(profile); return this.post('/People', { Gender: 0, // required by Rock. Listed first so it can be overridden. ...rockUpdateFields, IsSystem: false, // required by rock }); };
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
function _close(engine) { // Caller may invoke .close after a zlib error (which will null _handle). if (!engine._handle) return; engine._handle.close(); engine._handle = 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
constructor(line: string, lineNumber: number) { super(`Unsupported type of line: [${lineNumber}]"${line}"`); this.line = line; this.lineNumber = lineNumber; }
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
privateKey: this.getPrivateKey() || undefined, securityMode: this.securityMode }); this._requests = {}; this.messageBuilder .on("message", (response: Response, msgType: string, requestId: number) => { this._on_message_received(response, msgType, requestId); }) .on("start_chunk", () => { // if (doPerfMonitoring) { this._tick2 = get_clock_tick(); } }) .on("error", (err, requestId) => { // let requestData = this._requests[requestId]; if (doDebug) { debugLog("request id = ", requestId, err); debugLog(" message was "); debugLog(requestData); } if (!requestData) { requestData = this._requests[requestId + 1]; if (doTraceClientRequestContent) { errorLog(" message was 2:", requestData ? requestData.request.toString() : "<null>"); } } }); this.__in_normal_close_operation = false; this._timeout_request_count = 0; this._securityTokenTimeoutId = null; this.transportTimeout = options.transportTimeout || ClientSecureChannelLayer.defaultTransportTimeout; this.channelId = 0; this.connectionStrategy = coerceConnectionStrategy(options.connectionStrategy); }
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
function setPath(document, keyPath, value) { if (!document) { throw new Error('No document was provided.'); } else if (!keyPath) { throw new Error('No keyPath was provided.'); } // If this is clearly a prototype pollution attempt, then refuse to modify the path if (keyPath.startsWith('__proto__') || keyPath.startsWith('constructor')) { return document; } return _setPath(document, keyPath, value); }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
constructor(private organizationUsersService: OrganizationUsersService) {}
0
TypeScript
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
bufferFill: (buf, value, start, end) => { return TypedArrayFill.call(buf, value, start, end); },
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
search.stats = function(files) { if(files.length) { var file = files.shift(); fs.stat(relativePath + '/' + file, function(err, stats) { if(err) { writeError(err); } else { stats.name = file; stats.isFile = stats.isFile(); stats.isDirectory = stats.isDirectory(); stats.isBlockDevice = stats.isBlockDevice(); stats.isFIFO = stats.isFIFO(); stats.isSocket = stats.isSocket(); results.push(stats); search.stats(files); } }); } else { if(query.type == 'json' || query.dir == 'json') { res.setHeader('Content-Type', 'application/json'); res.write(JSON.stringify(results)); res.end(); } else { res.setHeader('Content-Type', 'text/html'); res.write('<html><body>'); for(var f = 0; f < results.length; f++) { var name = results[f].name; var normalized = url + '/' + name; while(normalized[0] == '/') { normalized = normalized.slice(1, normalized.length); } if(normalized.indexOf('"') >= 0) throw new Error('unsupported file name') name = name.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); res.write('\r\n<p><a href="/' + normalized + '"><span>' + name + '</span></a></p>'); } res.end('\r\n</body></html>'); } } };
1
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
safe
private getVCSBlamer(): (path: string) => {} {
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 = objectKeys(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; }
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
allocPacket(payloadLen) { let pktLen = 4 + 1 + payloadLen; let padLen = 8 - (pktLen & (8 - 1)); if (padLen < 4) padLen += 8; pktLen += padLen; const packet = Buffer.allocUnsafe(pktLen); writeUInt32BE(packet, pktLen - 4, 0); packet[4] = padLen; randomFillSync(packet, 5 + payloadLen, padLen); return packet; }
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
@action gotoUrl = (_url) => { transaction(() => { let url = (_url || this.nextUrl).trim().replace(/\/+$/, ''); if (!hasProtocol.test(url)) { url = `https://${url}`; } this.setNextUrl(url); this.setCurrentUrl(this.nextUrl); }); }
0
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
vulnerable
public static preSendSlpJudgementCheck(txo: SlpAddressUtxoResult, tokenId: string) { if (txo.slpUtxoJudgement === undefined || txo.slpUtxoJudgement === null || txo.slpUtxoJudgement === SlpUtxoJudgement.UNKNOWN) { throw Error("There at least one input UTXO that does not have a proper SLP judgement"); } if (txo.slpUtxoJudgement === SlpUtxoJudgement.UNSUPPORTED_TYPE) { throw Error("There is at least one input UTXO that is an Unsupported SLP type."); } if (txo.slpUtxoJudgement === SlpUtxoJudgement.SLP_BATON) { throw Error("There is at least one input UTXO that is a baton. \ You can only spend batons in a MINT transaction."); } if (txo.slpTransactionDetails) { if (txo.slpUtxoJudgement === SlpUtxoJudgement.SLP_TOKEN) { if (!txo.slpUtxoJudgementAmount) { throw Error("There is at least one input token that does not \ have the 'slpUtxoJudgementAmount' property set."); } if (txo.slpTransactionDetails.tokenIdHex !== tokenId) { throw Error("There is at least one input UTXO that \ is a different SLP token than the one specified."); } return txo.slpTransactionDetails.tokenIdHex === tokenId; } } return false; }
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
onWrite: () => {},
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
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
private onWebSocket(req, socket, websocket) { websocket.on("error", onUpgradeError); if ( transports[req._query.transport] !== undefined && !transports[req._query.transport].prototype.handlesUpgrades ) { debug("transport doesnt handle upgraded requests"); websocket.close(); return; } // get client id const id = req._query.sid; // keep a reference to the ws.Socket req.websocket = websocket; if (id) { const client = this.clients[id]; if (!client) { debug("upgrade attempt for closed client"); websocket.close(); } else if (client.upgrading) { debug("transport has already been trying to upgrade"); websocket.close(); } else if (client.upgraded) { debug("transport had already been upgraded"); websocket.close(); } else { debug("upgrading existing transport"); // transport error handling takes over websocket.removeListener("error", onUpgradeError); const transport = this.createTransport(req._query.transport, req); if (req._query && req._query.b64) { transport.supportsBinary = false; } else { transport.supportsBinary = true; } transport.perMessageDeflate = this.opts.perMessageDeflate; client.maybeUpgrade(transport); } } else { // transport error handling takes over websocket.removeListener("error", onUpgradeError); const closeConnection = (errorCode, errorContext) => abortUpgrade(socket, errorCode, errorContext); this.handshake(req._query.transport, req, closeConnection); } function onUpgradeError() { debug("websocket error before upgrade"); // websocket.close() not needed } }
0
TypeScript
CWE-754
Improper Check for Unusual or Exceptional Conditions
The software does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the software.
https://cwe.mitre.org/data/definitions/754.html
vulnerable
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(
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 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 [email protected]", message.request.toString(), "\n", response1.toString() ); } // istanbul ignore next throw err; } }
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
function combineBuffers(buf1, buf2) { const result = Buffer.allocUnsafe(buf1.length + buf2.length); result.set(buf1, 0); result.set(buf2, buf1.length); return result; }
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, `'\\''`); }
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
public static buildMintOpReturn(config: configBuildMintOpReturn, type = 0x01) { return SlpTokenType1.buildMintOpReturn( config.tokenIdHex, config.batonVout, config.mintQuantity, type, ); }
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
readRaw: (len) => { if (!buffer) return; if (typeof len !== 'number') return bufferSlice(buffer, pos, pos += (buffer.length - pos)); if ((buffer.length - pos) >= len) return bufferSlice(buffer, pos, pos += len); }, }; return self; }
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
public static buildSendOpReturn(config: configBuildSendOpReturn, type = 0x01) { return SlpTokenType1.buildSendOpReturn( config.tokenIdHex, config.outputQtyArray, type, ); }
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
ipBlacklist() { const instance = Template.instance(); return instance.ipBlacklist.get(); },
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
objectKeys(data).forEach((key) => { obj.add(deserializer(data[key], baseType) as T); });
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
export function patternWithWordBreak(regExp: RegExp): RegExp { return RegExp("" + regExp.source); }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
...(options.role === 'anon' ? {} : { user: { title: 'System Task', role: options.role } }), res: {}, t(key, options = {}) { return self.apos.i18n.i18next.t(key, { ...options, lng: req.locale }); }, data: {}, protocol: 'http', get: function (propName) { return { Host: 'you-need-to-set-baseUrl-in-app-js.com' }[propName]; }, query: {}, url: '/', locale: self.apos.argv.locale || self.apos.modules['@apostrophecms/i18n'].defaultLocale, mode: 'published', aposNeverLoad: {}, aposStack: [], __(key) { self.apos.util.warnDevOnce('old-i18n-req-helper', stripIndent` The req.__() and res.__() functions are deprecated and do not localize in A3. Use req.t instead. `); return key; } }; addCloneMethod(req); req.res.__ = req.__; const { role, ..._properties } = options || {}; Object.assign(req, _properties); self.apos.i18n.setPrefixUrls(req); return req; function addCloneMethod(req) { req.clone = (properties = {}) => { const _req = { ...req, ...properties }; self.apos.i18n.setPrefixUrls(_req); addCloneMethod(_req); return _req; }; } },
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 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-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
return filterXSS(`<div id="config">${JSON.stringify(config)}</div>`, { whiteList: { div: ['id'] }, }) }
1
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
safe
get: ({ params }) => ({ status: 200, body: { id: params.userId, name: 'bbb' } }) }))
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
Object.keys(obj).forEach((propertyName: string) => { const propertyMetadata = ConverterService.getPropertyMetadata(properties, propertyName); return this.convertProperty(obj, instance, propertyName, propertyMetadata, options); });
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
readList: () => { const list = self.readString(true); if (list === undefined) return; return (list ? list.split(',') : []); },
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
async resolve(_source, _args, context, queryInfo) { try { return await getUserFromSessionToken( context, queryInfo, 'user.', false ); } catch (e) { parseGraphQLSchema.handleError(e); } },
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
export default function addStickyControl() { extend(DiscussionListState.prototype, 'requestParams', function(params) { if (app.current.matches(IndexPage) || app.current.matches(DiscussionPage)) { params.include.push('firstPost'); } }); extend(DiscussionListItem.prototype, 'infoItems', function(items) { const discussion = this.attrs.discussion; if (discussion.isSticky() && !this.attrs.params.q && !discussion.lastReadPostNumber()) { const firstPost = discussion.firstPost(); if (firstPost) { const excerpt = truncate(firstPost.contentPlain(), 175); // Wrapping in <div> because ItemList entries need to be vnodes items.add('excerpt', <div>{excerpt}</div>, -100); } } }); }
1
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
safe
TEST_F(AsStringGraphTest, NoScientificForNonFloat) { Status s = Init(DT_INT32, /*fill=*/"", /*width=*/-1, /*precision=*/-1, /*scientific=*/true); ASSERT_EQ(error::INVALID_ARGUMENT, s.code()); ASSERT_TRUE(absl::StrContains( s.error_message(), "scientific and shortest format not supported for datatype")); }
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
PageantSock.prototype.connect = function() { this.emit('connect'); };
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
const convertStringToObject = (sourceLine: string): BlamedLine => { const matches = sourceLine.match( /(.+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (\+|\-)\d{4})\s+(\d+)\)(.*)/ ); const [, rev, author, date, , line] = matches ? [...matches] : []; return { author, date, line, rev }; };
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 deepExtend(target: unknown, source: unknown): unknown { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! const dateValue = source as Date; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (const prop in source) { if (!source.hasOwnProperty(prop)) { continue; } (target as { [key: string]: unknown })[prop] = deepExtend( (target as { [key: string]: unknown })[prop], (source as { [key: string]: unknown })[prop] ); } return target; }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
private _readPacketInfo(data: Buffer) { return this.readMessageFunc(data); }
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
constructor( private readonly ptarmiganService: PtarmiganService, private readonly bitcoinService: BitcoinService, private readonly cacheService: CacheService, private readonly invoicesGateway: InvoicesGateway, ) { }
1
TypeScript
CWE-295
Improper Certificate Validation
The software does not validate, or incorrectly validates, a certificate.
https://cwe.mitre.org/data/definitions/295.html
safe
Status Init(DataType input_type, const string& fill = "", int width = -1, int precision = -1, bool scientific = false, bool shortest = false) { TF_CHECK_OK(NodeDefBuilder("op", "AsString") .Input(FakeInput(input_type)) .Attr("fill", fill) .Attr("precision", precision) .Attr("scientific", scientific) .Attr("shortest", shortest) .Attr("width", width) .Finalize(node_def())); return InitOp(); }
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
event.reply = (...args: any[]) => { event.sender.sendToFrame([processId, frameId], ...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
function process_request_callback(requestData: RequestData, err?: Error | null, response?: Response) { assert(typeof requestData.callback === "function"); const request = requestData.request; if (!response && !err && requestData.msgType !== "CLO") { // this case happens when CLO is called and when some pending transactions // remains in the queue... err = new Error(" Connection has been closed by client , but this transaction cannot be honored"); } if (response && response instanceof ServiceFault) { response.responseHeader.stringTable = [...(response.responseHeader.stringTable || [])]; err = new Error(" serviceResult = " + response.responseHeader.serviceResult.toString()); // " returned by server \n response:" + response.toString() + "\n request: " + request.toString()); (err as any).response = response; ((err as any).request = request), (response = undefined); } const theCallbackFunction = requestData.callback; /* istanbul ignore next */ if (!theCallbackFunction) { throw new Error("Internal error"); } assert(requestData.msgType === "CLO" || (err && !response) || (!err && response)); // let set callback to undefined to prevent callback to be called again requestData.callback = undefined; theCallbackFunction(err || null, !err && response !== null ? response : undefined); }
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
function networkStats(ifaces, callback) { let ifacesArray = []; // fallback - if only callback is given if (util.isFunction(ifaces) && !callback) { callback = ifaces; ifacesArray = [getDefaultNetworkInterface()]; } else { ifaces = ifaces || getDefaultNetworkInterface(); ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|'); ifacesArray = ifaces.split('|'); } return new Promise((resolve) => { process.nextTick(() => { const result = []; const workload = []; if (ifacesArray.length && ifacesArray[0].trim() === '*') { ifacesArray = []; networkInterfaces(false).then(allIFaces => { for (let iface of allIFaces) { ifacesArray.push(iface.iface); } networkStats(ifacesArray.join(',')).then(result => { if (callback) { callback(result); } resolve(result); }); }); } else { for (let iface of ifacesArray) { workload.push(networkStatsSingle(iface.trim())); } if (workload.length) { Promise.all( workload ).then(data => { if (callback) { callback(data); } resolve(data); }); } else { if (callback) { callback(result); } resolve(result); } } }); }); }
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
function reduce(obj, str) { "use strict"; try { if ( typeof str !== "string") { return; } if ( typeof obj !== "object") { return; } return str.split('.').reduce(indexFalse, obj); } 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
signBufferFunc: (chunk: Buffer) => makeMessageChunkSignatureWithDerivedKeys(chunk, derivedKeys), signatureLength: derivedKeys.signatureLength, sequenceHeaderSize: 0, }; const securityHeader = new SymmetricAlgorithmSecurityHeader({ tokenId: 10 }); const msgChunkManager = new SecureMessageChunkManager("MSG", options, securityHeader, sequenceNumberGenerator); msgChunkManager.on("chunk", (chunk, final) => callback(null, chunk)); msgChunkManager.write(buffer, buffer.length); msgChunkManager.end(); }
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
const cb = (err) => { if (err) { return Logger.error(`Removing responded user from Polls collection: ${err}`); } return Logger.info(`Removed responded user=${requesterUserId} from poll (meetingId: ${meetingId}, ` + `pollId: ${pollId}!)`); };
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
sendMail: () => {},
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 genOpenSSHRSAPub(n, e) { const publicKey = Buffer.allocUnsafe(4 + 7 + 4 + e.length + 4 + n.length); writeUInt32BE(publicKey, 7, 0); publicKey.utf8Write('ssh-rsa', 4, 7); let i = 4 + 7; writeUInt32BE(publicKey, e.length, i); publicKey.set(e, i += 4); writeUInt32BE(publicKey, n.length, i += e.length); publicKey.set(n, i + 4); 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
formatMessage() { if (this.isATweet) { const withUserName = this.message.replace( TWITTER_USERNAME_REGEX, TWITTER_USERNAME_REPLACEMENT ); const withHash = withUserName.replace( TWITTER_HASH_REGEX, TWITTER_HASH_REPLACEMENT ); const markedDownOutput = marked(withHash); return markedDownOutput; } return marked(this.message, { breaks: true, gfm: true }); }
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
export function fetchRemoteBranch(remote: string, remoteBranch: string, cwd: string) { const results = git(["fetch", remote, remoteBranch], { cwd }); if (!results.success) { throw gitError(`Cannot fetch remote: ${remote} ${remoteBranch}`); } }
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
function writeUInt32BE(buf, value, offset) { buf[offset++] = (value >>> 24); buf[offset++] = (value >>> 16); buf[offset++] = (value >>> 8); buf[offset++] = value; return offset; }
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
clip: Object.assign({ x: 0, y: 0 }, dimensions) }, provider.getScreenshotOptions(options))); return output; }
0
TypeScript
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
private _renew_security_token() { doDebug && debugLog("ClientSecureChannelLayer#_renew_security_token"); // istanbul ignore next if (!this.isValid()) { // this may happen if the communication has been closed by the client or the sever warningLog("Invalid socket => Communication has been lost, cannot renew token"); return; } const isInitial = false; this._open_secure_channel_request(isInitial, (err?: Error | null) => { /* istanbul ignore else */ if (!err) { doDebug && debugLog(" token renewed"); /** * notify the observers that the security has been renewed * @event security_token_renewed */ this.emit("security_token_renewed"); } else { if (doDebug) { debugLog("ClientSecureChannelLayer: Warning: securityToken hasn't been renewed -> err ", err); } // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX CHECK ME !!! this.closeWithError(new Error("Restarting because Request has timed out during OpenSecureChannel"), () => { /* */ }); } }); }
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
const unSet = (obj, path, options = {}, tracking = {}) => { let internalPath = path; options = { "transformRead": returnWhatWasGiven, "transformKey": returnWhatWasGiven, "transformWrite": returnWhatWasGiven, ...options }; // No object data if (obj === undefined || obj === null) { return; } // No path string if (!internalPath) { return; } internalPath = clean(internalPath); // Path is not a string, throw error if (typeof internalPath !== "string") { throw new Error("Path argument must be a string"); } if (typeof obj !== "object") { return; } const newObj = decouple(obj, options); // Path has no dot-notation, set key/value if (isNonCompositePath(internalPath)) { if (newObj.hasOwnProperty(unEscape(internalPath))) { delete newObj[options.transformKey(unEscape(internalPath))]; return newObj; } tracking.returnOriginal = true; return obj; } const pathParts = split(internalPath); const pathPart = pathParts.shift(); const transformedPathPart = options.transformKey(unEscape(pathPart)); let childPart = newObj[transformedPathPart]; if (!childPart) { // No child part available, nothing to unset! tracking.returnOriginal = true; return obj; } newObj[transformedPathPart] = unSet(childPart, pathParts.join('.'), options, tracking); if (tracking.returnOriginal) { return obj; } return newObj; };
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 default async function email( identifier: string, options: InternalOptions<"email"> ) { const { url, adapter, provider, logger, callbackUrl } = options // Generate token const token = (await provider.generateVerificationToken?.()) ??
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
write(buf) { if (this.buffer === null) { this.buffer = buf; } else { this.buffer = Buffer.concat([this.buffer, buf], this.buffer.length + buf.length); } // Wait for at least all length bytes if (this.buffer.length < 4) return; const len = readUInt32BE(this.buffer, 0); // Make sure we have a full message before querying pageant if ((this.buffer.length - 4) < len) return; buf = this.buffer.slice(0, 4 + len); if (this.buffer.length > (4 + len)) this.buffer = this.buffer.slice(4 + len); else this.buffer = null; let hadError = false; const proc = this.proc = spawn(EXEPATH, [ buf.length ]); proc.stdout.on('data', (data) => { this.emit('data', data); }); proc.once('error', (err) => { if (!hadError) { hadError = true; this.emit('error', err); } }); proc.once('close', (code) => { this.proc = undefined; let err; if (!hadError && (err = ERROR[code])) { hadError = true; this.emit('error', err); } this.emit('close', hadError); }); proc.stdin.end(buf); }
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 getProp(obj: {[key: string]: any}, property: string): any { if (!obj.hasOwnProperty(property)) { throw new Error(`Property '${property}' is not valid`); } return obj[property]; }
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
set escape_for_html(arg:boolean) { this._escape_for_html = arg; }
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
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'); }); }); });
1
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
safe
export function buildQueryString(params: Object, traditional?: Boolean): string { let pairs = []; let keys = Object.keys(params || {}).sort(); for (let i = 0, len = keys.length; i < len; i++) { let key = keys[i]; pairs = pairs.concat(buildParam(key, params[key], traditional)); } if (pairs.length === 0) { return ''; } return pairs.join('&'); }
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
{ host: serverB.getUrl(), clientAuthToken: serverB.authKey, enterprise: false }, ], }) garden.events.emit("_test", "foo") // Make sure events are flushed await streamer.close() expect(serverEventBusA.eventLog).to.eql([{ name: "_test", payload: "foo" }]) expect(serverEventBusB.eventLog).to.eql([{ name: "_test", payload: "foo" }]) })
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
export function render_markdown_timestamp(time: number | Date): { text: string; tooltip_content: string; } { const hourformat = user_settings.twenty_four_hour_time ? "HH:mm" : "h:mm a"; const timestring = format(time, "E, MMM d yyyy, " + hourformat); const tz_offset_str = get_tz_with_UTC_offset(time); const tooltip_html_content = render_markdown_time_tooltip({tz_offset_str}); return { text: timestring, tooltip_content: tooltip_html_content, }; }
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(seqno, onPayload) { this.inSeqno = seqno; this._onPayload = onPayload; this._len = 0; this._lenBytes = 0; this._packet = null; this._packetPos = 0; }
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 type ReadMessageFuncType = (data: Buffer) => PacketInfo;
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
constructor() { // All construction occurs here this.setup_palettes(); this._use_classes = false; this._escape_for_html = true; this.bold = false; this.fg = this.bg = null; this._buffer = ''; this._url_whitelist = { 'http':1, 'https':1 }; }
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
const registerProxy = async fastify => { fastify.register(proxy, { upstream: backendURL + backendPath, ...proxyOptions }) }
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
pubSSH = genOpenSSHECDSAPub(oid, ecpub); break; } default: return new Error(`Unsupported OpenSSH public key type: ${baseType}`); } return new OpenSSH_Public(fullType, comment, pubPEM, pubSSH, algo); }
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 const initAuth0: InitAuth0 = (params) => { const { baseConfig, nextConfig } = getConfig(params); // Init base layer (with base config) const getClient = clientFactory(baseConfig, { name: 'nextjs-auth0', version }); const transientStore = new TransientStore(baseConfig); const cookieStore = new CookieStore(baseConfig); const sessionCache = new SessionCache(baseConfig, cookieStore); const baseHandleLogin = baseLoginHandler(baseConfig, getClient, transientStore); const baseHandleLogout = baseLogoutHandler(baseConfig, getClient, sessionCache); const baseHandleCallback = baseCallbackHandler(baseConfig, getClient, sessionCache, transientStore); // Init Next layer (with next config) const getSession = sessionFactory(sessionCache); const getAccessToken = accessTokenFactory(nextConfig, getClient, sessionCache); const withApiAuthRequired = withApiAuthRequiredFactory(sessionCache); const withPageAuthRequired = withPageAuthRequiredFactory(nextConfig.routes.login, getSession); const handleLogin = loginHandler(baseHandleLogin, nextConfig); const handleLogout = logoutHandler(baseHandleLogout); const handleCallback = callbackHandler(baseHandleCallback, nextConfig); const handleProfile = profileHandler(getClient, getAccessToken, sessionCache); const handleAuth = handlerFactory({ handleLogin, handleLogout, handleCallback, handleProfile }); return { getSession, getAccessToken, withApiAuthRequired, withPageAuthRequired, handleLogin, handleLogout, handleCallback, handleProfile, handleAuth }; };
0
TypeScript
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
vulnerable
function genOpenSSLEdPub(pub) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); // algorithm asnWriter.startSequence(); asnWriter.writeOID('1.3.101.112'); // id-Ed25519 asnWriter.endSequence(); // PublicKey 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; asnWriter.endSequence(); asnWriter.endSequence(); return makePEM('PUBLIC', 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
onBannerChange (input: HTMLInputElement) { this.bannerfileInput = new ElementRef(input) const bannerfile = this.bannerfileInput.nativeElement.files[0] if (bannerfile.size > this.maxBannerSize) { this.notifier.error('Error', $localize`This image is too large.`) return } const formData = new FormData() formData.append('bannerfile', bannerfile) this.bannerPopover?.close() this.bannerChange.emit(formData) if (this.previewImage) { this.preview = this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(bannerfile)) } }
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
clear: () => { buffer = undefined; },
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
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
[path]: await parseResult(result.stdout) }; }
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 cleaner() { setTimeout(() => { if (ids.length < 1) { return; } ActiveRooms.forEach((element, index) => { element.Players.forEach((element2, index2) => { if (!ids.includes(element2.Id)) { ActiveRooms[index].Players.splice(index2, 1); ActiveRooms[index].Players.forEach((element3) => { element3.socket.emit('UserLeave', JSON.stringify({ RoomId: element.Id, UserLeaved: element2.Id })); }); } }); }); ActiveRooms.forEach((element, index) => { if (element.Players.length === 0) { ActiveRooms.splice(index, 1); } }); // ids = []; }, 5000); }
0
TypeScript
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
function simulateTransation(request: FindServersRequest, response: FindServersResponse, callback: SimpleCallback) { serverSChannel.once("message", (message: Message) => { doDebug && console.log("server receiving message =", response.responseHeader.requestHandle); response.responseHeader.requestHandle = message.request.requestHeader.requestHandle; serverSChannel.send_response("MSG", response, message, () => { /** */ doDebug && console.log("server message sent ", response.responseHeader.requestHandle); }); }); doDebug && console.log(" now sending a request " + request.constructor.name); clientChannel.performMessageTransaction(request, (err, response) => { doDebug && console.log("client received a response ", response?.constructor.name); doDebug && console.log(response?.toString()); callback(err || undefined); }); }
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
function userBroadcast(msg, source) { const sourceMsg = `> ${msg}`; const name = `{cyan-fg}{bold}${source.name}{/}`; msg = `: ${msg}`; for (const user of users) { const output = user.output; if (source === user) output.add(sourceMsg); else output.add(formatMessage(name, output) + msg); } }
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
onPayload: () => {},
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
Languages.get = async function (language, namespace) { const pathToLanguageFile = path.join(languagesPath, language, `${namespace}.json`); if (!pathToLanguageFile.startsWith(languagesPath)) { throw new Error('[[error:invalid-path]]'); } const data = await fs.promises.readFile(pathToLanguageFile, 'utf8'); const parsed = JSON.parse(data) || {}; const result = await plugins.hooks.fire('filter:languages.get', { language, namespace, data: parsed, }); return result.data; };
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
userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name,
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
'X-Parse-Session-Token': user5.getSessionToken(), }) ).data.find.edges.map((object) => object.node.someField) ).toEqual(['someValue3']); });
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 at(target, path, update) { path = pathToArray(path); if (! path.length) { return update(target, null); } const key = path[0]; if (isNumber(key)) { if (! Array.isArray(target)) { target = []; } } else if (! isObject(target)) { target = {}; } validateKey(key); if (path.length > 1) { target[key] = at(target[key], path.slice(1), update); } else { target = update(target, key); } return target; }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
TEST(TensorSliceTest, BuildTensorSlice) { TensorSliceProto proto; TensorSlice({{0, -1}, {0, 10}, {14, 1}}).AsProto(&proto); TensorSlice s; // Successful building. { TF_ASSERT_OK(TensorSlice::BuildTensorSlice(proto, &s)); EXPECT_EQ("-:0,10:14,1", s.DebugString()); } // Failed building due to negative extent start. { TensorSliceProto invalid_proto = proto; invalid_proto.mutable_extent(0)->set_start(-1); EXPECT_FALSE(TensorSlice::BuildTensorSlice(invalid_proto, &s).ok()); } // Failed building due to negative extent length. { TensorSliceProto invalid_proto = proto; invalid_proto.mutable_extent(2)->set_length(-1); EXPECT_FALSE(TensorSlice::BuildTensorSlice(invalid_proto, &s).ok()); } // Failed building due to missing extent length. { TensorSliceProto invalid_proto = proto; invalid_proto.mutable_extent(2)->clear_length(); EXPECT_FALSE(TensorSlice::BuildTensorSlice(invalid_proto, &s).ok()); } // Failed building due to extent end overflowing. { TensorSliceProto invalid_proto = proto; invalid_proto.mutable_extent(2)->set_length( std::numeric_limits<int64_t>::max()); EXPECT_FALSE(TensorSlice::BuildTensorSlice(invalid_proto, &s).ok()); } }
1
TypeScript
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
function genOpenSSLDSAPub(p, q, g, y) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); // algorithm asnWriter.startSequence(); asnWriter.writeOID('1.2.840.10040.4.1'); // id-dsa // algorithm parameters asnWriter.startSequence(); asnWriter.writeBuffer(p, Ber.Integer); asnWriter.writeBuffer(q, Ber.Integer); asnWriter.writeBuffer(g, Ber.Integer); asnWriter.endSequence(); asnWriter.endSequence(); // subjectPublicKey asnWriter.startSequence(Ber.BitString); asnWriter.writeByte(0x00); asnWriter.writeBuffer(y, Ber.Integer); asnWriter.endSequence(); asnWriter.endSequence(); return makePEM('PUBLIC', 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
doFatalError: (protocol, msg, level, reason) => { let err; if (DISCONNECT_REASON === undefined) ({ DISCONNECT_REASON } = require('./utils.js')); if (msg instanceof Error) { // doFatalError(protocol, err[, reason]) err = msg; if (typeof level !== 'number') reason = DISCONNECT_REASON.PROTOCOL_ERROR; else reason = level; } else { // doFatalError(protocol, msg[, level[, reason]]) err = makeError(msg, level, true); } if (typeof reason !== 'number') reason = DISCONNECT_REASON.PROTOCOL_ERROR; protocol.disconnect(reason); protocol._destruct(); protocol._onError(err); return Infinity; },
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 openExternalLink(link) { let u; try { u = url.parse(link); } catch (e) { return; } if (protocolRegex.test(u.protocol)) { shell.openExternal(link); } }
1
TypeScript
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
function localMessage(msg, source) { var output = source.output; output.add(formatMessage(msg, output)); }
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
function makePEM(type, data) { data = data.base64Slice(0, data.length); let formatted = data.replace(/.{64}/g, '$&\n'); if (data.length & 63) formatted += '\n'; return `-----BEGIN ${type} KEY-----\n${formatted}-----END ${type} KEY-----`; }
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
var cleanUrl = function(url) { url = decodeURIComponent(url); while(url.indexOf('..').length > 0) { url = url.replace('..', ''); } return url; };
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
export function suspendUser(userId: UserId, numDays: number, reason: string, success: () => void) {
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
async convert(input, options) { this[_validate](); options = this[_parseOptions](options); const output = await this[_convert](input, options); return output; }
0
TypeScript
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable