{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== '免费Z-image图片生成' && linkText !== '免费Z-image图片生成' ) { link.textContent = '免费Z-image图片生成'; link.href = 'https://zimage.run'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== 'Vibevoice' ) { link.textContent = 'Vibevoice'; link.href = 'https://vibevoice.info/'; replacedLinks.add(link); } // 替换Pricing链接 - 仅替换一次 else if ( (linkHref.includes('/pricing') || linkHref === '/pricing' || linkText === 'Pricing' || linkText.match(/^s*Pricings*$/i)) && linkText !== '免费去水印' ) { link.textContent = '免费去水印'; link.href = 'https://sora2watermarkremover.net/'; replacedLinks.add(link); } // 替换Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) && linkText !== 'GitHub加速' ) { link.textContent = 'GitHub加速'; link.href = 'https://githubproxy.cc'; replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, '免费Z-image图片生成'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n`\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31830,"cells":{"code":{"kind":"string","value":"function bufferSlice(buf, start, end) {\n if (end === undefined)\n end = buf.length;\n return new FastBuffer(buf.buffer, buf.byteOffset + start, end - start);\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31831,"cells":{"code":{"kind":"string","value":" new Promise((resolve, reject) => {"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"NVD-CWE-noinfo"},"cwe_name":{"kind":"null"},"description":{"kind":"null"},"url":{"kind":"null"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31832,"cells":{"code":{"kind":"string","value":"function collideObjects(obj1: any, obj2: any, path: string, modifiers?: ICollideModifiers): any {\n if (!isObject(obj2)) {\n throw new Error(`Unable to collide. Collide value at path ${path} is not an object.`);\n }\n\n if (modifiers && modifiers[path]) {\n return modifiers[path](obj1, obj2);\n }\n\n for (const key of Object.keys(obj2)) {\n const subPath = path + '.' + key;\n\n if (obj1[key] === undefined) {\n obj1[key] = obj2[key];\n } else {\n if (modifiers && modifiers[subPath]) {\n obj1[key] = modifiers[subPath](obj1[key], obj2[key]);\n } else {\n obj1[key] = collideUnsafe(obj1[key], obj2[key], modifiers, subPath);\n }\n }\n }\n\n return obj1;\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"NVD-CWE-Other"},"cwe_name":{"kind":"string","value":"Other"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://nvd.nist.gov/vuln/categories"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31833,"cells":{"code":{"kind":"string","value":" schemaTypeOptions = {...schemaTypeOptions, type: getSchema(propertyMetadata.type)};\n }\n\n schemaTypeOptions = cleanObject({...schemaTypeOptions, ...rawMongooseSchema});\n\n if (propertyMetadata.isCollection) {\n if (propertyMetadata.isArray) {\n schemaTypeOptions = [schemaTypeOptions];\n } else {\n // Can be a Map or a Set;\n // Mongoose implements only Map;\n if (propertyMetadata.collectionType !== Map) {\n throw new Error(`Invalid collection type. ${propertyMetadata.collectionName} is not supported.`);\n }\n\n schemaTypeOptions = {type: Map, of: schemaTypeOptions};\n }\n }\n\n return schemaTypeOptions;\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-915"},"cwe_name":{"kind":"string","value":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/915.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31834,"cells":{"code":{"kind":"string","value":" scroll_to_bottom_key: common.has_mac_keyboard()\n ? \"Fn + \"\n : \"End\",\n }),\n );\n $(`.enter_sends_${user_settings.enter_sends}`).show();\n common.adjust_mac_shortcuts(\".enter_sends kbd\");\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31835,"cells":{"code":{"kind":"string","value":" message: new MockBuilder(\n {\n from: 'test@valid.sender',\n to: '-d0.1a@example.com'\n },\n 'message\\r\\nline 2'\n )\n },\n function (err, data) {\n expect(err).to.exist;\n expect(data).to.not.exist;\n expect(output).to.equal('');\n client._spawn.restore();\n done();\n }\n );\n });"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-88"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')"},"description":{"kind":"string","value":"The software constructs a string for a command to executed by a separate component\nin another control sphere, but it does not properly delimit the\nintended arguments, options, or switches within that command string."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/88.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31836,"cells":{"code":{"kind":"string","value":"function validateBaseUrl(url: string) {\n // from this MIT-licensed gist: https://gist.github.com/dperini/729294\n 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("},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"NVD-CWE-noinfo"},"cwe_name":{"kind":"null"},"description":{"kind":"null"},"url":{"kind":"null"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31837,"cells":{"code":{"kind":"string","value":" encrypt(packet) {\n // `packet` === unencrypted packet\n\n if (this._dead)\n return;\n\n this._onWrite(packet);\n\n this.outSeqno = (this.outSeqno + 1) >>> 0;\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31838,"cells":{"code":{"kind":"string","value":" get lokadIdHex() { return \"534c5000\" }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-20"},"cwe_name":{"kind":"string","value":"Improper Input Validation"},"description":{"kind":"string","value":"The product receives input or data, but it does\n not validate or incorrectly validates that the input has the\n properties that are required to process the data safely and\n correctly."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/20.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31839,"cells":{"code":{"kind":"string","value":" function check_response(err: Error | null, response: any) {\n should.not.exist(err);\n //xx debugLog(response.toString());\n response.responseHeader.serviceResult.should.eql(StatusCodes.BadInvalidArgument);\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-400"},"cwe_name":{"kind":"string","value":"Uncontrolled Resource Consumption"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/400.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31840,"cells":{"code":{"kind":"string","value":" objectKeys(data).forEach((key) => {\n obj.add(ctx.next(data[key]));\n });"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-915"},"cwe_name":{"kind":"string","value":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/915.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31841,"cells":{"code":{"kind":"string","value":"TEST_F(AsStringGraphTest, FillWithZero) {\n TF_ASSERT_OK(Init(DT_INT64, /*fill=*/\"0\", /*width=*/4));\n\n AddInputFromArray(TensorShape({3}), {-42, 0, 42});\n TF_ASSERT_OK(RunOpKernel());\n Tensor expected(allocator(), DT_STRING, TensorShape({3}));\n test::FillValues(&expected, {\"-042\", \"0000\", \"0042\"});\n test::ExpectTensorEqual(expected, *GetOutput(0));\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-134"},"cwe_name":{"kind":"string","value":"Use of Externally-Controlled Format String"},"description":{"kind":"string","value":"The software uses a function that accepts a format string as an argument, but the format string originates from an external source."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/134.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31842,"cells":{"code":{"kind":"string","value":" connect() {\n this.emit('connect');\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31843,"cells":{"code":{"kind":"string","value":" .catch(error => {\n // There was an error with the session token\n const result = {};\n if (error && error.code === Parse.Error.INVALID_SESSION_TOKEN) {\n // Store a resolved promise with the error for 10 minutes\n result.error = error;\n this.authCache.set(\n sessionToken,\n Promise.resolve(result),\n 60 * 10 * 1000\n );\n } else {"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-672"},"cwe_name":{"kind":"string","value":"Operation on a Resource after Expiration or Release"},"description":{"kind":"string","value":"The software uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/672.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31844,"cells":{"code":{"kind":"string","value":" constructor(config) {\n const enc = config.outbound;\n this.outSeqno = enc.seqno;\n this._onWrite = enc.onWrite;\n this._encKeyMain = enc.cipherKey.slice(0, 32);\n this._encKeyPktLen = enc.cipherKey.slice(32);\n this._dead = false;\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31845,"cells":{"code":{"kind":"string","value":"export function exportVariable(name: string, val: any): void {\n const convertedVal = toCommandValue(val)\n process.env[name] = convertedVal\n\n const filePath = process.env['GITHUB_ENV'] || ''\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_'\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`\n issueFileCommand('ENV', commandValue)\n } else {\n issueCommand('set-env', {name}, convertedVal)\n }\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-74"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/74.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31846,"cells":{"code":{"kind":"string","value":" static buildMintOpReturn(config: configBuildMintOpReturn, type = 0x01) {\n return SlpTokenType1.buildMintOpReturn(\n config.tokenIdHex,\n config.batonVout,\n config.mintQuantity, \n type\n )\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-20"},"cwe_name":{"kind":"string","value":"Improper Input Validation"},"description":{"kind":"string","value":"The product receives input or data, but it does\n not validate or incorrectly validates that the input has the\n properties that are required to process the data safely and\n correctly."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/20.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31847,"cells":{"code":{"kind":"string","value":" ctx.prompt(prompt, function retryPrompt(answers) {\n if (answers.length === 0)\n return ctx.reject(['keyboard-interactive']);\n nick = answers[0];\n if (nick.length > MAX_NAME_LEN) {\n return ctx.prompt(`That nickname is too long.\\n${PROMPT_NAME}`,\n retryPrompt);\n } else if (nick.length === 0) {\n return ctx.prompt(`A nickname is required.\\n${PROMPT_NAME}`,\n retryPrompt);\n }\n lowered = nick.toLowerCase();\n for (const user of users) {\n if (user.name.toLowerCase() === lowered) {\n return ctx.prompt(`That nickname is already in use.\\n${PROMPT_NAME}`,\n retryPrompt);\n }\n }\n name = nick;\n ctx.accept();\n });"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31848,"cells":{"code":{"kind":"string","value":"export const showWarningDialog = (message: string): void => {\n const options: MessageBoxSyncOptions = {\n buttons: ['OK'],\n message,\n title: 'Warning',\n type: 'warning',\n };\n dialog.showMessageBoxSync(options);\n};"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-20"},"cwe_name":{"kind":"string","value":"Improper Input Validation"},"description":{"kind":"string","value":"The product receives input or data, but it does\n not validate or incorrectly validates that the input has the\n properties that are required to process the data safely and\n correctly."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/20.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31849,"cells":{"code":{"kind":"string","value":"async function proxyServer (t, backendURL, backendPath, proxyOptions, wrapperOptions) {\n const frontend = Fastify({ logger: { level } })\n const registerProxy = async fastify => {\n fastify.register(proxy, {\n upstream: backendURL + backendPath,\n ...proxyOptions\n })\n }\n\n t.comment('starting proxy to ' + backendURL + backendPath)\n\n if (wrapperOptions) {\n await frontend.register(registerProxy, wrapperOptions)\n } else {\n await registerProxy(frontend)\n }\n\n return [frontend, await frontend.listen(0)]\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-20"},"cwe_name":{"kind":"string","value":"Improper Input Validation"},"description":{"kind":"string","value":"The product receives input or data, but it does\n not validate or incorrectly validates that the input has the\n properties that are required to process the data safely and\n correctly."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/20.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31850,"cells":{"code":{"kind":"string","value":"function genOpenSSLECDSAPub(oid, Q) {\n const asnWriter = new Ber.Writer();\n asnWriter.startSequence();\n // algorithm\n asnWriter.startSequence();\n asnWriter.writeOID('1.2.840.10045.2.1'); // id-ecPublicKey\n // algorithm parameters (namedCurve)\n asnWriter.writeOID(oid);\n asnWriter.endSequence();\n\n // subjectPublicKey\n asnWriter.startSequence(Ber.BitString);\n asnWriter.writeByte(0x00);\n // XXX: hack to write a raw buffer without a tag -- yuck\n asnWriter._ensure(Q.length);\n asnWriter._buf.set(Q, asnWriter._offset);\n asnWriter._offset += Q.length;\n // end hack\n asnWriter.endSequence();\n asnWriter.endSequence();\n return makePEM('PUBLIC', asnWriter.buffer);\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31851,"cells":{"code":{"kind":"string","value":" objectKeys(data).forEach((key) => {\n obj.set(key, ctx.next(data[key]) as T);\n });"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-915"},"cwe_name":{"kind":"string","value":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/915.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31852,"cells":{"code":{"kind":"string","value":" writeUInt32LE: (buf, value, offset) => {\n buf[offset++] = value;\n buf[offset++] = (value >>> 8);\n buf[offset++] = (value >>> 16);\n buf[offset++] = (value >>> 24);\n return offset;\n },"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31853,"cells":{"code":{"kind":"string","value":" constructor() { }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-295"},"cwe_name":{"kind":"string","value":"Improper Certificate Validation"},"description":{"kind":"string","value":"The software does not validate, or incorrectly validates, a certificate."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/295.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31854,"cells":{"code":{"kind":"string","value":" onUpdate: function(username, accessToken) {\n users[username] = accessToken;\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-88"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')"},"description":{"kind":"string","value":"The software constructs a string for a command to executed by a separate component\nin another control sphere, but it does not properly delimit the\nintended arguments, options, or switches within that command string."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/88.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31855,"cells":{"code":{"kind":"string","value":" constructor(options?: { signatureLength?: number }) {\n super();\n\n this.id = \"\";\n\n this._tick0 = 0;\n this._tick1 = 0;\n this._hasReceivedError = false;\n this.blocks = [];\n this.messageChunks = [];\n this._expectedChannelId = 0;\n\n options = options || {};\n\n this.signatureLength = options.signatureLength || 0;\n\n this.options = options;\n\n this._packetAssembler = new PacketAssembler({\n minimumSizeInBytes: 0,\n readMessageFunc: readRawMessageHeader\n });\n\n this._packetAssembler.on(\"message\", (messageChunk) => this._feed_messageChunk(messageChunk));\n\n this._packetAssembler.on(\"newMessage\", (info, data) => {\n if (doPerfMonitoring) {\n // record tick 0: when the first data is received\n this._tick0 = get_clock_tick();\n }\n /**\n *\n * notify the observers that a new message is being built\n * @event start_chunk\n * @param info\n * @param data\n */\n this.emit(\"start_chunk\", info, data);\n });\n\n this._securityDefeated = false;\n this.totalBodySize = 0;\n this.totalMessageSize = 0;\n this.channelId = 0;\n this.offsetBodyStart = 0;\n this.sequenceHeader = null;\n this._init_new();\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-400"},"cwe_name":{"kind":"string","value":"Uncontrolled Resource Consumption"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/400.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31856,"cells":{"code":{"kind":"string","value":" calculateMintCost(mintOpReturnLength: number, inputUtxoSize: number, batonAddress: string|null, bchChangeAddress?: string, feeRate = 1) {\n return this.calculateMintOrGenesisCost(mintOpReturnLength, inputUtxoSize, batonAddress, bchChangeAddress, feeRate);\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-20"},"cwe_name":{"kind":"string","value":"Improper Input Validation"},"description":{"kind":"string","value":"The product receives input or data, but it does\n not validate or incorrectly validates that the input has the\n properties that are required to process the data safely and\n correctly."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/20.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31857,"cells":{"code":{"kind":"string","value":" public static IESParameterSpec guessParameterSpec(BufferedBlockCipher iesBlockCipher, byte[] nonce)\n {\n if (iesBlockCipher == null)\n {\n return new IESParameterSpec(null, null, 128);\n }\n else\n {\n BlockCipher underlyingCipher = iesBlockCipher.getUnderlyingCipher();\n\n if (underlyingCipher.getAlgorithmName().equals(\"DES\") ||\n underlyingCipher.getAlgorithmName().equals(\"RC2\") ||\n underlyingCipher.getAlgorithmName().equals(\"RC5-32\") ||\n underlyingCipher.getAlgorithmName().equals(\"RC5-64\"))\n {\n return new IESParameterSpec(null, null, 64, 64, nonce);\n }\n else if (underlyingCipher.getAlgorithmName().equals(\"SKIPJACK\"))\n {\n return new IESParameterSpec(null, null, 80, 80, nonce);\n }\n else if (underlyingCipher.getAlgorithmName().equals(\"GOST28147\"))\n {\n return new IESParameterSpec(null, null, 256, 256, nonce);\n }\n\n return new IESParameterSpec(null, null, 128, 128, nonce);\n }\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-310"},"cwe_name":{"kind":"string","value":"Cryptographic Issues"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/310.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31858,"cells":{"code":{"kind":"string","value":"const renderContent = (content: string | any) => {\n if (typeof content === 'string') {\n return renderHTML(content);\n }\n return content;\n};"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31859,"cells":{"code":{"kind":"string","value":" .on(\"finished\", () => {\n if (doTraceChunk) {\n // tslint:disable-next-line: no-console\n warningLog(\n timestamp(),\n \" <$$ \",\n msgType,\n \"nbChunk = \" + nbChunks.toString().padStart(3),\n \"totalLength = \" + totalSize.toString().padStart(8),\n \"l=\",\n binSize.toString().padStart(6)\n );\n }\n if (totalSize > this.maxMessageSize) {\n errorLog(`[NODE-OPCUA-E55] message size ${totalSize} exceeds the negotiated message size ${this.maxMessageSize} nb chunks ${nbChunks}`);\n }\n messageChunkCallback(null);\n });"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-400"},"cwe_name":{"kind":"string","value":"Uncontrolled Resource Consumption"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/400.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31860,"cells":{"code":{"kind":"string","value":" static async getAsset(assetPath, res) {\n try {\n const fileInfo = assetHelper.getPathInfo(assetPath)\n const fileHash = assetHelper.generateHash(assetPath)\n const cachePath = path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, `cache/${fileHash}.dat`)\n\n // Force unsafe extensions to download\n if (WIKI.config.uploads.forceDownload && !['.png', '.apng', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.svg'].includes(fileInfo.ext)) {\n res.set('Content-disposition', 'attachment; filename=' + fileInfo.base)\n }\n\n if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) {\n return\n }\n if (await WIKI.models.assets.getAssetFromStorage(assetPath, res)) {\n return\n }\n await WIKI.models.assets.getAssetFromDb(assetPath, fileHash, cachePath, res)\n } catch (err) {\n if (err.code === `ECONNABORTED` || err.code === `EPIPE`) {\n return\n }\n WIKI.logger.error(err)\n res.sendStatus(500)\n }\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31861,"cells":{"code":{"kind":"string","value":" schemaTypeOptions = {...schemaTypeOptions, type: getSchema(propertyMetadata.type)};\n }\n\n schemaTypeOptions = cleanProps({...schemaTypeOptions, ...rawMongooseSchema});\n\n if (propertyMetadata.isCollection) {\n if (propertyMetadata.isArray) {\n schemaTypeOptions = [schemaTypeOptions];\n } else {\n // Can be a Map or a Set;\n // Mongoose implements only Map;\n if (propertyMetadata.collectionType !== Map) {\n throw new Error(`Invalid collection type. ${propertyMetadata.collectionName} is not supported.`);\n }\n\n schemaTypeOptions = {type: Map, of: schemaTypeOptions};\n }\n }\n\n return schemaTypeOptions;\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-915"},"cwe_name":{"kind":"string","value":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/915.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31862,"cells":{"code":{"kind":"string","value":"function showTooltip(target: HTMLElement): () => void {\n const tooltip = document.createElement(\"div\");\n const isHidden = target.classList.contains(\"hidden\");\n if (isHidden) {\n target.classList.remove(\"hidden\");\n }\n tooltip.className = \"keyboard-tooltip\";\n tooltip.innerHTML = target.getAttribute(\"data-key\") || \"\";\n document.body.appendChild(tooltip);\n const parentCoords = target.getBoundingClientRect();\n // Padded 10px to the left if there is space or centered otherwise\n const left =\n parentCoords.left +\n Math.min((target.offsetWidth - tooltip.offsetWidth) / 2, 10);\n const top =\n parentCoords.top + (target.offsetHeight - tooltip.offsetHeight) / 2;\n tooltip.style.left = `${left}px`;\n tooltip.style.top = `${top + window.pageYOffset}px`;\n return (): void => {\n tooltip.remove();\n if (isHidden) {\n target.classList.add(\"hidden\");\n }\n };\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31863,"cells":{"code":{"kind":"string","value":"function userBroadcast(msg, source) {\n var sourceMsg = '> ' + msg;\n var name = '{cyan-fg}{bold}' + source.name + '{/}';\n msg = ': ' + msg;\n for (var i = 0; i < users.length; ++i) {\n var user = users[i];\n var output = user.output;\n if (source === user)\n output.add(sourceMsg);\n else\n output.add(formatMessage(name, output) + msg);\n }\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31864,"cells":{"code":{"kind":"string","value":" getDownloadUrl(id, accessToken) {\n return this.importExport.getDownloadUrl(id, accessToken);\n },"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-639"},"cwe_name":{"kind":"string","value":"Authorization Bypass Through User-Controlled Key"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/639.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31865,"cells":{"code":{"kind":"string","value":"export async function execRequest(routes: Routers, ctx: AppContext) {\n\tconst match = findMatchingRoute(ctx.path, routes);\n\tif (!match) throw new ErrorNotFound();\n\n\tconst endPoint = match.route.findEndPoint(ctx.request.method as HttpMethod, match.subPath.schema);\n\tif (ctx.URL && !isValidOrigin(ctx.URL.origin, baseUrl(endPoint.type), endPoint.type)) throw new ErrorNotFound(`Invalid origin: ${ctx.URL.origin}`, 'invalidOrigin');\n\n\t// This is a generic catch-all for all private end points - if we\n\t// couldn't get a valid session, we exit now. Individual end points\n\t// might have additional permission checks depending on the action.\n\tif (!match.route.isPublic(match.subPath.schema) && !ctx.joplin.owner) throw new ErrorForbidden();\n\n\treturn endPoint.handler(match.subPath, ctx);\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-352"},"cwe_name":{"kind":"string","value":"Cross-Site Request Forgery (CSRF)"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/352.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31866,"cells":{"code":{"kind":"string","value":" private _buildData(data: Buffer) {\n if (data && this._stack.length === 0) {\n return data;\n }\n if (!data && this._stack.length === 1) {\n data = this._stack[0];\n this._stack.length = 0; // empty stack array\n return data;\n }\n this._stack.push(data);\n data = Buffer.concat(this._stack);\n this._stack.length = 0;\n return data;\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-400"},"cwe_name":{"kind":"string","value":"Uncontrolled Resource Consumption"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/400.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31867,"cells":{"code":{"kind":"string","value":" handleVote: debounce(handleVote, 500, { leading: true, trailing: false }),\n };\n};"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"NVD-CWE-noinfo"},"cwe_name":{"kind":"null"},"description":{"kind":"null"},"url":{"kind":"null"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31868,"cells":{"code":{"kind":"string","value":" const buildCDNUrl = (packageName: string, suffix: string) => filter(`${cdnUrl}/${packageName}/${version ? `@${version}/` : ''}${suffix}` || '')\n return `"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31869,"cells":{"code":{"kind":"string","value":" \"click .save\"(evt) {\n const instance = Template.instance();\n const newIpBlacklist = instance.ipBlacklist.get();\n\n instance.formState.set({\n state: \"submitting\",\n message: \"\",\n });\n\n Meteor.call(\"setSetting\", undefined, \"ipBlacklist\", newIpBlacklist, (err) => {\n if (err) {\n instance.formState.set({\n state: \"error\",\n message: err.message,\n });\n } else {\n instance.originalIpBlacklist = newIpBlacklist;\n instance.formState.set({\n state: \"success\",\n message: \"Saved changes.\",\n });\n }\n });\n },"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-918"},"cwe_name":{"kind":"string","value":"Server-Side Request Forgery (SSRF)"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/918.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31870,"cells":{"code":{"kind":"string","value":"export default function isSafeRedirect(url: string): boolean {\n if (typeof url !== 'string') {\n throw new TypeError(`Invalid url: ${url}`);\n }\n\n // Prevent open redirects using the //foo.com format (double forward slash).\n if (/\\/\\//.test(url)) {\n return false;\n }\n\n return !/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(url);\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-601"},"cwe_name":{"kind":"string","value":"URL Redirection to Untrusted Site ('Open Redirect')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/601.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31871,"cells":{"code":{"kind":"string","value":" constructor({asset, message, onClick}: Params, element: HTMLElement) {\n super(message);\n this.asset = asset;\n this.message = message;\n this.isVisible = ko.observable(false);\n this.onClick = (_data, event) => onClick(message, event);\n\n this.dummyImageUrl = `data:image/svg+xml;utf8,`;\n\n this.imageUrl = ko.observable();\n\n this.isIdle = () => this.uploadProgress() === -1 && !this.asset.resource() && !this.message.isObfuscated();\n\n ko.computed(\n () => {\n if (this.isVisible() && asset.resource()) {\n this.assetRepository\n .load(asset.resource())\n .then(blob => {\n this.imageUrl(window.URL.createObjectURL(blob));\n })\n .catch(error => console.error(error));\n }\n },\n {disposeWhenNodeIsRemoved: element},\n );\n\n this.container = element;\n viewportObserver.onElementInViewport(this.container, () => this.isVisible(true));\n }"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31872,"cells":{"code":{"kind":"string","value":" ctx.prompt(prompt, function retryPrompt(answers) {\n if (answers.length === 0)\n return ctx.reject(['keyboard-interactive']);\n nick = answers[0];\n if (nick.length > MAX_NAME_LEN) {\n return ctx.prompt('That nickname is too long.\\n' + PROMPT_NAME,\n retryPrompt);\n } else if (nick.length === 0) {\n return ctx.prompt('A nickname is required.\\n' + PROMPT_NAME,\n retryPrompt);\n }\n lowered = nick.toLowerCase();\n for (var i = 0; i < users.length; ++i) {\n if (users[i].name.toLowerCase() === lowered) {\n return ctx.prompt('That nickname is already in use.\\n' + PROMPT_NAME,\n retryPrompt);\n }\n }\n name = nick;\n ctx.accept();\n });"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31873,"cells":{"code":{"kind":"string","value":" function genRSAASN1Buf(n, e, d, p, q, dmp1, dmq1, iqmp) {\n const asnWriter = new Ber.Writer();\n asnWriter.startSequence();\n asnWriter.writeInt(0x00, Ber.Integer);\n asnWriter.writeBuffer(n, Ber.Integer);\n asnWriter.writeBuffer(e, Ber.Integer);\n asnWriter.writeBuffer(d, Ber.Integer);\n asnWriter.writeBuffer(p, Ber.Integer);\n asnWriter.writeBuffer(q, Ber.Integer);\n asnWriter.writeBuffer(dmp1, Ber.Integer);\n asnWriter.writeBuffer(dmq1, Ber.Integer);\n asnWriter.writeBuffer(iqmp, Ber.Integer);\n asnWriter.endSequence();\n return asnWriter.buffer;\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31874,"cells":{"code":{"kind":"string","value":" this.transport.init(socket, (err?: Error) => {\n if (err) {\n callback(err);\n } else {\n this._rememberClientAddressAndPort();\n\n this.messageChunker.maxMessageSize = this.transport.maxMessageSize;\n\n // bind low level TCP transport to messageBuilder\n this.transport.on(\"message\", (messageChunk: Buffer) => {\n assert(this.messageBuilder);\n this.messageBuilder.feed(messageChunk);\n });\n debugLog(\"ServerSecureChannelLayer : Transport layer has been initialized\");\n debugLog(\"... now waiting for OpenSecureChannelRequest...\");\n\n ServerSecureChannelLayer.registry.register(this);\n\n this._wait_for_open_secure_channel_request(callback, this.timeout);\n }\n });"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-400"},"cwe_name":{"kind":"string","value":"Uncontrolled Resource Consumption"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/400.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31875,"cells":{"code":{"kind":"string","value":"function extend(...args) {\n const to = Object(args[0]);\n for (let i = 1; i < args.length; i += 1) {\n const nextSource = args[i];\n if (nextSource !== undefined && nextSource !== null) {\n const keysArray = Object.keys(Object(nextSource));\n for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {\n const nextKey = keysArray[nextIndex];\n const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n extend(to[nextKey], nextSource[nextKey]);\n } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n to[nextKey] = {};\n extend(to[nextKey], nextSource[nextKey]);\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n }\n return to;\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"NVD-CWE-noinfo"},"cwe_name":{"kind":"null"},"description":{"kind":"null"},"url":{"kind":"null"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31876,"cells":{"code":{"kind":"string","value":"function OpenSSH_Old_Private(type, comment, privPEM, pubPEM, pubSSH, algo,\n decrypted) {\n this.type = type;\n this.comment = comment;\n this[SYM_PRIV_PEM] = privPEM;\n this[SYM_PUB_PEM] = pubPEM;\n this[SYM_PUB_SSH] = pubSSH;\n this[SYM_HASH_ALGO] = algo;\n this[SYM_DECRYPTED] = decrypted;\n}"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31877,"cells":{"code":{"kind":"string","value":" objectKeys(obj).forEach((propertyName: string) => {\n const propertyMetadata = ConverterService.getPropertyMetadata(properties, propertyName);\n\n return this.convertProperty(obj, instance, propertyName, propertyMetadata, options);\n });"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-915"},"cwe_name":{"kind":"string","value":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/915.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31878,"cells":{"code":{"kind":"string","value":"function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31879,"cells":{"code":{"kind":"string","value":" constructor() {\n this._zlib = new Zlib(INFLATE);\n }"},"label":{"kind":"number","value":1,"string":"1"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-78"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/78.html"},"label_name":{"kind":"string","value":"safe"}}},{"rowIdx":31880,"cells":{"code":{"kind":"string","value":" link: new ApolloLink((operation, forward) => {\n return forward(operation).map((response) => {\n const context = operation.getContext();\n const {\n response: { headers },\n } = context;\n expect(headers.get('access-control-allow-origin')).toEqual('*');\n checked = true;\n return response;\n });\n }).concat(\n createHttpLink({\n uri: 'http://localhost:13377/graphql',\n fetch,\n headers: {\n ...headers,\n Origin: 'http://someorigin.com',\n },\n })\n ),\n cache: new InMemoryCache(),\n });"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-863"},"cwe_name":{"kind":"string","value":"Incorrect Authorization"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/863.html"},"label_name":{"kind":"string","value":"vulnerable"}}},{"rowIdx":31881,"cells":{"code":{"kind":"string","value":"export function orderLinks(links: T[]) {\n const [provided, unknown] = partition(links, isProvided);\n return [\n ...sortBy(provided, link => PROVIDED_TYPES.indexOf(link.type)),\n ...sortBy(unknown, link => link.name!.toLowerCase())\n ];\n}"},"label":{"kind":"number","value":0,"string":"0"},"programming_language":{"kind":"string","value":"TypeScript"},"cwe_id":{"kind":"string","value":"CWE-79"},"cwe_name":{"kind":"string","value":"Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"},"description":{"kind":"string","value":"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."},"url":{"kind":"string","value":"https://cwe.mitre.org/data/definitions/79.html"},"label_name":{"kind":"string","value":"vulnerable"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":318,"numItemsPerPage":100,"numTotalItems":31882,"offset":31800,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc2NjA3OTM0Mywic3ViIjoiL2RhdGFzZXRzL21jYW5vZ2x1L2RlZmVjdC1kZXRlY3Rpb24iLCJleHAiOjE3NjYwODI5NDMsImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.4j0sXiAJBt94gWy9ONs7MalndlgmgkePHrY2HpgeV5r-fAb7icDhcnr0m6Qoi88yyxXpEozcvSz22RnpMDeACg","displayUrls":true,"splitSizeSummaries":[{"config":"default","split":"train","numRows":31882,"numBytesParquet":10356293},{"config":"default","split":"validation","numRows":3984,"numBytesParquet":1289831},{"config":"default","split":"test","numRows":3984,"numBytesParquet":1249797}]},"discussionsStats":{"closed":1,"open":2,"total":3},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
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: '[email protected]', to: '[email protected]' }, '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