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)) { ...
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 != un...
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.err...
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,...
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.startsWit...
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...
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...
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 + payloa...
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 ha...
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 t...
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(); ...
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')...
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(c...
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.loca...
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 === e...
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(item...
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 suppor...
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 = ...
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) ...
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 an...
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().t...
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...
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.le...
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 = ma...
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...
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 ...
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;...
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 ...
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
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.ev...
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(tim...
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 CookieSt...
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(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
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...
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...
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); resp...
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 p...
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 t...
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 (pat...
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 nega...
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)...
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 = DISCONNEC...
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 t...
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