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 genOpenSSHDSAPub(p, q, g, y) { const publicKey = Buffer.allocUnsafe( 4 + 7 + 4 + p.length + 4 + q.length + 4 + g.length + 4 + y.length ); writeUInt32BE(publicKey, 7, 0); publicKey.utf8Write('ssh-dss', 4, 7); let i = 4 + 7; writeUInt32BE(publicKey, p.length, i); publicKey.set(p, i += 4); writeUInt32BE(publicKey, q.length, i += p.length); publicKey.set(q, i += 4); writeUInt32BE(publicKey, g.length, i += q.length); publicKey.set(g, i += 4); writeUInt32BE(publicKey, y.length, i += g.length); publicKey.set(y, 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
.on("message", (request, msgType, requestId, channelId) => { this._on_common_message(request, msgType, requestId, channelId); })
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
): { destroy: () => void; update: (t: () => string) => void } {
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function exportBranch(req, res) { const {branchId, type, format, version, taskId} = req.params; const branch = becca.getBranch(branchId); if (!branch) { const message = `Cannot export branch ${branchId} since it does not exist.`; log.error(message); res.status(500).send(message); return; } const taskContext = new TaskContext(taskId, 'export'); try { if (type === 'subtree' && (format === 'html' || format === 'markdown')) { zipExportService.exportToZip(taskContext, branch, format, res); } else if (type === 'single') { singleExportService.exportSingleNote(taskContext, branch, format, res); } else if (format === 'opml') { opmlExportService.exportToOpml(taskContext, branch, version, res); } else { return [404, "Unrecognized export format " + format]; } } catch (e) { const message = "Export failed with following error: '" + e.message + "'. More details might be in the logs."; taskContext.reportError(message); log.error(message + e.stack); res.status(500).send(message); } }
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 async function createCsrfTag(ctx: AppContext) { const token = await createCsrfToken(ctx); return `<input type="hidden" name="_csrf" value="${escapeHtml(token)}"/>`; }
1
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
wsHandler: (conn, req) => { conn.write(req.url) conn.end() } }) t.teardown(() => backend.close()) const backendURL = await backend.listen(0) const [frontend, frontendURL] = await proxyServer(t, backendURL, backendPath, proxyOptions, wrapperOptions) t.teardown(() => frontend.close()) for (const path of paths) { await processRequest(t, frontendURL, path, expected(path)) } t.end() })
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
async showExportDialogEvent({notePath, defaultType}) { // each opening of the dialog resets the taskId, so we don't associate it with previous exports anymore this.taskId = ''; this.$exportButton.removeAttr("disabled"); if (defaultType === 'subtree') { this.$subtreeType.prop("checked", true).trigger('change'); // to show/hide OPML versions this.$widget.find("input[name=export-subtree-format]:checked").trigger('change'); } else if (defaultType === 'single') { this.$singleType.prop("checked", true).trigger('change'); } else { throw new Error("Unrecognized type " + defaultType); } this.$widget.find(".opml-v2").prop("checked", true); // setting default utils.openDialog(this.$widget); const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); this.branchId = await froca.getBranchId(parentNoteId, noteId); const noteTitle = await treeService.getNoteTitle(noteId); this.$noteTitle.html(noteTitle); }
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
calculateGenesisCost(genesisOpReturnLength: number, inputUtxoSize: number, batonAddress: string|null, bchChangeAddress?: string, feeRate = 1) { return this.calculateMintOrGenesisCost(genesisOpReturnLength, inputUtxoSize, batonAddress, bchChangeAddress, feeRate); }
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
const getNftParentId = async (tokenIdHex: string) => { const txnhex = (await asyncSlpValidator.getRawTransactions([tokenIdHex]))[0]; const tx = Primatives.Transaction.parseFromBuffer(Buffer.from(txnhex, "hex")); const nftBurnTxnHex = (await asyncSlpValidator.getRawTransactions([tx.inputs[0].previousTxHash]))[0]; const nftBurnTxn = Primatives.Transaction.parseFromBuffer(Buffer.from(nftBurnTxnHex, "hex")); const slp = new Slp(this.BITBOX); const nftBurnSlp = slp.parseSlpOutputScript(Buffer.from(nftBurnTxn.outputs[0].scriptPubKey)); if (nftBurnSlp.transactionType === SlpTransactionType.GENESIS) { return tx.inputs[0].previousTxHash; } else { return nftBurnSlp.tokenIdHex; } };
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
`${c.amount(d.value, d.name)}<em>${day(d.date)}</em>`, }); }
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
module.exports = function (url, options) { return fetch(url, options); };
1
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
safe
module.exports = function(key) { key = normalizeKey(key.split('@').pop()); return normalized[key] || false; };
0
TypeScript
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The software constructs a string for a command to executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.
https://cwe.mitre.org/data/definitions/88.html
vulnerable
function getHomeDir(): string { const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env; if (HOME) return HOME; if (USERPROFILE) return USERPROFILE; if (HOMEPATH) return `${HOMEDRIVE}${HOMEPATH}`; return homedir(); }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
response.responseHeader.serviceResult.should.eql(StatusCodes.BadDiscoveryUrlMissing); } await send_registered_server_request(discoveryServerEndpointUrl, request, check_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
putComment(comment, isMarkdown, commentId, author) { const { pageId, revisionId } = this.getPageContainer().state; return this.appContainer.apiPost('/comments.update', { commentForm: { comment, page_id: pageId, revision_id: revisionId, is_markdown: isMarkdown, comment_id: commentId, author, }, }) .then((res) => { if (res.ok) { return this.retrieveComments(); } }); }
0
TypeScript
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
function info(sslName, len, actualLen, isETM) { return { sslName, len, actualLen, isETM, }; }
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
requestResetPassword(req) { const config = req.config; if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } const { username, token: rawToken } = req.query; const token = rawToken && typeof rawToken !== 'string' ? rawToken.toString() : rawToken; if (!username || !token) { return this.invalidLink(req); } return config.userController.checkResetTokenValidity(username, token).then( () => { const params = qs.stringify({ token, id: config.applicationId, username, app: config.appName, }); return Promise.resolve({ status: 302, location: `${config.choosePasswordURL}?${params}`, }); }, () => { return this.invalidLink(req); } ); }
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
text(notificationName, data) { const username = `<span>${formatUsername(data.display_username)}</span>`; let description; if (data.topic_title) { description = `<span data-topic-id="${this.attrs.topic_id}">${data.topic_title}</span>`; } else { description = this.description(data); } return I18n.t(data.message, { description, username }); },
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 uploader = multer({ dest: path.join(__dirname, '.upload'), limits: { fileSize: 1024 ** 3 }, ...options.multer }).any() app.get(`${basePath}/`, [ hooks0.onRequest, ctrlHooks0.onRequest, createValidateHandler(req => [ Object.keys(req.query).length ? validateOrReject(Object.assign(new Validators.Query(), req.query), validatorOptions) : null ]), asyncMethodToHandler(controller0.get) ]) app.post(`${basePath}/`, [ hooks0.onRequest, ctrlHooks0.onRequest, uploader, formatMulterData([]), createValidateHandler(req => [ validateOrReject(Object.assign(new Validators.Query(), req.query), validatorOptions), validateOrReject(Object.assign(new Validators.Body(), req.body), validatorOptions) ]), methodToHandler(controller0.post) ]) app.get(`${basePath}/empty/noEmpty`, [ hooks0.onRequest, methodToHandler(controller1.get) ]) app.post(`${basePath}/multiForm`, [ hooks0.onRequest, uploader, formatMulterData([['empty', false], ['vals', false], ['files', false]]), createValidateHandler(req => [ validateOrReject(Object.assign(new Validators.MultiForm(), req.body), validatorOptions) ]), methodToHandler(controller2.post) ]) app.get(`${basePath}/texts`, [ hooks0.onRequest, methodToHandler(controller3.get) ]) app.put(`${basePath}/texts`, [ hooks0.onRequest, methodToHandler(controller3.put) ]) app.put(`${basePath}/texts/sample`, [ hooks0.onRequest, parseJSONBoby, methodToHandler(controller4.put) ]) app.get(`${basePath}/users`, [ hooks0.onRequest, hooks1.onRequest, ...ctrlHooks1.preHandler, asyncMethodToHandler(controller5.get) ]) app.post(`${basePath}/users`, [ hooks0.onRequest, hooks1.onRequest, parseJSONBoby, createValidateHandler(req => [ validateOrReject(Object.assign(new Validators.UserInfo(), req.body), validatorOptions) ]), ...ctrlHooks1.preHandler, methodToHandler(controller5.post) ]) return app }
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
async signup(params: any) { // Check if the installation allows user signups if (process.env.DISABLE_SIGNUPS === 'true') { return {}; } const { email } = params; const existingUser = await this.usersService.findByEmail(email); if (existingUser) { throw new NotAcceptableException('Email already exists'); } const organization = await this.organizationsService.create('Untitled organization'); const user = await this.usersService.create({ email }, organization, ['all_users', 'admin']); // eslint-disable-next-line @typescript-eslint/no-unused-vars const organizationUser = await this.organizationUsersService.create(user, organization); await this.emailService.sendWelcomeEmail(user.email, user.firstName, user.invitationToken); return {}; }
0
TypeScript
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
TEST_F(AsStringGraphTest, Bool) { TF_ASSERT_OK(Init(DT_BOOL)); AddInputFromArray<bool>(TensorShape({2}), {true, false}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({2})); test::FillValues<tstring>(&expected, {"true", "false"}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
function indexer(set) { return function (obj, i) { "use strict"; try { if (obj && i && obj.hasOwnProperty(i)) { return obj[i]; } else if (obj && i && set) { obj[i] = {}; return obj[i]; } return; } catch (ex) { console.error(ex); return; } }; }
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
function setByPath(target, path, value) { path = pathToArray(path); if (! path.length) { return value; } 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] = setByPath(target[key], path.slice(1), value); } else { target[key] = value; } return target; }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
].forEach((testCase) => { let errorChecks = testCase[1]; if (!Array.isArray(errorChecks)) errorChecks = [errorChecks[0], errorChecks[0]]; for (const input of testCase[0]) { assert.throws(() => createCipher(input), errorChecks[0]); assert.throws(() => createDecipher(input), errorChecks[1]); } });
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 stringifySnapshots (snapshots: any, pretty = false) { return JSON.stringify(snapshots, (key, value) => { if (['sender', 'webContents'].includes(key)) { return '[WebContents]'; } if (key === 'openerId' && typeof value === 'number') { return 'placeholder-opener-id'; } if (key === 'processId' && typeof value === 'number') { return 'placeholder-process-id'; } if (key === 'returnValue') { return 'placeholder-guest-contents-id'; } return value; }, pretty ? 2 : undefined); }
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
userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name, totalHours, }
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
asnWriter.endSequence(); return asnWriter.buffer; } default: return sig; } },
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 render_markdown_timestamp(time: number | Date): { text: string; tooltip_content_html: 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_content_html = render_markdown_time_tooltip({tz_offset_str}); return { text: timestring, tooltip_content_html: tooltip_content_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
func cssGogsMinCssMap() (*asset, error) { bytes, err := cssGogsMinCssMapBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "css/gogs.min.css.map", size: 22926, mode: os.FileMode(0644), modTime: time.Unix(1584215361, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x89, 0xb2, 0x95, 0x91, 0xfb, 0x5c, 0xda, 0xff, 0x63, 0x54, 0xc5, 0x91, 0xbf, 0x7a, 0x5a, 0xb5, 0x3d, 0xf, 0xf, 0x84, 0x41, 0x2d, 0xc3, 0x18, 0xf5, 0x74, 0xd7, 0xa9, 0x84, 0x70, 0xce}} return a, nil }
1
TypeScript
CWE-281
Improper Preservation of Permissions
The software does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.
https://cwe.mitre.org/data/definitions/281.html
safe
const escapedHost = `${host.replace(/\./g, "&#8203;.")}` // Some simple styling options const backgroundColor = "#f9f9f9" const textColor = "#444444" const mainBackgroundColor = "#ffffff" const buttonBackgroundColor = "#346df1" const buttonBorderColor = "#346df1" const buttonTextColor = "#ffffff" return ` <body style="background: ${backgroundColor};"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" style="padding: 10px 0px 20px 0px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};"> <strong>${escapedHost}</strong> </td> </tr> </table> <table width="100%" border="0" cellspacing="20" cellpadding="0" style="background: ${mainBackgroundColor}; max-width: 600px; margin: auto; border-radius: 10px;"> <tr> <td align="center" style="padding: 10px 0px 0px 0px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};"> Sign in as <strong>${escapedEmail}</strong> </td> </tr> <tr> <td align="center" style="padding: 20px 0;"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" style="border-radius: 5px;" bgcolor="${buttonBackgroundColor}"><a href="${url}" target="_blank" style="font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${buttonTextColor}; text-decoration: none; border-radius: 5px; padding: 10px 20px; border: 1px solid ${buttonBorderColor}; display: inline-block; font-weight: bold;">Sign in</a></td> </tr> </table> </td> </tr> <tr> <td align="center" style="padding: 0px 0px 10px 0px; font-size: 16px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; color: ${textColor};"> If you did not request this email you can safely ignore it. </td> </tr> </table> </body> ` }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function bufferSlice(buf, start, end) { if (end === undefined) end = buf.length; return new FastBuffer(buf.buffer, buf.byteOffset + start, end - start); }
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
new Promise((resolve, reject) => {
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
function collideObjects(obj1: any, obj2: any, path: string, modifiers?: ICollideModifiers): any { if (!isObject(obj2)) { throw new Error(`Unable to collide. Collide value at path ${path} is not an object.`); } if (modifiers && modifiers[path]) { return modifiers[path](obj1, obj2); } for (const key of Object.keys(obj2)) { const subPath = path + '.' + key; if (obj1[key] === undefined) { obj1[key] = obj2[key]; } else { if (modifiers && modifiers[subPath]) { obj1[key] = modifiers[subPath](obj1[key], obj2[key]); } else { obj1[key] = collideUnsafe(obj1[key], obj2[key], modifiers, subPath); } } } return obj1; }
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
schemaTypeOptions = {...schemaTypeOptions, type: getSchema(propertyMetadata.type)}; } schemaTypeOptions = cleanObject({...schemaTypeOptions, ...rawMongooseSchema}); if (propertyMetadata.isCollection) { if (propertyMetadata.isArray) { schemaTypeOptions = [schemaTypeOptions]; } else { // Can be a Map or a Set; // Mongoose implements only Map; if (propertyMetadata.collectionType !== Map) { throw new Error(`Invalid collection type. ${propertyMetadata.collectionName} is not supported.`); } schemaTypeOptions = {type: Map, of: schemaTypeOptions}; } } return schemaTypeOptions; }
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
scroll_to_bottom_key: common.has_mac_keyboard() ? "Fn + <span class='tooltip_right_arrow'>→</span>" : "End", }), ); $(`.enter_sends_${user_settings.enter_sends}`).show(); common.adjust_mac_shortcuts(".enter_sends kbd"); }
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
message: new MockBuilder( { from: 'test@valid.sender', to: '-d0.1a@example.com' }, 'message\r\nline 2' ) }, function (err, data) { expect(err).to.exist; expect(data).to.not.exist; expect(output).to.equal(''); client._spawn.restore(); done(); } ); });
1
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
safe
function validateBaseUrl(url: string) { // from this MIT-licensed gist: https://gist.github.com/dperini/729294 return /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
encrypt(packet) { // `packet` === unencrypted packet if (this._dead) return; this._onWrite(packet); this.outSeqno = (this.outSeqno + 1) >>> 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
get lokadIdHex() { return "534c5000" }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function check_response(err: Error | null, response: any) { should.not.exist(err); //xx debugLog(response.toString()); response.responseHeader.serviceResult.should.eql(StatusCodes.BadInvalidArgument); }
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
objectKeys(data).forEach((key) => { obj.add(ctx.next(data[key])); });
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
TEST_F(AsStringGraphTest, FillWithZero) { TF_ASSERT_OK(Init(DT_INT64, /*fill=*/"0", /*width=*/4)); AddInputFromArray<int64>(TensorShape({3}), {-42, 0, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({3})); test::FillValues<tstring>(&expected, {"-042", "0000", "0042"}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
connect() { this.emit('connect'); }
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
.catch(error => { // There was an error with the session token const result = {}; if (error && error.code === Parse.Error.INVALID_SESSION_TOKEN) { // Store a resolved promise with the error for 10 minutes result.error = error; this.authCache.set( sessionToken, Promise.resolve(result), 60 * 10 * 1000 ); } else {
0
TypeScript
CWE-672
Operation on a Resource after Expiration or Release
The software uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked.
https://cwe.mitre.org/data/definitions/672.html
vulnerable
constructor(config) { const enc = config.outbound; this.outSeqno = enc.seqno; this._onWrite = enc.onWrite; this._encKeyMain = enc.cipherKey.slice(0, 32); this._encKeyPktLen = enc.cipherKey.slice(32); this._dead = false; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function exportVariable(name: string, val: any): void { const convertedVal = toCommandValue(val) process.env[name] = convertedVal const filePath = process.env['GITHUB_ENV'] || '' if (filePath) { const delimiter = '_GitHubActionsFileCommandDelimeter_' const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}` issueFileCommand('ENV', commandValue) } else { issueCommand('set-env', {name}, convertedVal) } }
0
TypeScript
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
static buildMintOpReturn(config: configBuildMintOpReturn, type = 0x01) { return SlpTokenType1.buildMintOpReturn( config.tokenIdHex, config.batonVout, config.mintQuantity, type ) }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
ctx.prompt(prompt, function retryPrompt(answers) { if (answers.length === 0) return ctx.reject(['keyboard-interactive']); nick = answers[0]; if (nick.length > MAX_NAME_LEN) { return ctx.prompt(`That nickname is too long.\n${PROMPT_NAME}`, retryPrompt); } else if (nick.length === 0) { return ctx.prompt(`A nickname is required.\n${PROMPT_NAME}`, retryPrompt); } lowered = nick.toLowerCase(); for (const user of users) { if (user.name.toLowerCase() === lowered) { return ctx.prompt(`That nickname is already in use.\n${PROMPT_NAME}`, retryPrompt); } } name = nick; ctx.accept(); });
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 showWarningDialog = (message: string): void => { const options: MessageBoxSyncOptions = { buttons: ['OK'], message, title: 'Warning', type: 'warning', }; dialog.showMessageBoxSync(options); };
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
async function proxyServer (t, backendURL, backendPath, proxyOptions, wrapperOptions) { const frontend = Fastify({ logger: { level } }) const registerProxy = async fastify => { fastify.register(proxy, { upstream: backendURL + backendPath, ...proxyOptions }) } t.comment('starting proxy to ' + backendURL + backendPath) if (wrapperOptions) { await frontend.register(registerProxy, wrapperOptions) } else { await registerProxy(frontend) } return [frontend, await frontend.listen(0)] }
1
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
function genOpenSSLECDSAPub(oid, Q) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); // algorithm asnWriter.startSequence(); asnWriter.writeOID('1.2.840.10045.2.1'); // id-ecPublicKey // algorithm parameters (namedCurve) asnWriter.writeOID(oid); asnWriter.endSequence(); // subjectPublicKey asnWriter.startSequence(Ber.BitString); asnWriter.writeByte(0x00); // XXX: hack to write a raw buffer without a tag -- yuck asnWriter._ensure(Q.length); asnWriter._buf.set(Q, asnWriter._offset); asnWriter._offset += Q.length; // end hack 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
objectKeys(data).forEach((key) => { obj.set(key, ctx.next(data[key]) 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
writeUInt32LE: (buf, value, offset) => { buf[offset++] = value; buf[offset++] = (value >>> 8); buf[offset++] = (value >>> 16); buf[offset++] = (value >>> 24); 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
constructor() { }
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
onUpdate: function(username, accessToken) { users[username] = accessToken; }
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
constructor(options?: { signatureLength?: number }) { super(); this.id = ""; this._tick0 = 0; this._tick1 = 0; this._hasReceivedError = false; this.blocks = []; this.messageChunks = []; this._expectedChannelId = 0; options = options || {}; this.signatureLength = options.signatureLength || 0; this.options = options; this._packetAssembler = new PacketAssembler({ minimumSizeInBytes: 0, readMessageFunc: readRawMessageHeader }); this._packetAssembler.on("message", (messageChunk) => this._feed_messageChunk(messageChunk)); this._packetAssembler.on("newMessage", (info, data) => { if (doPerfMonitoring) { // record tick 0: when the first data is received this._tick0 = get_clock_tick(); } /** * * notify the observers that a new message is being built * @event start_chunk * @param info * @param data */ this.emit("start_chunk", info, data); }); this._securityDefeated = false; this.totalBodySize = 0; this.totalMessageSize = 0; this.channelId = 0; this.offsetBodyStart = 0; this.sequenceHeader = null; this._init_new(); }
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
calculateMintCost(mintOpReturnLength: number, inputUtxoSize: number, batonAddress: string|null, bchChangeAddress?: string, feeRate = 1) { return this.calculateMintOrGenesisCost(mintOpReturnLength, inputUtxoSize, batonAddress, bchChangeAddress, feeRate); }
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
public static IESParameterSpec guessParameterSpec(BufferedBlockCipher iesBlockCipher, byte[] nonce) { if (iesBlockCipher == null) { return new IESParameterSpec(null, null, 128); } else { BlockCipher underlyingCipher = iesBlockCipher.getUnderlyingCipher(); if (underlyingCipher.getAlgorithmName().equals("DES") || underlyingCipher.getAlgorithmName().equals("RC2") || underlyingCipher.getAlgorithmName().equals("RC5-32") || underlyingCipher.getAlgorithmName().equals("RC5-64")) { return new IESParameterSpec(null, null, 64, 64, nonce); } else if (underlyingCipher.getAlgorithmName().equals("SKIPJACK")) { return new IESParameterSpec(null, null, 80, 80, nonce); } else if (underlyingCipher.getAlgorithmName().equals("GOST28147")) { return new IESParameterSpec(null, null, 256, 256, nonce); } return new IESParameterSpec(null, null, 128, 128, nonce); } }
1
TypeScript
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
const renderContent = (content: string | any) => { if (typeof content === 'string') { return renderHTML(content); } return 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
.on("finished", () => { if (doTraceChunk) { // tslint:disable-next-line: no-console warningLog( timestamp(), " <$$ ", msgType, "nbChunk = " + nbChunks.toString().padStart(3), "totalLength = " + totalSize.toString().padStart(8), "l=", binSize.toString().padStart(6) ); } if (totalSize > this.maxMessageSize) { errorLog(`[NODE-OPCUA-E55] message size ${totalSize} exceeds the negotiated message size ${this.maxMessageSize} nb chunks ${nbChunks}`); } messageChunkCallback(null); });
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
static async getAsset(assetPath, res) { try { const fileInfo = assetHelper.getPathInfo(assetPath) const fileHash = assetHelper.generateHash(assetPath) const cachePath = path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, `cache/${fileHash}.dat`) // Force unsafe extensions to download if (WIKI.config.uploads.forceDownload && !['.png', '.apng', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.svg'].includes(fileInfo.ext)) { res.set('Content-disposition', 'attachment; filename=' + fileInfo.base) } if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) { return } if (await WIKI.models.assets.getAssetFromStorage(assetPath, res)) { return } await WIKI.models.assets.getAssetFromDb(assetPath, fileHash, cachePath, res) } catch (err) { if (err.code === `ECONNABORTED` || err.code === `EPIPE`) { return } WIKI.logger.error(err) res.sendStatus(500) } }
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
schemaTypeOptions = {...schemaTypeOptions, type: getSchema(propertyMetadata.type)}; } schemaTypeOptions = cleanProps({...schemaTypeOptions, ...rawMongooseSchema}); if (propertyMetadata.isCollection) { if (propertyMetadata.isArray) { schemaTypeOptions = [schemaTypeOptions]; } else { // Can be a Map or a Set; // Mongoose implements only Map; if (propertyMetadata.collectionType !== Map) { throw new Error(`Invalid collection type. ${propertyMetadata.collectionName} is not supported.`); } schemaTypeOptions = {type: Map, of: schemaTypeOptions}; } } return schemaTypeOptions; }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
function showTooltip(target: HTMLElement): () => void { const tooltip = document.createElement("div"); const isHidden = target.classList.contains("hidden"); if (isHidden) { target.classList.remove("hidden"); } tooltip.className = "keyboard-tooltip"; tooltip.innerHTML = target.getAttribute("data-key") || ""; document.body.appendChild(tooltip); const parentCoords = target.getBoundingClientRect(); // Padded 10px to the left if there is space or centered otherwise const left = parentCoords.left + Math.min((target.offsetWidth - tooltip.offsetWidth) / 2, 10); const top = parentCoords.top + (target.offsetHeight - tooltip.offsetHeight) / 2; tooltip.style.left = `${left}px`; tooltip.style.top = `${top + window.pageYOffset}px`; return (): void => { tooltip.remove(); if (isHidden) { target.classList.add("hidden"); } }; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function userBroadcast(msg, source) { var sourceMsg = '> ' + msg; var name = '{cyan-fg}{bold}' + source.name + '{/}'; msg = ': ' + msg; for (var i = 0; i < users.length; ++i) { var user = users[i]; var output = user.output; if (source === user) output.add(sourceMsg); else output.add(formatMessage(name, output) + msg); } }
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
getDownloadUrl(id, accessToken) { return this.importExport.getDownloadUrl(id, accessToken); },
0
TypeScript
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
export async function execRequest(routes: Routers, ctx: AppContext) { const match = findMatchingRoute(ctx.path, routes); if (!match) throw new ErrorNotFound(); const endPoint = match.route.findEndPoint(ctx.request.method as HttpMethod, match.subPath.schema); if (ctx.URL && !isValidOrigin(ctx.URL.origin, baseUrl(endPoint.type), endPoint.type)) throw new ErrorNotFound(`Invalid origin: ${ctx.URL.origin}`, 'invalidOrigin'); // This is a generic catch-all for all private end points - if we // couldn't get a valid session, we exit now. Individual end points // might have additional permission checks depending on the action. if (!match.route.isPublic(match.subPath.schema) && !ctx.joplin.owner) throw new ErrorForbidden(); return endPoint.handler(match.subPath, ctx); }
0
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
private _buildData(data: Buffer) { if (data && this._stack.length === 0) { return data; } if (!data && this._stack.length === 1) { data = this._stack[0]; this._stack.length = 0; // empty stack array return data; } this._stack.push(data); data = Buffer.concat(this._stack); this._stack.length = 0; return 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
handleVote: debounce(handleVote, 500, { leading: true, trailing: false }), }; };
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
const buildCDNUrl = (packageName: string, suffix: string) => filter(`${cdnUrl}/${packageName}/${version ? `@${version}/` : ''}${suffix}` || '') return `
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
"click .save"(evt) { const instance = Template.instance(); const newIpBlacklist = instance.ipBlacklist.get(); instance.formState.set({ state: "submitting", message: "", }); Meteor.call("setSetting", undefined, "ipBlacklist", newIpBlacklist, (err) => { if (err) { instance.formState.set({ state: "error", message: err.message, }); } else { instance.originalIpBlacklist = newIpBlacklist; instance.formState.set({ state: "success", message: "Saved changes.", }); } }); },
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
export default function isSafeRedirect(url: string): boolean { if (typeof url !== 'string') { throw new TypeError(`Invalid url: ${url}`); } // Prevent open redirects using the //foo.com format (double forward slash). if (/\/\//.test(url)) { return false; } return !/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url); }
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
constructor({asset, message, onClick}: Params, element: HTMLElement) { super(message); this.asset = asset; this.message = message; this.isVisible = ko.observable(false); this.onClick = (_data, event) => onClick(message, event); this.dummyImageUrl = `data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1' width='${asset.width}' height='${asset.height}'></svg>`; this.imageUrl = ko.observable(); this.isIdle = () => this.uploadProgress() === -1 && !this.asset.resource() && !this.message.isObfuscated(); ko.computed( () => { if (this.isVisible() && asset.resource()) { this.assetRepository .load(asset.resource()) .then(blob => { this.imageUrl(window.URL.createObjectURL(blob)); }) .catch(error => console.error(error)); } }, {disposeWhenNodeIsRemoved: element}, ); this.container = element; viewportObserver.onElementInViewport(this.container, () => this.isVisible(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
ctx.prompt(prompt, function retryPrompt(answers) { if (answers.length === 0) return ctx.reject(['keyboard-interactive']); nick = answers[0]; if (nick.length > MAX_NAME_LEN) { return ctx.prompt('That nickname is too long.\n' + PROMPT_NAME, retryPrompt); } else if (nick.length === 0) { return ctx.prompt('A nickname is required.\n' + PROMPT_NAME, retryPrompt); } lowered = nick.toLowerCase(); for (var i = 0; i < users.length; ++i) { if (users[i].name.toLowerCase() === lowered) { return ctx.prompt('That nickname is already in use.\n' + PROMPT_NAME, retryPrompt); } } name = nick; ctx.accept(); });
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 genRSAASN1Buf(n, e, d, p, q, dmp1, dmq1, iqmp) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); asnWriter.writeInt(0x00, Ber.Integer); asnWriter.writeBuffer(n, Ber.Integer); asnWriter.writeBuffer(e, Ber.Integer); asnWriter.writeBuffer(d, Ber.Integer); asnWriter.writeBuffer(p, Ber.Integer); asnWriter.writeBuffer(q, Ber.Integer); asnWriter.writeBuffer(dmp1, Ber.Integer); asnWriter.writeBuffer(dmq1, Ber.Integer); asnWriter.writeBuffer(iqmp, Ber.Integer); asnWriter.endSequence(); return 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
this.transport.init(socket, (err?: Error) => { if (err) { callback(err); } else { this._rememberClientAddressAndPort(); this.messageChunker.maxMessageSize = this.transport.maxMessageSize; // bind low level TCP transport to messageBuilder this.transport.on("message", (messageChunk: Buffer) => { assert(this.messageBuilder); this.messageBuilder.feed(messageChunk); }); debugLog("ServerSecureChannelLayer : Transport layer has been initialized"); debugLog("... now waiting for OpenSecureChannelRequest..."); ServerSecureChannelLayer.registry.register(this); this._wait_for_open_secure_channel_request(callback, this.timeout); } });
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 extend(...args) { const to = Object(args[0]); for (let i = 1; i < args.length; i += 1) { const nextSource = args[i]; if (nextSource !== undefined && nextSource !== null) { const keysArray = Object.keys(Object(nextSource)); for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { const nextKey = keysArray[nextIndex]; const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { extend(to[nextKey], nextSource[nextKey]); } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { to[nextKey] = {}; extend(to[nextKey], nextSource[nextKey]); } else { to[nextKey] = nextSource[nextKey]; } } } } } return to; }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
function OpenSSH_Old_Private(type, comment, privPEM, pubPEM, pubSSH, algo, decrypted) { this.type = type; this.comment = comment; this[SYM_PRIV_PEM] = privPEM; this[SYM_PUB_PEM] = pubPEM; this[SYM_PUB_SSH] = pubSSH; this[SYM_HASH_ALGO] = algo; this[SYM_DECRYPTED] = decrypted; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
objectKeys(obj).forEach((propertyName: string) => { const propertyMetadata = ConverterService.getPropertyMetadata(properties, propertyName); return this.convertProperty(obj, instance, propertyName, propertyMetadata, options); });
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
function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k]; list.pop(); }
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
constructor() { this._zlib = new Zlib(INFLATE); }
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
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( createHttpLink({ uri: 'http://localhost:13377/graphql', fetch, headers: { ...headers, Origin: 'http://someorigin.com', }, }) ), cache: new InMemoryCache(), });
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
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!.toLowerCase()) ]; }
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