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
handler: (req, reply) => { reply.send(req.url) },
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
export function parse(formula: string): [a: number, b: number] { formula = formula.trim().toLowerCase(); if (formula === "even") { return [2, 0]; } else if (formula === "odd") { return [2, 1]; } const parsed = formula.match(RE_NTH_ELEMENT); if (!parsed) { throw new Error(`n-th rule couldn't be parsed ('${formula}')`); }
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
switchToInvites: async () => { await this.waitAndClick('.e_InvTabB'); await this.invitedUsersList.waitUntilLoaded(); },
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
module.exports = async function(tag) { if (!tag || ![ 'string', 'number' ].includes(typeof tag)) { throw new TypeError(`string was expected, instead got ${tag}`); } const { message, author, email } = this; await Promise.all([ spawn(`config user.name "${await author}"`), spawn(`config user.email "${await email}"`), ]); await spawn(`tag -a ${tag} -m "${await message}"`); await spawn(`push origin refs/tags/${tag}`); };
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
_resolvePath(path = '.') { const clientPath = (() => { path = nodePath.normalize(path); if (nodePath.isAbsolute(path)) { return nodePath.join(path); } else { return nodePath.join(this.cwd, path); } })(); const fsPath = (() => { const resolvedPath = nodePath.join(this.root, clientPath); return nodePath.resolve(nodePath.normalize(nodePath.join(resolvedPath))); })(); return { clientPath, fsPath }; }
0
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
export function setupCleanupOnExit(cssPath: string) { if (!hasSetupCleanupOnExit){ process.on('SIGINT', () => { console.log('Exiting, running CSS cleanup'); exec(`rm -r ${cssPath}`, function(error) { if (error) { console.error(error); process.exit(1); } console.log('Deleted CSS files'); }); }); hasSetupCleanupOnExit = true; } }
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(type: VCSType = 'git') { this.type = type; }
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 handler (type, name, fn) { if ( type === 'constructor' || type === '__proto__' || name === 'constructor' || name === '__proto__' ) { return } if (arguments.length > 2) { handlers[type][name] = fn } return handlers[type][name] }
1
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
safe
return { url: Url.format(parsedUrl), host }; } } if (addresses.length > 0) { throw new Meteor.Error(403, "can't connect to blacklisted private network address: " + parsedUrl.hostname + "; the Sandstorm server admin can change the blacklist in the admin settings"); } else { throw new Meteor.Error(404, "host not found: " + parsedUrl.hostname); } }
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
const getCdnMarkup = ({ version, cdnUrl = '//cdn.jsdelivr.net/npm', faviconUrl }) => ` <link rel="stylesheet" href="${cdnUrl}/graphql-playground-react${
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
constructor(line: string, lineNumber: number) { super(`Unsupported type of line: [${lineNumber}] "${line}"`); this.line = line; this.lineNumber = lineNumber; }
1
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
safe
async function waitSessionCountChange(currentSessionCountMonitoredItem) { return await new Promise((resolve,reject) => { const timer = setTimeout(() => { reject(new Error("Never received ", currentSessionCountMonitoredItem.toString())); }, 5000); currentSessionCountMonitoredItem.once("changed", function (dataValue) { clearTimeout(timer); const new_currentSessionCount = dataValue.value.value; debugLog("new currentSessionCount=", dataValue.toString()); resolve(new_currentSessionCount); }); }); }
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
userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name,
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function validateKey(key) { if (usafeProperties.includes(key)) { throw new Error('Property "' + key + '" is not a valid key'); } }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
TEST_F(AsStringGraphTest, OnlyOneOfScientificAndShortest) { Status s = Init(DT_FLOAT, /*fill=*/"", /*width=*/-1, /*precision=*/-1, /*scientific=*/true, /*shortest=*/true); ASSERT_EQ(error::INVALID_ARGUMENT, s.code()); ASSERT_TRUE( absl::StrContains(s.error_message(), "Cannot select both scientific and shortest notation")); }
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
[req.locale]: self.getBrowserBundles(req.locale) }; if (req.locale !== self.defaultLocale) { i18n[self.defaultLocale] = self.getBrowserBundles(self.defaultLocale); } const result = { i18n, locale: req.locale, defaultLocale: self.defaultLocale, locales: self.locales, debug: self.debug, show: self.show, action: self.action, crossDomainClipboard: req.session.aposCrossDomainClipboard }; if (req.session.aposCrossDomainClipboard) { req.session.aposCrossDomainClipboard = null; } return result; },
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
function lazyLoadCustomEmoji(element: HTMLElement): void { const img = createElement('img', CLASS_CUSTOM_EMOJI) as HTMLImageElement; if (element.dataset.emoji) { img.src = element.dataset.emoji; element.innerText = ''; element.appendChild(img); } }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
export function getProfileFromDeeplink(args): string | undefined { // check if we are passed a profile in the SSO callback url const deeplinkUrl = args.find(arg => arg.startsWith('element://')); if (deeplinkUrl && deeplinkUrl.includes(SEARCH_PARAM)) { const parsedUrl = new URL(deeplinkUrl); if (parsedUrl.protocol === 'element:') { const ssoID = parsedUrl.searchParams.get(SEARCH_PARAM); const store = readStore(); console.log("Forwarding to profile: ", store[ssoID]); return store[ssoID]; } } }
0
TypeScript
CWE-416
Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
https://cwe.mitre.org/data/definitions/416.html
vulnerable
componentDidMount () { this.store.gotoUrl(this.props.params.url); return this.store.generateToken(); }
0
TypeScript
CWE-346
Origin Validation Error
The software does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
function g_sendError(channel: ServerSecureChannelLayer, message: Message, ResponseClass: any, statusCode: StatusCode): void { const response = new ResponseClass({ responseHeader: { serviceResult: statusCode } }); return channel.send_response("MSG", response, message); }
0
TypeScript
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
vulnerable
TEST_F(AsStringGraphTest, FloatShortest) { TF_ASSERT_OK(Init(DT_FLOAT, /*fill=*/"", /*width=*/-1, /*precision=*/-1, /*scientific=*/false, /*shortest=*/true)); AddInputFromArray<float>(TensorShape({4}), {-42, 0, 3.14159, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({4})); test::FillValues<tstring>(&expected, {"-42", "0", "3.14159", "42"}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
const addReplyToEvent = (event: any) => { const { processId, frameId } = event; event.reply = (...args: any[]) => { event.sender.sendToFrame([processId, frameId], ...args); }; };
1
TypeScript
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
safe
exports.validateNumber = function validateNumber(value, name) { if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value); };
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
TEST_F(AsStringGraphTest, FillWithChar4) { Status s = Init(DT_INT32, /*fill=*/"n"); ASSERT_EQ(error::INVALID_ARGUMENT, s.code()); ASSERT_TRUE( absl::StrContains(s.error_message(), "Fill argument not supported")); }
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
return code.includes(hash); }); if (containsMentions) { // disable code highlighting if there is a mention in there // highlighting will be wrong anyway because this is not valid code return code; } return hljs.highlightAuto(code).value; }, });
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
export default function publishVote(pollId, pollAnswerId) { const REDIS_CONFIG = Meteor.settings.private.redis; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'RespondToPollReqMsg'; const { meetingId, requesterUserId } = extractCredentials(this.userId); check(pollAnswerId, Number); check(pollId, String); const waitingFor = Polls.findOne({ id: pollId }, { feilds: { users: 1, }, }); const userResponded = !waitingFor.users.includes(requesterUserId); if (userResponded) return null; const selector = { users: requesterUserId, meetingId, 'answers.id': pollAnswerId, }; const payload = { requesterId: requesterUserId, pollId, questionId: 0, answerId: pollAnswerId, }; /* We keep an array of people who were in the meeting at the time the poll was started. The poll is published to them only. Once they vote - their ID is removed and they cannot see the poll anymore */ const modifier = { $pull: { users: requesterUserId, }, }; const cb = (err) => { if (err) { return Logger.error(`Removing responded user from Polls collection: ${err}`); } Logger.info(`Removed responded user=${requesterUserId} from poll (meetingId: ${meetingId}, ` + `pollId: ${pollId}!)`); return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); }; Polls.update(selector, modifier, cb); }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
return { kind: 'redirect', to: `/signin?from=${encodeURIComponent(req!.url!)}` }; } };
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
${renderConfig(extendedOptions)} <div id="root" /> <script type="text/javascript"> window.addEventListener('load', function (event) { ${loading.script} const root = document.getElementById('root'); root.classList.add('playgroundIn'); const configText = document.getElementById('config').innerText if(configText && configText.length) { try { GraphQLPlayground.init(root, JSON.parse(configText)) } catch(err) { console.error("could not find config") } } }) </script> </body> </html> ` }
1
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
const createCommand = ({ ref, path }: Input) => { return `git show ${ref}:${path}`; };
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 localMessage(msg, source) { const output = source.output; output.add(formatMessage(msg, output)); }
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 get(target, path) { "use strict"; try { return reduce(target, path); } catch(ex) { console.error(ex); return; } }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
getScriptOperations(script: Buffer) { let ops: PushDataOperation[] = []; try { let n = 0; let dlen: number; while (n < script.length) { let op: PushDataOperation = { opcode: script[n], data: null } n += 1; if(op.opcode <= this.BITBOX.Script.opcodes.OP_PUSHDATA4) { if(op.opcode < this.BITBOX.Script.opcodes.OP_PUSHDATA1) dlen = op.opcode; else if(op.opcode === this.BITBOX.Script.opcodes.OP_PUSHDATA1) { dlen = script[n]; n += 1; } else if(op.opcode === this.BITBOX.Script.opcodes.OP_PUSHDATA2) { dlen = script.slice(n, n + 2).readUIntLE(0,2); n += 2; } else { dlen = script.slice(n, n + 4).readUIntLE(0,4); n += 4; } if((n + dlen) > script.length) { throw Error('IndexError'); } if(dlen > 0) op.data = script.slice(n, n + dlen); n += dlen } ops.push(op); } } catch(e) { //console.log(e); throw Error('truncated script') } return ops; }
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
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(), });
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
constructor() { super(); this._aborted = 0; this._helloReceived = false; this.receiveBufferSize = 0; this.sendBufferSize = 0; this.maxMessageSize = 0; this.maxChunkCount = 0; this.protocolVersion = 0; }
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
this._transport.on("message", (messageChunk: Buffer) => { /** * notify the observers that ClientSecureChannelLayer has received a message chunk * @event receive_chunk * @param message_chunk */ this.emit("receive_chunk", messageChunk); this._on_receive_message_chunk(messageChunk); });
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
text: text({ url, host }), html: html({ url, host, email }), }) }, options, } }
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
) => [number, number, string] | undefined;
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
export function get(key: "treeIcons"): boolean; export function get(key: "apiUrl"): string;
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
api.update = async function(req, res) { const { commentForm } = req.body; const pageId = commentForm.page_id; const comment = commentForm.comment; const isMarkdown = commentForm.is_markdown; const commentId = commentForm.comment_id; const author = commentForm.author; if (comment === '') { return res.json(ApiResponse.error('Comment text is required')); } if (commentId == null) { return res.json(ApiResponse.error('\'comment_id\' is undefined')); } if (author !== req.user.username) { return res.json(ApiResponse.error('Only the author can edit')); } // check whether accessible const isAccessible = await Page.isAccessiblePageByViewer(pageId, req.user); if (!isAccessible) { return res.json(ApiResponse.error('Current user is not accessible to this page.')); } let updatedComment; try { updatedComment = await Comment.updateCommentsByPageId(comment, isMarkdown, commentId); } catch (err) { logger.error(err); return res.json(ApiResponse.error(err)); } res.json(ApiResponse.success({ comment: updatedComment })); // process notification if needed };
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
new ParsingError('only trash', 7), ], }); });
1
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
safe
export function cleanObject(obj: any): any { return Object.entries(obj).reduce( (obj, [key, value]) => value === undefined ? obj : { ...obj, [key]: value }, {} ); }
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 processUrl(url: string): void { if (!global.mainWindow) return; console.log("Handling link: ", url); global.mainWindow.loadURL(url.replace(PROTOCOL, "vector://")); }
0
TypeScript
CWE-416
Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
https://cwe.mitre.org/data/definitions/416.html
vulnerable
TEST_F(AsStringGraphTest, Float_5_2_Format) { TF_ASSERT_OK(Init(DT_FLOAT, /*fill=*/"", /*width=*/5, /*precision=*/2)); AddInputFromArray<float>(TensorShape({4}), {-42, 0, 3.14159, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({4})); test::FillValues<tstring>(&expected, {"-42.00", " 0.00", " 3.14", "42.00"}); 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
const walkHtmlTokens = (tokens:any[]) => { if (!tokens || !tokens.length) return; for (const token of tokens) { if (!['html_block', 'html_inline'].includes(token.type)) { walkHtmlTokens(token.children); continue; } const cacheKey = md5(escape(token.content)); let sanitizedContent = context.cache.get(cacheKey); if (!sanitizedContent) { sanitizedContent = htmlUtils.sanitizeHtml(token.content); } token.content = sanitizedContent; context.cache.put(cacheKey, sanitizedContent, 1000 * 60 * 60); walkHtmlTokens(token.children); } };
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
[_sanitize](svg) { return svg.removeAttr('onload'); }
0
TypeScript
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
export function get(key: "apiUrl"): string; export function get(key: "images.markdownPasteFormat"): "markdown" | "html";
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
buildRawNFT1GenesisTx(config: configBuildRawNFT1GenesisTx, type = 0x01) { let config2: configBuildRawGenesisTx = { slpGenesisOpReturn: config.slpNFT1GenesisOpReturn, mintReceiverAddress: config.mintReceiverAddress, mintReceiverSatoshis: config.mintReceiverSatoshis, batonReceiverAddress: null, bchChangeReceiverAddress: config.bchChangeReceiverAddress, input_utxos: config.input_utxos, allowed_token_burning: [ config.parentTokenIdHex ] } return this.buildRawGenesisTx(config2); }
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
OpenSSH_Public.parse = (str) => { const m = regexp.exec(str); if (m === null) return null; // m[1] = full type // m[2] = base type // m[3] = base64-encoded public key // m[4] = comment const fullType = m[1]; const baseType = m[2]; const data = Buffer.from(m[3], 'base64'); const comment = (m[4] || ''); const type = readString(data, data._pos, true); if (type === undefined || type.indexOf(baseType) !== 0) return new Error('Malformed OpenSSH public key'); return parseDER(data, baseType, comment, fullType); };
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 ( private sanitizer: DomSanitizer, private serverService: ServerService, private notifier: Notifier ) { }
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 process_request_callback(requestData: RequestData, err?: Error | null, response?: Response) { assert(typeof requestData.callback === "function"); const request = requestData.request; if (!response && !err && requestData.msgType !== "CLO") { // this case happens when CLO is called and when some pending transactions // remains in the queue... err = new Error(" Connection has been closed by client , but this transaction cannot be honored"); } if (response && response instanceof ServiceFault) { response.responseHeader.stringTable = [...(response.responseHeader.stringTable || [])]; err = new Error(" serviceResult = " + response.responseHeader.serviceResult.toString()); // " returned by server \n response:" + response.toString() + "\n request: " + request.toString()); (err as any).response = response; ((err as any).request = request), (response = undefined); } const theCallbackFunction = requestData.callback; /* istanbul ignore next */ if (!theCallbackFunction) { throw new Error("Internal error"); } assert(requestData.msgType === "CLO" || (err && !response) || (!err && response)); // let set callback to undefined to prevent callback to be called again requestData.callback = undefined; theCallbackFunction(err || null, !err && response !== null ? response : undefined); }
0
TypeScript
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
vulnerable
export function add_attribute(name, value, boolean) { if (value == null || (boolean && !value)) return ''; const assignment = (boolean && value === true) ? '' : `="${escape_attribute_value(value.toString())}"`; return ` ${name}${assignment}`; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
return next.handle(req).pipe(catchError(err => { if (err.status === 401) { this.authenticationService.logout(); if (!req.url.includes('/v3/auth')) { // only reload the page if we aren't on the auth pages, this is so that we can display the auth errors. const stateUrl = this.router.routerState.snapshot.url; const _ = this.router.navigate(['/login'], {queryParams: {next: stateUrl}}); } } else if (err.status >= 500) {
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
export function getExtensionPath(): string { return extensionPath; }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function generate( target: any, hierarchies: SetupPropParam[], forceOverride?: boolean ) { let current = target; hierarchies.forEach(info => { const descriptor = normalizeDescriptor(info); const {value, type, create, override, created, skipped, got} = descriptor; const name = getNonEmptyPropName(current, descriptor); if (forceOverride || override || !current[name] || typeof current[name] !== 'object') { const obj = value ? value : type ? new type() : create ? create.call(current, current, name) : {}; current[name] = obj; if (created) { created.call(current, current, name, obj); } } else { if (skipped) { skipped.call(current, current, name, current[name]); } } const parent = current; current = current[name]; if (got) { got.call(parent, parent, name, current); } }); return current; }
0
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
vulnerable
exports.Terminal = command => new Promise((resolve, reject) => { child_process.exec(command, {maxBuffer : 1500 * 1024}, function(error, stdout, stderr) { if( !!error ) reject( error ) else resolve( stdout || stderr ) }) })
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
from: { name: globalDb.getServerTitle(), address: returnAddress }, subject: "Testing your Sandstorm's SMTP setting", text: "Success! Your outgoing SMTP is working.", smtpConfig: restConfig, }); } catch (e) { // Attempt to give more accurate error messages for a variety of known failure modes, // and the actual exception data in the event a user hits a new failure mode. if (e.syscall === "getaddrinfo") { if (e.code === "EIO" || e.code === "ENOTFOUND") { throw new Meteor.Error("getaddrinfo " + e.code, "Couldn't resolve \"" + smtpConfig.hostname + "\" - check for typos or broken DNS."); } } else if (e.syscall === "connect") { if (e.code === "ECONNREFUSED") { throw new Meteor.Error("connect ECONNREFUSED", "Server at " + smtpConfig.hostname + ":" + smtpConfig.port + " refused connection. Check your settings, firewall rules, and that your mail server is up."); } } else if (e.name === "AuthError") { throw new Meteor.Error("auth error", "Authentication failed. Check your credentials. Message from " + smtpConfig.hostname + ": " + e.data); } throw new Meteor.Error("other-email-sending-error", "Error while trying to send test email: " + JSON.stringify(e)); } },
1
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
safe
export function stringEncode(string: string) { let encodedString = ''; for (let i = 0; i < string.length; i++) { let charCodePointHex = string.charCodeAt(i).toString(16); encodedString += `\\u${charCodePointHex}`; } return encodedString; }
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
init: (buf, start) => { buffer = buf; pos = (typeof start === 'number' ? start : 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
([ key, value ]) => ({ [key]: exec.bind(null, `git show -s --format=%${value}`) }), ),
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
export async function csrfCheck(ctx: AppContext, isPublicRoute: boolean) { if (isApiRequest(ctx)) return; if (isPublicRoute) return; if (!['POST', 'PUT'].includes(ctx.method)) return; if (ctx.path === '/logout') return; const userId = ctx.joplin.owner ? ctx.joplin.owner.id : ''; if (!userId) return; const fields = await bodyFields<BodyWithCsrfToken>(ctx.req); if (!fields._csrf) throw new ErrorForbidden('CSRF token is missing'); if (!(await ctx.joplin.models.token().isValid(userId, fields._csrf))) { throw new ErrorForbidden(`Invalid CSRF token: ${fields._csrf}`); } await ctx.joplin.models.token().deleteByValue(userId, fields._csrf); }
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
const assigner = ( ...args: any[] ) => { console.log( { args } ) return args.reduce( ( a, b ) => { if ( untracker.includes( a ) ) throw new TypeError( `can't convert ${a} to object` ) if ( useuntrack && untracker.includes( b ) ) return a Object.keys( b ).forEach( key => { if ( untracker.includes( a[key] ) ) a[key] = b[key] else a[key] = delegate.call( this, a[key], b[key] ) } ) return a } ) } return assigner } Assigner.count = ( qty: number, delegate: ( arg: any, ...args: any[] ) => any ) => { const assigner = ( ...receives: any[] ) => { let group = receives.shift() if ( untracker.includes( group ) ) throw new TypeError( `can't convert ${group} to object` ) let args = receives.splice( 0, qty - 1 ) while ( args.length ) { const keys = [] for ( const arg of args ) for ( const key of Object.keys( arg ) ) if ( !keys.includes( key ) ) keys.push( key ) for ( const key of keys ) group[key] = delegate.call( this, group[key], ...args.map( arg => arg[key] ) ) args = receives.splice( 0, qty - 1 ) } return group } return assigner } declare namespace Assigner { export type BasicTypes = string | number | symbol | bigint | object | boolean | Function export type Types = BasicTypes | Types[] export type TypesWithExclude = BasicTypes | undefined | null | TypesWithExclude[] } export { Assigner }
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
constructor() { super(); let Q = async A => { A }; }
1
TypeScript
CWE-119
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
https://cwe.mitre.org/data/definitions/119.html
safe
export declare function applyCommandArgs(configuration: any, argv: string[]): void; export declare function setDeepProperty(obj: any, propertyPath: string, value: any): void;
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 applyInlineFootnotes(elem) { const footnoteRefs = elem.querySelectorAll("sup.footnote-ref"); footnoteRefs.forEach((footnoteRef) => { const expandableFootnote = document.createElement("a"); expandableFootnote.classList.add("expand-footnote"); expandableFootnote.innerHTML = iconHTML("ellipsis-h"); expandableFootnote.href = ""; expandableFootnote.role = "button"; expandableFootnote.dataset.footnoteId = footnoteRef .querySelector("a") .id.replace("footnote-ref-", ""); footnoteRef.after(expandableFootnote); }); if (footnoteRefs.length) { elem.classList.add("inline-footnotes"); } }
0
TypeScript
CWE-755
Improper Handling of Exceptional Conditions
The software does not handle or incorrectly handles an exceptional condition.
https://cwe.mitre.org/data/definitions/755.html
vulnerable
static buildSendOpReturn(config: configBuildSendOpReturn, type = 0x01) { return SlpTokenType1.buildSendOpReturn( config.tokenIdHex, config.outputQtyArray, 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
get: ({ params }) => ({ status: 200, body: { id: params.userId, name: 'bbb' } }) }))
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
setEntries(entries) { if (entries.length === 0) { this.emptyList(); return; } let htmlToInsert = ''; for (let timesheet of entries) { let label = this.attributes['template'] .replace('%customer%', timesheet.project.customer.name) .replace('%project%', timesheet.project.name) .replace('%activity%', timesheet.activity.name); htmlToInsert += `<li>` + `<a href="${ this.attributes['href'].replace('000', timesheet.id) }" data-event="kimai.timesheetStart kimai.timesheetUpdate" class="api-link" data-method="PATCH" data-msg-error="timesheet.start.error" data-msg-success="timesheet.start.success">` + `<i class="${ this.attributes['icon'] }"></i> ${ label }` + `</a>` + `</li>`; } this.itemList.innerHTML = htmlToInsert; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
export function applyCommandArgs(configuration: any, argv: string[]) { if (!argv || !argv.length) { return; } argv = argv.slice(2); const parsedArgv = yargs(argv); const argvKeys = Object.keys(parsedArgv); if (!argvKeys.length) { return; } debug("Appling command arguments:", parsedArgv); const CONFIG_PROP = 'config'; if (parsedArgv[CONFIG_PROP]) { const configFile = path.resolve(process.cwd(), parsedArgv[CONFIG_PROP]); applyConfigFile(configuration, configFile); } for (const key in parsedArgv) { if (!parsedArgv.hasOwnProperty(key)) { continue; } if (key.startsWith('_')) { continue; } if (key.endsWith('_')) { continue; } if (key === CONFIG_PROP) { continue; } const configKey = key .replace(/_/g, "."); debug(`Found config value from cmd args '${key}' to '${configKey}'`); setDeepProperty(configuration, configKey, parsedArgv[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
constructor(name, expected, actual) { super(); Error.captureStackTrace(this, ERR_INVALID_ARG_TYPE); assert(typeof name === 'string', `'name' must be a string`); // determiner: 'must be' or 'must not be' let determiner; if (typeof expected === 'string' && expected.startsWith('not ')) { determiner = 'must not be'; expected = expected.replace(/^not /, ''); } else { determiner = 'must be'; } let msg; if (name.endsWith(' argument')) { // For cases like 'first argument' msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; } else { const type = (name.includes('.') ? 'property' : 'argument'); msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; } msg += `. Received type ${typeof actual}`; this.message = msg; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function esc<T=unknown>(value: T): T|string; export function transform(input: string, options?: Options & { format?: 'esm' | 'cjs' }): string;
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
const pullVal = (obj, path, val, options = {strict: true}) => { if (obj === undefined || obj === null || path === undefined) { return obj; } // Clean the path path = clean(path); const pathParts = split(path); const part = pathParts.shift(); if (part === "__proto__") return obj; if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = decouple(obj[part], options) || {}; // Recurse - we don't need to assign obj[part] the result of this call because // we are modifying by reference since we haven't reached the furthest path // part (leaf) node yet pullVal(obj[part], pathParts.join("."), val, options); } else if (part) { obj[part] = decouple(obj[part], options) || []; // Recurse - this is the leaf node so assign the response to obj[part] in // case it is set to an immutable response obj[part] = pullVal(obj[part], "", val, options); } else { // The target array is the root object, pull the value obj = decouple(obj, options) || []; if (!(obj instanceof Array)) { throw("Cannot pull from a path whose leaf node is not an array!"); } let index = -1; // Find the index of the passed value if (options.strict === true) { index = obj.indexOf(val); } else { // Do a non-strict check index = obj.findIndex((item) => { return match(item, val); }); } if (index > -1) { // Remove the item from the array obj.splice(index, 1); } } return decouple(obj, 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 PageantSock() { this.proc = undefined; this.buffer = null; }
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 setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: number, value: CallIntoRenderer) { // eslint-disable-next-line no-undef const wr = new WeakRef<CallIntoRenderer>(value); const mapKey = id[0] + '~' + id[1]; rendererFunctionCache.set(mapKey, wr); finalizationRegistry.register(value, { id, webContents: wc, frameId } as FinalizerInfo); return value; }
0
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
vulnerable
objectKeys(data).forEach((key) => { obj.set(key, deserializer(data[key], baseType) as T); });
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
export const openExternal = async (url: string, httpsOnly: boolean = false): Promise<void> => { try { const urlProtocol = URL.parse(url).protocol || ''; const allowedProtocols = ['https:']; if (!httpsOnly) { allowedProtocols.push('ftp:', 'http:', 'mailto:'); } if (!allowedProtocols.includes(urlProtocol)) { logger.warn(`Prevented opening external URL "${url}".`); showWarningDialog(`Prevented opening external URL "${url}".`); return; } await shell.openExternal(url); } catch (error) { logger.error(error); } };
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
return function genOpenSSLRSAPriv(n, e, d, iqmp, p, q) { const bn_d = bigIntFromBuffer(d); const dmp1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(p) - 1n)); const dmq1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(q) - 1n)); return makePEM('RSA PRIVATE', genRSAASN1Buf(n, e, d, p, q, dmp1, dmq1, iqmp)); };
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 isValidKey(key: string): boolean { return key !== '__proto__'; }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
export function escape(value: unknown, is_attr = false) { const str = String(value); const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX; pattern.lastIndex = 0; let escaped = ''; let last = 0; while (pattern.test(str)) { const i = pattern.lastIndex - 1; const ch = str[i]; escaped += str.substring(last, i) + (ch === '&' ? '&amp;' : (ch === '"' ? '&quot;' : '&lt;')); last = i + 1; } return escaped + str.substring(last); }
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
a: () => { /*_*/ } }, { a: source } ); expect({ a: source }).to.deep.equal(target); expect(source).to.equal(target.a); });
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
function installRule(markdownIt:any, mdOptions:any, ruleOptions:any, context:any) { markdownIt.core.ruler.push('sanitize_html', (state:any) => { const tokens = state.tokens; const walkHtmlTokens = (tokens:any[]) => { if (!tokens || !tokens.length) return; for (const token of tokens) { if (!['html_block', 'html_inline'].includes(token.type)) { walkHtmlTokens(token.children); continue; } const cacheKey = md5(escape(token.content)); let sanitizedContent = context.cache.get(cacheKey); if (!sanitizedContent) { sanitizedContent = htmlUtils.sanitizeHtml(token.content); } token.content = sanitizedContent; context.cache.put(cacheKey, sanitizedContent, 1000 * 60 * 60); walkHtmlTokens(token.children); } }; walkHtmlTokens(tokens); }); }
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
module.exports = async function(tag) { if (!tag || ![ 'string', 'number' ].includes(typeof tag)) { throw new TypeError(`string was expected, instead got ${tag}`); } const { message, author, email } = this; await Promise.all([ exec(`git config user.name "${await author}"`), exec(`git config user.email "${await email}"`), ]); await exec(`git tag -a ${JSON.stringify(tag)} -m "${await message}"`); await exec(`git push origin ${JSON.stringify(`refs/tags/${tag}`)}`); };
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
handler: function ({log} = {}) { if (!this.server.options.pasv_url) { return this.reply(502); } this.connector = new PassiveConnector(this); return this.connector.setupServer() .then((server) => { let address = this.server.options.pasv_url; // Allow connecting from local if (isLocalIP(this.ip)) { address = this.ip; } const {port} = server.address(); const host = address.replace(/\./g, ','); const portByte1 = port / 256 | 0; const portByte2 = port % 256; return this.reply(227, `PASV OK (${host},${portByte1},${portByte2})`); }) .catch((err) => { log.error(err); return this.reply(err.code || 425, err.message); }); },
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
([ key, value ]) => ({ [key]: list.bind(null, value) }), ),
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
function foo() { var_dump(substr_compare("\x00", "\x00\x00\x00\x00\x00\x00\x00\x00", 0, 65535, false)); }
1
TypeScript
CWE-125
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/125.html
safe
TEST_F(AsStringGraphTest, LongFill) { Status s = Init(DT_INT32, /*fill=*/"asdf"); ASSERT_EQ(error::INVALID_ARGUMENT, s.code()); ASSERT_TRUE(absl::StrContains(s.error_message(), "Fill string must be one or fewer characters")); }
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
constructor(private readonly authService: AuthService) { super(); }
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
type: new GraphQLNonNull(parseGraphQLSchema.viewerType), async resolve(_source, _args, context, queryInfo) { try { return await getUserFromSessionToken( context, queryInfo, 'user.', false ); } catch (e) { parseGraphQLSchema.handleError(e); } }, }, true, true ); };
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
return `1 ${base} = ${c.amount(d.value, quote)}<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
function applyCommandArgs(configuration, argv) { if (!argv || !argv.length) { return; } argv = argv.slice(2); const parsedArgv = yargs(argv); const argvKeys = Object.keys(parsedArgv); if (!argvKeys.length) { return; } debug("Appling command arguments:", parsedArgv); const CONFIG_PROP = 'config'; if (parsedArgv[CONFIG_PROP]) { const configFile = path.resolve(process.cwd(), parsedArgv[CONFIG_PROP]); applyConfigFile(configuration, configFile); } for (const key in parsedArgv) { if (!parsedArgv.hasOwnProperty(key)) { continue; } if (key.startsWith('_')) { continue; } if (key.endsWith('_')) { continue; } if (key === CONFIG_PROP) { continue; } const configKey = key .replace(/_/g, "."); debug(`Found config value from cmd args '${key}' to '${configKey}'`); setDeepProperty(configuration, configKey, parsedArgv[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
private _on_receive_message_chunk(messageChunk: Buffer) { /* istanbul ignore next */ if (doDebug1) { const _stream = new BinaryStream(messageChunk); const messageHeader = readMessageHeader(_stream); debugLog("CLIENT RECEIVED " + chalk.yellow(JSON.stringify(messageHeader) + "")); debugLog("\n" + hexDump(messageChunk)); debugLog(messageHeaderToString(messageChunk)); } this.messageBuilder.feed(messageChunk); }
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() { this.end(); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function main() { try { let tag = process.env.GITHUB_REF; if (core.getInput('tag')) { tag = `refs/tags/${core.getInput('tag')}`; } exec(`git for-each-ref --format='%(contents)' ${tag}`, (err, stdout) => { if (err) { core.setFailed(err); } else { core.setOutput('git-tag-annotation', stdout); } }); } catch (error) { core.setFailed(error.message); } }
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
newSig.set(s, 4 + 4 + r.length); return newSig; } }
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
static parseChunkToInt(intBytes: Buffer, minByteLen: number, maxByteLen: number, raise_on_Null = false) { // # Parse data as unsigned-big-endian encoded integer. // # For empty data different possibilities may occur: // # minByteLen <= 0 : return 0 // # raise_on_Null == False and minByteLen > 0: return None // # raise_on_Null == True and minByteLen > 0: raise SlpInvalidOutputMessage if(intBytes.length >= minByteLen && intBytes.length <= maxByteLen) return intBytes.readUIntBE(0, intBytes.length) if(intBytes.length === 0 && !raise_on_Null) return null; throw Error('Field has wrong length'); }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
Object.keys(data).forEach((key) => { obj.add(ctx.next(data[key])); });
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
other_senders_count: Math.max(0, all_senders.length - MAX_AVATAR), other_sender_names, muted, topic_muted, participated: topic_data.participated, full_last_msg_date_time: full_datetime, }; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
export function setupCleanupOnExit(cssPath: string) { if (!hasSetupCleanupOnExit){ process.on('SIGINT', () => { console.log('Exiting, running CSS cleanup'); fs.lstat(cssPath, (error: Error, stats: fs.Stats): void => { if (stats.isDirectory) { exec(`rm -r ${cssPath}`, function(error) { if (error) { console.error(error); process.exit(1); } console.log('Deleted CSS files'); }); } else { console.error('Could not delete CSS files because the given path is not a directory:', cssPath); process.exit(1); } }); hasSetupCleanupOnExit = true; }); } }
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 formatMessage(msg, output) { var output = output; output.parseTags = true; msg = output._parseTags(msg); output.parseTags = false; return 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
function genOpenSSLDSAPriv(p, q, g, y, x) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); asnWriter.writeInt(0x00, Ber.Integer); asnWriter.writeBuffer(p, Ber.Integer); asnWriter.writeBuffer(q, Ber.Integer); asnWriter.writeBuffer(g, Ber.Integer); asnWriter.writeBuffer(y, Ber.Integer); asnWriter.writeBuffer(x, Ber.Integer); asnWriter.endSequence(); return makePEM('DSA PRIVATE', asnWriter.buffer); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
const getCdnMarkup = ({ version, cdnUrl = '//cdn.jsdelivr.net/npm', faviconUrl }) => { const buildCDNUrl = (packageName: string, suffix: string) => filter(`${cdnUrl}/${packageName}/${version ? `@${version}/` : ''}${suffix}` || '') return ` <link rel="stylesheet" href="${buildCDNUrl('graphql-playground-react', 'build/static/css/index.css')}" /> ${typeof faviconUrl === 'string' ? `<link rel="shortcut icon" href="${filter(faviconUrl || '')}" />` : ''} ${faviconUrl === undefined ? `<link rel="shortcut icon" href="${buildCDNUrl('graphql-playground-react', 'build/favicon.png')}" />` : ''} <script src="${buildCDNUrl('graphql-playground-react', 'build/static/js/middleware.js')}" ></script> `}
1
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe