code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
function onPaste(e){if(e.clipboardData&&e.clipboardData.items){var items=e.clipboardData.items;if(items){for(var i=0;i<items.length;i++){if(items[i].type.indexOf("image")!==-1){var blob=items[i].getAsFile();var reader=new FileReader();reader.onload=onFileLoaded;reader.readAsDataURL(blob)}}}}else{setTimeout(checkInput,100)}}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 initialize(){destroy();if(!window.Clipboard){pasteCatcher=document.createElement('template');pasteCatcher.id='screenshot-pastezone';pasteCatcher.contentEditable=!0;pasteCatcher.style.opacity=0;pasteCatcher.style.position='fixed';pasteCatcher.style.top=0;pasteCatcher.style.right=0;pasteCatcher.style.width=0;document.body.insertBefore(pasteCatcher,document.body.firstChild);pasteCatcher.focus();document.addEventListener('click',setFocus);document.getElementById('screenshot-zone').addEventListener('click',setFocus)} window.addEventListener('paste',onPaste,!1)}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 destroy(){if(KB.exists('#screenshot-pastezone')){KB.find('#screenshot-pastezone').remove()} document.removeEventListener('click',setFocus);pasteCatcher=null}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 checkInput(){var child=pasteCatcher.childNodes[0];if(child){if(child.tagName==='IMG'){createImage(child.src)}} pasteCatcher.innerHTML=''}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 createImage(blob){var pastedImage=new Image();pastedImage.src=blob;pastedImage.onload=function(){var sourceSplit=blob.split('base64,');inputElement.value=sourceSplit[1]};var zone=document.getElementById('screenshot-zone');zone.innerHTML='';zone.className='screenshot-pasted';zone.appendChild(pastedImage);destroy();initialize()}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
KB.on('modal.close',function(){destroy()});this.render=function(){inputElement=KB.dom('input').attr('type','hidden').attr('name','screenshot').build();containerElement.appendChild(inputElement);initialize()}});KB.component('select-dropdown-autocomplete',function(containerElement,options){var componentElement,inputElement,inputHiddenElement,chevronIconElement,loadingIconElement;function onLoadingStart(){KB.dom(loadingIconElement).show();KB.dom(chevronIconElement).hide()}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
this.render=function(){componentElement=buildComponentElement();containerElement.appendChild(componentElement)}});KB.component('screenshot',function(containerElement){var pasteCatcher=null;var inputElement=null;function onFileLoaded(e){createImage(e.target.result)}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
this.render=function(){componentElement=buildComponentElement();containerElement.appendChild(componentElement)}});KB.component('screenshot',function(containerElement){var pasteCatcher=null;var inputElement=null;function onFileLoaded(e){createImage(e.target.result)}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 setFocus(){if(pasteCatcher!==null){pasteCatcher.focus()}}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 createImage(blob){var pastedImage=new Image();pastedImage.src=blob;pastedImage.onload=function(){var sourceSplit=blob.split('base64,');inputElement.value=sourceSplit[1]};var zone=document.getElementById('screenshot-zone');zone.innerHTML='';zone.className='screenshot-pasted';zone.appendChild(pastedImage);destroy();initialize()}
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 initialize() { destroy(); if (! window.Clipboard) { // Insert the content editable at the top to avoid scrolling down in the board view pasteCatcher = document.createElement('template'); pasteCatcher.id = 'screenshot-pastezone'; pasteCatcher.contentEditable = true; pasteCatcher.style.opacity = 0; pasteCatcher.style.position = 'fixed'; pasteCatcher.style.top = 0; pasteCatcher.style.right = 0; pasteCatcher.style.width = 0; document.body.insertBefore(pasteCatcher, document.body.firstChild); pasteCatcher.focus(); // Set the focus when clicked anywhere in the document document.addEventListener('click', setFocus); // Set the focus when clicked in screenshot dropzone document.getElementById('screenshot-zone').addEventListener('click', setFocus); } window.addEventListener('paste', onPaste, false); }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 onPaste(e) { // Firefox doesn't have the property e.clipboardData.items (only Chrome) if (e.clipboardData && e.clipboardData.items) { var items = e.clipboardData.items; if (items) { for (var i = 0; i < items.length; i++) { // Find an image in pasted elements if (items[i].type.indexOf("image") !== -1) { var blob = items[i].getAsFile(); // Get the image as base64 data var reader = new FileReader(); reader.onload = onFileLoaded; reader.readAsDataURL(blob); } } } } else { // Handle Firefox setTimeout(checkInput, 100); } }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 destroy() { if (KB.exists('#screenshot-pastezone')) { KB.find('#screenshot-pastezone').remove(); } document.removeEventListener('click', setFocus); pasteCatcher = null; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 checkInput() { var child = pasteCatcher.childNodes[0]; if (child) { // If the user pastes an image, the src attribute // will represent the image as a base64 encoded string. if (child.tagName === 'IMG') { createImage(child.src); } } pasteCatcher.innerHTML = ''; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 createImage(blob) { var pastedImage = new Image(); pastedImage.src = blob; // Send the image content to the form variable pastedImage.onload = function() { var sourceSplit = blob.split('base64,'); inputElement.value = sourceSplit[1]; }; var zone = document.getElementById('screenshot-zone'); zone.innerHTML = ''; zone.className = 'screenshot-pasted'; zone.appendChild(pastedImage); destroy(); initialize(); }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 setFocus() { if (pasteCatcher !== null) { pasteCatcher.focus(); } }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
globalId: getGlobalId(schema, schema.info.singularName, 'admin'), }); } else { throw new Error( `Incorrect Content Type UID "${uid}". The UID should start with api::, plugin:: or admin::.` ); } Object.defineProperty(schema, 'privateAttributes', { get() { return getPrivateAttributes(schema); }, }); // attributes Object.assign(schema.attributes, { [CREATED_AT_ATTRIBUTE]: { type: 'datetime', }, // TODO: handle on edit set to new date [UPDATED_AT_ATTRIBUTE]: { type: 'datetime', }, }); if (hasDraftAndPublish(schema)) { schema.attributes[PUBLISHED_AT_ATTRIBUTE] = { type: 'datetime', configurable: false, writable: true, visible: false, }; } const isPrivate = !_.get(schema, 'options.populateCreatorFields', false); schema.attributes[CREATED_BY_ATTRIBUTE] = { type: 'relation', relation: 'oneToOne', target: 'admin::user', configurable: false, writable: false, visible: false, useJoinTable: false, private: isPrivate, }; schema.attributes[UPDATED_BY_ATTRIBUTE] = { type: 'relation', relation: 'oneToOne', target: 'admin::user', configurable: false, writable: false, visible: false, useJoinTable: false, private: isPrivate, }; Object.assign(schema, { actions, lifecycles }); return schema; };
0
JavaScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
get() { return getPrivateAttributes(schema); },
0
JavaScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
const getPrivateAttributes = (model = {}) => { return _.union( strapi.config.get('api.responses.privateAttributes', []), _.get(model, 'options.privateAttributes', []), _.keys(_.pickBy(model.attributes, (attr) => !!attr.private)) ); };
0
JavaScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
const isPrivateAttribute = (model, attributeName) => { return model?.privateAttributes?.includes(attributeName) ?? false; };
0
JavaScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
module.exports = ({ schema, key, attribute }, { remove }) => { if (!attribute) { return; } const isPrivate = isPrivateAttribute(schema, key) || attribute.private === true; if (isPrivate) { remove(key); } };
0
JavaScript
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
updateKeyValueComponent() { let result = '' let index = 0 this.fieldValue.forEach((row) => { const [key, value] = row result += this.interpolatedRow(key, value, index) index++ }) this.rowsTarget.innerHTML = result window.initTippy() }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
updateKeyValueComponent() { let result = '' let index = 0 this.fieldValue.forEach((row) => { const [key, value] = row result += this.interpolatedRow(key, value, index) index++ }) this.rowsTarget.innerHTML = result window.initTippy() }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 convertRawVariant(rawColumnValue, column, context) { var ret; // if the input is a non-empty string, convert it to a json object if (Util.string.isNotNullOrEmpty(rawColumnValue)) { try { ret = eval("(" + rawColumnValue + ")"); } catch (parseError) { // check if raw string is in XML format // ensure each tag is enclosed and all attributes and elements are valid if (XMLValidator.validate(rawColumnValue) === true) { // use XML parser ret = new XMLParser().parse(rawColumnValue); } else { // TODO: log the error // throw the error throw parseError; } } } return ret; }
0
JavaScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
executeOptions.complete = function (err, stmt) { assert.ok(!err, JSON.stringify(err)); var rowCount = 0; var stream = stmt.streamRows(); stream.on('readable', function () { var row; while ((row = stream.read()) !== null) { assert.deepStrictEqual(normalize ? normalizeRowObject(row) : row, expected[rowCount]); rowCount++; } }); stream.on('error', function (err) { assert.ok(!err, JSON.stringify(err)); }); stream.on('end', function () { assert.strictEqual(rowCount, expected.length); callback(); }); };
0
JavaScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
module.exports.executeQueryAndVerify = function (connection, sql, expected, callback, bindArray, normalize) { // Sometimes we may not want to normalize the row first normalize = (typeof normalize !== "undefined" && normalize != null) ? normalize : true; var executeOptions = {}; executeOptions.sqlText = sql; executeOptions.complete = function (err, stmt) { assert.ok(!err, JSON.stringify(err)); var rowCount = 0; var stream = stmt.streamRows(); stream.on('readable', function () { var row; while ((row = stream.read()) !== null) { assert.deepStrictEqual(normalize ? normalizeRowObject(row) : row, expected[rowCount]); rowCount++; } }); stream.on('error', function (err) { assert.ok(!err, JSON.stringify(err)); }); stream.on('end', function () { assert.strictEqual(rowCount, expected.length); callback(); }); }; if (bindArray != null && bindArray != undefined) { executeOptions.binds = bindArray; } connection.execute(executeOptions); };
0
JavaScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
function escapeArgForInterpolation(arg) { return arg .replace(/[\0\u0008\u001B\u009B]/gu, "") .replace(/\r?\n|\r/gu, " ") .replace(/\^/gu, "^^") .replace(/(["&<>|])/gu, "^$1"); }
0
JavaScript
CWE-526
Cleartext Storage of Sensitive Information in an Environment Variable
The product uses an environment variable to store unencrypted sensitive information.
https://cwe.mitre.org/data/definitions/526.html
vulnerable
export function getShellName({ shell }, { resolveExecutable }) { shell = resolveExecutable( { executable: shell }, { exists: fs.existsSync, readlink: fs.readlinkSync, which: which.sync }, ); const shellName = path.win32.basename(shell); if (getEscapeFunction(shellName, {}) === undefined) { return binCmd; } return shellName; }
0
JavaScript
CWE-150
Improper Neutralization of Escape, Meta, or Control Sequences
The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.
https://cwe.mitre.org/data/definitions/150.html
vulnerable
"getElemAttr": function (elem, attr) { return elem.getAttribute('data-' + attr) || elem.getAttribute(attr); },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 printCard() { getData() let html = "" for (let i = 0; i < entries.length; i++) { let entry = entries[i] entry.residency = entry.zip + " " + entry.residency if (!entry.sex) entry.sex = "uk" html += `<div> <p class="name">${entry.name}</p> <p class="birthdate">${dateToStandard(entry.birthdate)}</p> <p class="residency">${entry.residency}</p> <p class="street">${entry.street}</p> <p class="district">${entry.district}</p> <p class="place">${entry.place}</p> <p class="start">${dateToStandard(entry.start, true)}</p> <p class="first-name">${entry.firstName}</p> <p class="${entry.sex}">&times;</p> <p class="nationality">${entry.nationality}</p> <p class="identity-disk">${entry.identityDisk}</p> <p class="rc-unit">${entry.rcUnit}</p> <p class="unit">${entry.unit}</p> </div>` } document.getElementById("print-area").innerHTML = html print() }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 doExportString() { getData(); let exportArray = []; for (let i = 0; i < entries.length; i++) { let entry = entries[i]; let arrayForEntry = []; arrayForEntry[0] = entry.name; arrayForEntry[1] = entry.firstName; arrayForEntry[2] = dateToStandard(entry.birthdate); arrayForEntry[3] = entry.sex; arrayForEntry[4] = entry.zip; arrayForEntry[5] = entry.residency; arrayForEntry[6] = entry.nationality; arrayForEntry[7] = entry.street; arrayForEntry[8] = entry.identityDisk; arrayForEntry[9] = entry.district; arrayForEntry[10] = entry.rcUnit; arrayForEntry[11] = entry.place; arrayForEntry[12] = entry.unit; arrayForEntry[13] = dateToStandard(entry.start, true); let entryString = ""; for (let j = 0; j < entryLength - 1; j++) { if (arrayForEntry[j] != undefined) entryString += arrayForEntry[j] + ";"; else entryString += ";"; } exportArray.push(entryString); } let newExportString = ""; for (let j = 0; j < exportArray.length; j++) { newExportString += exportArray[j] + "\n"; } exportString = newExportString; document.getElementById("export-overlay").style.display = "inline"; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 setProp(dst, path, value) { var part = path.shift(); if (part === "__proto__") { return dst; } if (path.length > 0) { dst[part] = setProp(dst[part] || {}, path, value); } else { var prevValue = dst[part]; if (prevValue) value = [].concat(prevValue).concat(value); dst[part] = value; } return dst; }
0
JavaScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The product 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
util.setProperty = function setProperty(dst, path, value) { function setProp(dst, path, value) { var part = path.shift(); if (part === "__proto__") { return dst; } if (path.length > 0) { dst[part] = setProp(dst[part] || {}, path, value); } else { var prevValue = dst[part]; if (prevValue) value = [].concat(prevValue).concat(value); dst[part] = value; } return dst; } if (typeof dst !== "object") throw TypeError("dst must be an object"); if (!path) throw TypeError("path must be specified"); path = path.split("."); return setProp(dst, path, value); };
0
JavaScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The product 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
function formatComments(comments) { const headline = `<h2>${t('Responses')}</h2>`; const markup = comments .map((c) => { const image = reactImage(c, true); let source = entities(c.url.split('/')[2]); if (c.author && c.author.name) { source = entities(c.author.name); } const link = `<a class="source" rel="nofollow ugc" href="${c[mentionSource]}">${source}</a>`; let linkclass = "name"; let linktext = `(${t("mention")})`; if (c.name) { linkclass = "name"; linktext = c.name; } else if (c.content && c.content.text) { linkclass = "text"; linktext = extractComment(c); } const type = `<span class="${linkclass}">${linktext}</span>`; return `<li>${image} ${link} ${type}</li>`; }) .join(''); return ` ${headline} <ul class="comments">${markup}</ul> `; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 entities(text) { return text.replace(/&/g, "&amp;") .replace(/</g, "&lt;") .replace(/>/g, "&gt;") .replace(/"/g, "&quot;"); }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
,data: $(this).closest('tr').find('input[data-form="' + mode + '"],select[data-form="' + mode + '"]').serializeArray() ,beforeSend: function() { if (mode == 'add' || mode == 'delete') { $(target).html( '<div class="span2 alert">Request submitted...</div>' ); } } ,success: function() { if (mode == 'add') { toastr.success('Added record'); $('#' + tab + '_form').trigger('submit'); } else if (mode == 'delete') { toastr.success('Deleted record'); $('#' + tab + '_form').trigger('submit'); } else { toastr.success('Updated record'); } } // TODO: fix sanity_ok in Netdisco Web ,error: function() { if (mode == 'add') { toastr.error('Failed to add record'); $('#' + tab + '_form').trigger('submit'); } else if (mode == 'delete') { toastr.error('Failed to delete record'); $('#' + tab + '_form').trigger('submit'); } else { toastr.error('Failed to update record'); } } }); }); // bind qtip2 to show the event log output $(target).on('mouseover', '.nd_jobqueueitem', function(event) { $(this).qtip({ overwrite: false, content: { attr: 'data-content' }, show: { event: event.type, ready: true, delay: 100 }, position: { my: 'top center', at: 'bottom center', target: false }, style: { classes: 'qtip-cluetip qtip-rounded nd_qtip-unconstrained' } }); }); });
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
global.confirmPrompt = function confirmPrompt(message, title) { var dfd = $.Deferred(); message = $('<div>', {width: 400, html: message}); new ConfirmPopup(title || $T('Please confirm'), message, function(confirmed) { if (confirmed) { dfd.resolve(); } else { dfd.reject(); } }).open(); return dfd.promise(); };
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 strip(html) { if (bbcodePluginLoaded) { // stripping out BBCode tags [...][/...] return html.replace(/\[.*?\]/gi, ""); } var tmp = document.createElement("div"); // Add filter before strip html = filter(html); tmp.innerHTML = html; if (tmp.textContent == "" && typeof tmp.innerText == "undefined") { return ""; } return tmp.textContent || tmp.innerText; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 strip(html) { if (bbcodePluginLoaded) { // stripping out BBCode tags [...][/...] return html.replace(/\[.*?\]/gi, ""); } var tmp = document.createElement("div"); // Add filter before strip html = filter(html); tmp.innerHTML = html; // Parse filtered HTML, without applying it to any element in DOM var tmp = new DOMParser().parseFromString(html, 'text/html'); if (!tmp.body || !tmp.body.textContent) { return ""; } return tmp.body.textContent || tmp.body.innerText; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
isSuccess: defer(), }; let sentReply = false; if (shouldOpRespond) { // Listen for message from bot env.ircMock._whenClient(config._server, config._botnick, "say", (self: any, message: any) => { // Say yes back to the bot if (sentReply) { return; } sentReply = true; self.emit("message", receivingOp.nick, config._botnick, "yes"); }); } const res = await env.mockAppService._link(body); if (waitForState) { const state = env.bridgingState[roomId]; // Wait until m.room.bridging has been set to the desired state if (waitForState === "pending") { await state.isPending.promise; } else if (waitForState === "success") { await state.isSuccess.promise; } else if (waitForState === "failure") { await state.isFailed.promise; } } return res; }
0
JavaScript
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
isSuccess: defer(), }; let sentReply = false; if (shouldOpRespond) { // Listen for message from bot env.ircMock._whenClient(config._server, config._botnick, "say", (self: any, message: any) => { // Say yes back to the bot if (sentReply) { return; } sentReply = true; self.emit("message", receivingOp.nick, config._botnick, "yes"); }); } const res = await env.mockAppService._link(body); if (waitForState) { const state = env.bridgingState[roomId]; // Wait until m.room.bridging has been set to the desired state if (waitForState === "pending") { await state.isPending.promise; } else if (waitForState === "success") { await state.isSuccess.promise; } else if (waitForState === "failure") { await state.isFailed.promise; } } return res; }
0
JavaScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
set.${n} = (v) => { $${n} = v return true } `).join('\n')} register('${realUrl}', namespace, set, '${specifiers.get(realUrl)}') ` } } return parentGetSource(url, context, parentGetSource) }
0
JavaScript
NVD-CWE-noinfo
null
null
null
vulnerable
async function getSource (url, context, parentGetSource) { if (hasIitm(url)) { const realUrl = deleteIitm(url) const exportNames = await getExports(realUrl, context, parentGetSource) return { source: ` import { register } from '${iitmURL}' import * as namespace from '${url}' const set = {} ${exportNames.map((n) => ` let $${n} = namespace.${n} export { $${n} as ${n} } set.${n} = (v) => { $${n} = v return true } `).join('\n')} register('${realUrl}', namespace, set, '${specifiers.get(realUrl)}') ` } } return parentGetSource(url, context, parentGetSource) } // For Node.js 16.12.0 and higher. async function load (url, context, parentLoad) { if (hasIitm(url)) { const { source } = await getSource(url, context, parentLoad) return { source, shortCircuit: true, format: 'module' } } return parentLoad(url, context, parentLoad) } if (NODE_MAJOR >= 17 || (NODE_MAJOR === 16 && NODE_MINOR >= 12)) { return { load, resolve } } else { return { load, resolve, getSource, getFormat (url, context, parentGetFormat) { if (hasIitm(url)) { return { format: 'module' } } if (url === entrypoint) { return { format: 'commonjs' } } return parentGetFormat(url, context, parentGetFormat) } } } }
0
JavaScript
NVD-CWE-noinfo
null
null
null
vulnerable
resolve({ adminMeta }, args, context) { if ('isAdminUIBuildProcess' in context || adminMeta.isAccessAllowed === undefined) { return adminMeta; } return Promise.resolve(adminMeta.isAccessAllowed(context)).then(isAllowed => { if (isAllowed) { return adminMeta; } // TODO: ughhhhhh, we really need to talk about errors. // mostly unrelated to above: error or return null here(+ make field nullable)?s throw new Error('Access denied'); }); },
0
JavaScript
CWE-862
Missing Authorization
The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
isBackgroundThrottlingEnabled: ipcRenderer.sendSync('background-throttling/get-is-enabled') }; this.handleChangeUpdateCheckerEnabled = this.handleChangeUpdateCheckerEnabled.bind(this); this.handleOpenPrivacyPolicy = this.handleOpenPrivacyPolicy.bind(this); this.handleSelectedAudioDeviceChanged = this.handleSelectedAudioDeviceChanged.bind(this); this.handleSelectedVideoDeviceChanged = this.handleSelectedVideoDeviceChanged.bind(this); this.handleChangeHardwareAccelerationEnabled = this.handleChangeHardwareAccelerationEnabled.bind(this); this.handleBackgroundThrottlingChanged = this.handleBackgroundThrottlingChanged.bind(this); this.handleOpenUserData = this.handleOpenUserData.bind(this); }
0
JavaScript
CWE-863
Incorrect Authorization
The product 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 isExec(command){ try{ exec(command, { stdio: 'ignore' }) return true } catch (_e){ return false } }
0
JavaScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product 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
html: function (token, attrs, content) { var size = 0, units = "", parsed = parseInt(attrs.defaultattr, 10); if (!isNaN(parsed)) { size = attrs.defaultattr; if (size < 1) { size = 1; } else if (size > 50) { size = 50; } units = "pt"; } else { var fsStrPos = $.inArray(attrs.defaultattr, mybbCmd.fsStr); if (fsStrPos !== -1) { size = attrs.defaultattr; } } return '<font data-scefontsize="' + $.sceditor.escapeEntities(attrs.defaultattr) + '" style="font-size: ' + size + units + ';">' + content + '</font>'; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
setFullpageOnInit: function(html) { this.fullpageDoctype = html.match(/^<\!doctype[^>]*>/i); if (this.fullpageDoctype && this.fullpageDoctype.length == 1) { html = html.replace(/^<\!doctype[^>]*>/i, ''); } html = this.cleanSavePreCode(html, true); html = this.cleanConverters(html); html = this.cleanEmpty(html); html = this.sanitizeHTML(html); this.$editor.html(html); this.setNonEditable(); this.setSpansVerified(); this.sync(); },
0
JavaScript
CWE-610
Externally Controlled Reference to a Resource in Another Sphere
The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.
https://cwe.mitre.org/data/definitions/610.html
vulnerable
setEditor: function(html, strip) { if (strip !== false) { html = this.cleanSavePreCode(html); html = this.cleanStripTags(html); html = this.cleanConvertProtected(html); html = this.cleanConvertInlineTags(html, true); if (this.opts.linebreaks === false) html = this.cleanConverters(html); else html = html.replace(/<p(.*?)>([\w\W]*?)<\/p>/gi, '$2<br>'); } html = html.replace(/&amp;#36;/g, '$'); html = this.cleanEmpty(html); html = this.sanitizeHTML(html); this.$editor.html(html); this.setNonEditable(); this.setSpansVerified(); this.sync(); },
0
JavaScript
CWE-610
Externally Controlled Reference to a Resource in Another Sphere
The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.
https://cwe.mitre.org/data/definitions/610.html
vulnerable
this.onDocumentReady = function(){ $('.custom-file-input').on('change',function(){ $(this).next('.custom-file-label').html($(this).val().replace('C:\\fakepath\\', '')); }); };
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
this.onDocumentReady = function(){ $('.custom-file-input').on('change',function(){ $(this).next('.custom-file-label').text($(this).val().replace('C:\\fakepath\\', '')); }); };
0
JavaScript
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
vulnerable
this.onDocumentReady = function(){ $('.custom-file-input').on('change',function(){ $(this).next('.custom-file-label').text($(this).val().replace('C:\\fakepath\\', '')); }); };
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
buildEventKeydownPre: function(e, current) { e.preventDefault(); this.bufferSet(); var html = $(current).parent().text(); this.insertNode(document.createTextNode('\n')); if (html.search(/\s$/) == -1) { this.insertNode(document.createTextNode('\n')); } this.sync(); this.callback('enter', e); return false; },
0
JavaScript
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
vulnerable
buildEventKeydownPre: function(e, current) { e.preventDefault(); this.bufferSet(); var html = $(current).parent().text(); this.insertNode(document.createTextNode('\n')); if (html.search(/\s$/) == -1) { this.insertNode(document.createTextNode('\n')); } this.sync(); this.callback('enter', e); return false; },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
buildEventKeydownBackspace: function(e, current, parent) { if (parent && current && parent.parentNode.tagName == 'TD' && parent.tagName == 'UL' && current.tagName == 'LI' && $(parent).children('li').length == 1) { var text = $(current).text().replace(/[\u200B-\u200D\uFEFF]/g, ''); if (text == '') { var node = parent.parentNode; $(parent).remove(); this.selectionStart(node); this.sync(); return false; } } if (typeof current.tagName !== 'undefined' && /^(H[1-6])$/i.test(current.tagName)) { var node; if (this.opts.linebreaks === false) node = $('<p>' + this.opts.invisibleSpace + '</p>'); else node = $('<br>' + this.opts.invisibleSpace); $(current).replaceWith(node); this.selectionStart(node); this.sync(); } if (typeof current.nodeValue !== 'undefined' && current.nodeValue !== null) { if (current.remove && current.nodeType === 3 && current.nodeValue.match(/[^\u200B]/g) == null) { $(current).prev().remove(); this.sync(); } } },
0
JavaScript
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
vulnerable
buildEventKeydownBackspace: function(e, current, parent) { if (parent && current && parent.parentNode.tagName == 'TD' && parent.tagName == 'UL' && current.tagName == 'LI' && $(parent).children('li').length == 1) { var text = $(current).text().replace(/[\u200B-\u200D\uFEFF]/g, ''); if (text == '') { var node = parent.parentNode; $(parent).remove(); this.selectionStart(node); this.sync(); return false; } } if (typeof current.tagName !== 'undefined' && /^(H[1-6])$/i.test(current.tagName)) { var node; if (this.opts.linebreaks === false) node = $('<p>' + this.opts.invisibleSpace + '</p>'); else node = $('<br>' + this.opts.invisibleSpace); $(current).replaceWith(node); this.selectionStart(node); this.sync(); } if (typeof current.nodeValue !== 'undefined' && current.nodeValue !== null) { if (current.remove && current.nodeType === 3 && current.nodeValue.match(/[^\u200B]/g) == null) { $(current).prev().remove(); this.sync(); } } },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
buildEventKeyup: function(e) { if (this.rtePaste) return false; var key = e.which; var parent = this.getParent(); var current = this.getCurrent(); if (!this.opts.linebreaks && current.nodeType == 3 && (parent == false || parent.tagName == 'BODY')) { var node = $('<p>').append($(current).clone()); $(current).replaceWith(node); var next = $(node).next(); if (typeof(next[0]) !== 'undefined' && next[0].tagName == 'BR') { next.remove(); } this.selectionEnd(node); } if ((this.opts.convertLinks || this.opts.convertImageLinks || this.opts.convertVideoLinks) && key === this.keyCode.ENTER) { this.buildEventKeyupConverters(); } if (key === this.keyCode.DELETE || key === this.keyCode.BACKSPACE) { return this.formatEmpty(e); } this.callback('keyup', e); this.sync(e); },
0
JavaScript
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
vulnerable
buildEventKeyup: function(e) { if (this.rtePaste) return false; var key = e.which; var parent = this.getParent(); var current = this.getCurrent(); if (!this.opts.linebreaks && current.nodeType == 3 && (parent == false || parent.tagName == 'BODY')) { var node = $('<p>').append($(current).clone()); $(current).replaceWith(node); var next = $(node).next(); if (typeof(next[0]) !== 'undefined' && next[0].tagName == 'BR') { next.remove(); } this.selectionEnd(node); } if ((this.opts.convertLinks || this.opts.convertImageLinks || this.opts.convertVideoLinks) && key === this.keyCode.ENTER) { this.buildEventKeyupConverters(); } if (key === this.keyCode.DELETE || key === this.keyCode.BACKSPACE) { return this.formatEmpty(e); } this.callback('keyup', e); this.sync(e); },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
buildEventDrop: function(e) { e = e.originalEvent || e; if (window.FormData === undefined || !e.dataTransfer) return true; var length = e.dataTransfer.files.length; if (length == 0) return true; e.preventDefault(); var file = e.dataTransfer.files[0]; if (this.opts.dnbImageTypes !== false && this.opts.dnbImageTypes.indexOf(file.type) == -1) { return true; } this.bufferSet(); this.showProgressBar(); if (this.opts.s3 === false) { this.dragUploadAjax(this.opts.imageUpload, file, true, e, this.opts.imageUploadParam); } else { this.s3uploadFile(file); } },
0
JavaScript
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
vulnerable
buildEventDrop: function(e) { e = e.originalEvent || e; if (window.FormData === undefined || !e.dataTransfer) return true; var length = e.dataTransfer.files.length; if (length == 0) return true; e.preventDefault(); var file = e.dataTransfer.files[0]; if (this.opts.dnbImageTypes !== false && this.opts.dnbImageTypes.indexOf(file.type) == -1) { return true; } this.bufferSet(); this.showProgressBar(); if (this.opts.s3 === false) { this.dragUploadAjax(this.opts.imageUpload, file, true, e, this.opts.imageUploadParam); } else { this.s3uploadFile(file); } },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
sync: function(e) { var html = ''; this.cleanUnverified(); if (this.opts.fullpage) html = this.getCodeIframe(); else html = this.$editor.html(); html = this.syncClean(html); html = this.cleanRemoveEmptyTags(html); var source = this.cleanRemoveSpaces(this.$source.val(), false); var editor = this.cleanRemoveSpaces(html, false); if (source == editor) { return false; } html = html.replace(/<\/li><(ul|ol)>([\w\W]*?)<\/(ul|ol)>/gi, '<$1>$2</$1></li>'); if ($.trim(html) === '<br>') html = ''; if (this.opts.xhtml) { var xhtmlTags = ['br', 'hr', 'img', 'link', 'input', 'meta']; $.each(xhtmlTags, function(i,s) { html = html.replace(new RegExp('<' + s + '(.*?[^\/$]?)>', 'gi'), '<' + s + '$1 />'); }); } html = this.callback('syncBefore', false, html); this.$source.val(html); this.setFullpageDoctype(); this.callback('syncAfter', false, html); if (this.start === false) { if (typeof e != 'undefined') { switch(e.which) { case 37: break; case 38: break; case 39: break; case 40: break; default: this.callback('change', false, html); } } else { this.callback('change', false, html); } } },
0
JavaScript
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
vulnerable
sync: function(e) { var html = ''; this.cleanUnverified(); if (this.opts.fullpage) html = this.getCodeIframe(); else html = this.$editor.html(); html = this.syncClean(html); html = this.cleanRemoveEmptyTags(html); var source = this.cleanRemoveSpaces(this.$source.val(), false); var editor = this.cleanRemoveSpaces(html, false); if (source == editor) { return false; } html = html.replace(/<\/li><(ul|ol)>([\w\W]*?)<\/(ul|ol)>/gi, '<$1>$2</$1></li>'); if ($.trim(html) === '<br>') html = ''; if (this.opts.xhtml) { var xhtmlTags = ['br', 'hr', 'img', 'link', 'input', 'meta']; $.each(xhtmlTags, function(i,s) { html = html.replace(new RegExp('<' + s + '(.*?[^\/$]?)>', 'gi'), '<' + s + '$1 />'); }); } html = this.callback('syncBefore', false, html); this.$source.val(html); this.setFullpageDoctype(); this.callback('syncAfter', false, html); if (this.start === false) { if (typeof e != 'undefined') { switch(e.which) { case 37: break; case 38: break; case 39: break; case 40: break; default: this.callback('change', false, html); } } else { this.callback('change', false, html); } } },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
buildBindKeyboard: function() { this.dblEnter = 0; if (this.opts.dragUpload && (this.opts.imageUpload !== false || this.opts.s3 !== false)) { this.$editor.on('drop.redactor', $.proxy(this.buildEventDrop, this)); } this.$editor.on('click.redactor', $.proxy(function() { this.selectall = false; }, this)); this.$editor.on('input.redactor', $.proxy(this.sync, this)); this.$editor.on('paste.redactor', $.proxy(this.buildEventPaste, this)); this.$editor.on('keydown.redactor', $.proxy(this.buildEventKeydown, this)); this.$editor.on('keyup.redactor', $.proxy(this.buildEventKeyup, this)); if ($.isFunction(this.opts.textareaKeydownCallback)) { this.$source.on('keydown.redactor-textarea', $.proxy(this.opts.textareaKeydownCallback, this)); } if ($.isFunction(this.opts.focusCallback)) { this.$editor.on('focus.redactor', $.proxy(this.opts.focusCallback, this)); } var clickedElement; $(document).mousedown(function(e) { clickedElement = $(e.target); }); this.$editor.on('blur.redactor', $.proxy(function(e) { if (!$(clickedElement).hasClass('redactor_toolbar') && $(clickedElement).parents('.redactor_toolbar').length == 0) { this.selectall = false; if ($.isFunction(this.opts.blurCallback)) this.callback('blur', e); } }, this)); },
0
JavaScript
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
vulnerable
buildBindKeyboard: function() { this.dblEnter = 0; if (this.opts.dragUpload && (this.opts.imageUpload !== false || this.opts.s3 !== false)) { this.$editor.on('drop.redactor', $.proxy(this.buildEventDrop, this)); } this.$editor.on('click.redactor', $.proxy(function() { this.selectall = false; }, this)); this.$editor.on('input.redactor', $.proxy(this.sync, this)); this.$editor.on('paste.redactor', $.proxy(this.buildEventPaste, this)); this.$editor.on('keydown.redactor', $.proxy(this.buildEventKeydown, this)); this.$editor.on('keyup.redactor', $.proxy(this.buildEventKeyup, this)); if ($.isFunction(this.opts.textareaKeydownCallback)) { this.$source.on('keydown.redactor-textarea', $.proxy(this.opts.textareaKeydownCallback, this)); } if ($.isFunction(this.opts.focusCallback)) { this.$editor.on('focus.redactor', $.proxy(this.opts.focusCallback, this)); } var clickedElement; $(document).mousedown(function(e) { clickedElement = $(e.target); }); this.$editor.on('blur.redactor', $.proxy(function(e) { if (!$(clickedElement).hasClass('redactor_toolbar') && $(clickedElement).parents('.redactor_toolbar').length == 0) { this.selectall = false; if ($.isFunction(this.opts.blurCallback)) this.callback('blur', e); } }, this)); },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
__html: preparedStackTrace.replace(/(\n)/g, '<br>'), }}/> )} {(validation?.length > 0) && ( <Elem tag="ul" name="validation"> {validation.map(([field, errors]) => ( <Fragment key={field}> {[].concat(errors).map((err, i) => ( <Elem tag="li" key={i} name="message" dangerouslySetInnerHTML={{__html: err}} /> ))} </Fragment> ))} </Elem> )} {(version || errorId) && ( <Elem name="version"> <Space> {version && `Version: ${version}`} {errorId && `Error ID: ${errorId}`} </Space> </Elem> )} <Elem name="actions"> <Space spread> <Elem tag={Button} name="action-slack" target="_blank" icon={<LsSlack/>} href={SLACK_INVITE_URL}> Ask on Slack </Elem> <Space size="small"> {preparedStackTrace && <Button disabled={copied} onClick={copyStacktrace} style={{width: 180}}> {copied ? "Copied" : "Copy Stacktrace"} </Button>} {onGoBack && <Button onClick={onGoBack}>Go Back</Button>} {onReload && <Button onClick={onReload}>Reload</Button>} </Space> </Space>
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
token: jwt.sign({ username: data.username, }, server.jwtSecret), }); } else { log.warn("auth", `Invalid token provided for user ${data.username}. IP=${clientIP}`); callback({ ok: false, msg: "Invalid Token!", }); } } } else { log.warn("auth", `Incorrect username or password for user ${data.username}. IP=${clientIP}`); callback({ ok: false, msg: "Incorrect username or password.", }); } });
0
JavaScript
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
function getGoogleAnalyticsScript(tagId) { let escapedTagId = jsesc(tagId, { isScriptContext: true }); if (escapedTagId) { escapedTagId = escapedTagId.trim(); } return ` <script async src="https://www.googletagmanager.com/gtag/js?id=${escapedTagId}"></script> <script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date());gtag('config', '${escapedTagId}'); </script> `; }
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
testKeySize128Iterations1200: function () { Y.Assert.areEqual('5c08eb61fdf71e4e4ec3cf6ba1f5512b', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 128/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128Iterations2: function () { Y.Assert.areEqual('01dbee7f4a9e243e988b62c73cda935d', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 128/32, iterations: 2 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations50: function () { Y.Assert.areEqual('6b9cf26d45455a43a5b8bb276a403b39e7fe37a0c41e02c281ff3069e1e94f52', C.PBKDF2(C.enc.Hex.parse('f09d849e'), 'EXAMPLE.COMpianist', { keySize: 256/32, iterations: 50 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256: function () { Y.Assert.areEqual('cdedb5281bb2f801565a1122b25635150ad1f7a04bb9f3a333ecc0e2e1f70837', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 256/32 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations1200: function () { Y.Assert.areEqual('5c08eb61fdf71e4e4ec3cf6ba1f5512ba7e52ddbc5e5142f708a31e2e62b1e13', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 256/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations2: function () { Y.Assert.areEqual('01dbee7f4a9e243e988b62c73cda935da05378b93244ec8f48a99e61ad799d86', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 256/32, iterations: 2 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128Iterations5: function () { Y.Assert.areEqual('d1daa78615f287e6a1c8b120d7062a49', C.PBKDF2('password', C.enc.Hex.parse('1234567878563412'), { keySize: 128/32, iterations: 5 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128Iterations50: function () { Y.Assert.areEqual('6b9cf26d45455a43a5b8bb276a403b39', C.PBKDF2(C.enc.Hex.parse('f09d849e'), 'EXAMPLE.COMpianist', { keySize: 128/32, iterations: 50 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128Iterations1200PassPhraseExceedsBlockSize: function () { Y.Assert.areEqual('9ccad6d468770cd51b10e6a68721be61', C.PBKDF2('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'pass phrase exceeds block size', { keySize: 128/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations5: function () { Y.Assert.areEqual('d1daa78615f287e6a1c8b120d7062a493f98d203e6be49a6adf4fa574b6e64ee', C.PBKDF2('password', C.enc.Hex.parse('1234567878563412'), { keySize: 256/32, iterations: 5 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128: function () { Y.Assert.areEqual('cdedb5281bb2f801565a1122b2563515', C.PBKDF2('password', 'ATHENA.MIT.EDUraeburn', { keySize: 128/32 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations1200PassPhraseExceedsBlockSize: function () { Y.Assert.areEqual('9ccad6d468770cd51b10e6a68721be611a8b4d282601db3b36be9246915ec82a', C.PBKDF2('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'pass phrase exceeds block size', { keySize: 256/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize256Iterations1200PassPhraseEqualsBlockSize: function () { Y.Assert.areEqual('139c30c0966bc32ba55fdbf212530ac9c5ec59f1a452f5cc9ad940fea0598ed1', C.PBKDF2('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'pass phrase equals block size', { keySize: 256/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
testKeySize128Iterations1200PassPhraseEqualsBlockSize: function () { Y.Assert.areEqual('139c30c0966bc32ba55fdbf212530ac9', C.PBKDF2('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'pass phrase equals block size', { keySize: 128/32, iterations: 1200 }).toString()); },
0
JavaScript
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The product uses a broken or risky cryptographic algorithm or protocol.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
function checkValue(b, q) { if (b.cmpn(0) <= 0) { throw new Error('invalid sig'); } if (b.cmp(q) >= q) { throw new Error('invalid sig'); } }
0
JavaScript
CWE-347
Improper Verification of Cryptographic Signature
The product does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
function onKEXPayload(state, payload) { // XXX: move this to the Decipher implementations? if (payload.length === 0) { this._debug && this._debug('Inbound: Skipping empty packet payload'); return; } if (this._skipNextInboundPacket) { this._skipNextInboundPacket = false; return; } payload = this._packetRW.read.read(payload); const type = payload[0]; switch (type) { case MESSAGE.DISCONNECT: case MESSAGE.IGNORE: case MESSAGE.UNIMPLEMENTED: case MESSAGE.DEBUG: if (!MESSAGE_HANDLERS) MESSAGE_HANDLERS = require('./handlers.js'); return MESSAGE_HANDLERS[type](this, payload); case MESSAGE.KEXINIT: if (!state.firstPacket) { return doFatalError( this, 'Received extra KEXINIT during handshake', 'handshake', DISCONNECT_REASON.KEY_EXCHANGE_FAILED ); } state.firstPacket = false; return handleKexInit(this, payload); default: if (type < 20 || type > 49) { return doFatalError( this, `Received unexpected packet type ${type}`, 'handshake', DISCONNECT_REASON.KEY_EXCHANGE_FAILED ); } } return this._kex.parse(payload); }
0
JavaScript
CWE-354
Improper Validation of Integrity Check Value
The product does not validate or incorrectly validates the integrity check values or "checksums" of a message. This may prevent it from detecting if the data has been modified or corrupted in transmission.
https://cwe.mitre.org/data/definitions/354.html
vulnerable
function inviteEndpoints(app) { if (!app) return; app.get("/invite/:code", async (request, response) => { try { const { code } = request.params; const invite = await Invite.get(`code = '${code}'`); if (!invite) { response.status(200).json({ invite: null, error: "Invite not found." }); return; } if (invite.status !== "pending") { response .status(200) .json({ invite: null, error: "Invite is no longer valid." }); return; } response .status(200) .json({ invite: { code, status: invite.status }, error: null }); } catch (e) { console.error(e); response.sendStatus(500).end(); } }); app.post("/invite/:code", async (request, response) => { try { const { code } = request.params; const userParams = reqBody(request); const invite = await Invite.get(`code = '${code}'`); if (!invite || invite.status !== "pending") { response .status(200) .json({ success: false, error: "Invite not found or is invalid." }); return; } const { user, error } = await User.create(userParams); if (!user) { console.error("Accepting invite:", error); response .status(200) .json({ success: false, error: "Could not create user." }); return; } await Invite.markClaimed(invite.id, user); response.status(200).json({ success: true, error: null }); } catch (e) { console.error(e); response.sendStatus(500).end(); } }); }
0
JavaScript
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
function inviteEndpoints(app) { if (!app) return; app.get("/invite/:code", async (request, response) => { try { const { code } = request.params; const invite = await Invite.get(`code = '${code}'`); if (!invite) { response.status(200).json({ invite: null, error: "Invite not found." }); return; } if (invite.status !== "pending") { response .status(200) .json({ invite: null, error: "Invite is no longer valid." }); return; } response .status(200) .json({ invite: { code, status: invite.status }, error: null }); } catch (e) { console.error(e); response.sendStatus(500).end(); } }); app.post("/invite/:code", async (request, response) => { try { const { code } = request.params; const userParams = reqBody(request); const invite = await Invite.get(`code = '${code}'`); if (!invite || invite.status !== "pending") { response .status(200) .json({ success: false, error: "Invite not found or is invalid." }); return; } const { user, error } = await User.create(userParams); if (!user) { console.error("Accepting invite:", error); response .status(200) .json({ success: false, error: "Could not create user." }); return; } await Invite.markClaimed(invite.id, user); response.status(200).json({ success: true, error: null }); } catch (e) { console.error(e); response.sendStatus(500).end(); } }); }
0
JavaScript
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
JWTSecret: usePassword ? v4() : "", }); response.status(200).json({ success: !error, error }); } catch (e) { console.log(e.message, e); response.sendStatus(500).end(); } }
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
function updateENV(newENVs = {}) { let error = ""; const validKeys = Object.keys(KEY_MAPPING); const ENV_KEYS = Object.keys(newENVs).filter( (key) => validKeys.includes(key) && !newENVs[key].includes("******") // strip out answers where the value is all asterisks ); const newValues = {}; ENV_KEYS.forEach((key) => { const { envKey, checks } = KEY_MAPPING[key]; const value = newENVs[key]; const errors = checks .map((validityCheck) => validityCheck(value)) .filter((err) => typeof err === "string"); if (errors.length > 0) { error += errors.join("\n"); return; } newValues[key] = value; process.env[envKey] = value; }); return { newValues, error: error?.length > 0 ? error : false }; }
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
regExDate: function (str, p1, p2, offset, s) { var date = str.substring(1).replace('"', ''); if (date.substring(0, 7) == "\\\/Date(") { var d = date.match(/Date\((.*?)\)/)[1]; return "new Date(" + parseInt(d) + ")"; } else { // ISO Date 2007-12-31T23:59:59Z var matches = date.split(/[-,:,T,Z]/); if (matches.length == 7) { matches[1] = (parseInt(matches[1], 0) - 1).toString(); var isDate = true; var s = ""; for (var i = 0; i < matches.length; i++) { if (isNaN(parseInt(matches[i], 10))) { isDate = false; break; } if (i > 0) { s += ","; } s += parseInt(matches[i], 10); } if (isDate) { return "new Date(Date.UTC(" + s + "))"; } } } return str; },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
parse: function (text) { // not yet possible as we still return new type() JSON // if (!(!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( // text.replace(/"(\\.|[^"\\])*"/g, ''))) )) // throw new Error("Invalid characters in JSON parse string."); var regEx = /(\"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}.*?\")|(\"\\\/Date\(.*?\)\\\/")/g; text = text.replace(regEx, this.regExDate); return eval('(' + text + ')'); },
0
JavaScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
required: function () { return $('#company').val().length === 0 || $('#firstname').val().length > 0; }
0
JavaScript
NVD-CWE-noinfo
null
null
null
vulnerable
const updateAccount = ({ id, accountStatus, adminRoleArn }) => { if (!id) return respondWithError("Internal error while trying to update account.", "Parameter 'id' missing."); if (!accountStatus) return respondWithError("Internal error while trying to update account.", "Parameter 'accountStatus' missing."); if (!adminRoleArn) return respondWithError("Internal error while trying to update account.", "Parameter 'adminRoleArn' missing."); let ddb = new AWS.DynamoDB.DocumentClient({ region: region }); return ddb .update({ TableName: accountsTable, Key: { Id: id }, UpdateExpression: "set AccountStatus = :s, AdminRoleArn=:r", ExpressionAttributeValues: { ":s": accountStatus, ":r": adminRoleArn }, ReturnValues: "UPDATED_NEW" }) .promise() .then((response) => respondWithSuccess("DynamoDB table record for account " + id + " successfully updated.", response) ) .catch((error) => respondWithError("Error trying to update DynamoDB table record for account " + id + ".", error) ); };
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
const updateAccount = ({ id, accountStatus, adminRoleArn }) => { if (!id) return respondWithError("Internal error while trying to update account.", "Parameter 'id' missing."); if (!accountStatus) return respondWithError("Internal error while trying to update account.", "Parameter 'accountStatus' missing."); if (!adminRoleArn) return respondWithError("Internal error while trying to update account.", "Parameter 'adminRoleArn' missing."); let ddb = new AWS.DynamoDB.DocumentClient({ region: region }); return ddb .update({ TableName: accountsTable, Key: { Id: id }, UpdateExpression: "set AccountStatus = :s, AdminRoleArn=:r", ExpressionAttributeValues: { ":s": accountStatus, ":r": adminRoleArn }, ReturnValues: "UPDATED_NEW" }) .promise() .then((response) => respondWithSuccess("DynamoDB table record for account " + id + " successfully updated.", response) ) .catch((error) => respondWithError("Error trying to update DynamoDB table record for account " + id + ".", error) ); };
0
JavaScript
CWE-269
Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
vulnerable
exports.handler = async ({ arguments: args }, context) => { if (!args) return respondWithError("Internal error while trying to execute account task.", "Event arguments missing."); if (!args.action) return respondWithError("Internal error while trying to execute account task.", "Parameter 'action' missing."); let params; if (args.paramJson) { try { params = JSON.parse(args.paramJson); } catch (e) { return respondWithError("'paramJson' contains malformed JSON string."); } } try { switch (args.action) { case "listAccounts": return listAccounts(context); case "updateAccount": return updateAccount(params); case "registerAccount": return registerAccount(params); case "removeAccount": return removeAccount(params); default: throw new Error("unknown API action '" + args.action + "'"); } } catch (error) { return respondWithError("Internal error while trying to execute account task.", error); } };
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
exports.handler = async ({ arguments: args }, context) => { if (!args) return respondWithError("Internal error while trying to execute account task.", "Event arguments missing."); if (!args.action) return respondWithError("Internal error while trying to execute account task.", "Parameter 'action' missing."); let params; if (args.paramJson) { try { params = JSON.parse(args.paramJson); } catch (e) { return respondWithError("'paramJson' contains malformed JSON string."); } } try { switch (args.action) { case "listAccounts": return listAccounts(context); case "updateAccount": return updateAccount(params); case "registerAccount": return registerAccount(params); case "removeAccount": return removeAccount(params); default: throw new Error("unknown API action '" + args.action + "'"); } } catch (error) { return respondWithError("Internal error while trying to execute account task.", error); } };
0
JavaScript
CWE-269
Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
vulnerable
const deleteLease = ({ accountId, principalId, user }) => { if (!principalId) return respondWithError("Internal error while trying to delete lease.", "Parameter 'principalId' missing."); if (!accountId) return respondWithError("Internal error while trying to delete lease.", "Parameter 'accountId' missing."); if (!user) return respondWithError("Internal error while trying to delete lease.", "Parameter 'user' missing."); const ddb = new AWS.DynamoDB.DocumentClient({ region: region }); return ddb .delete({ TableName: leasesTable, Key: { AccountId: accountId, PrincipalId: principalId } }) .promise() .then((response) => respondWithSuccess("Lease for " + user + " successfully deleted.", response)) .catch((error) => respondWithError("Error trying to delete lease for " + user + ".", error)); };
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
const deleteLease = ({ accountId, principalId, user }) => { if (!principalId) return respondWithError("Internal error while trying to delete lease.", "Parameter 'principalId' missing."); if (!accountId) return respondWithError("Internal error while trying to delete lease.", "Parameter 'accountId' missing."); if (!user) return respondWithError("Internal error while trying to delete lease.", "Parameter 'user' missing."); const ddb = new AWS.DynamoDB.DocumentClient({ region: region }); return ddb .delete({ TableName: leasesTable, Key: { AccountId: accountId, PrincipalId: principalId } }) .promise() .then((response) => respondWithSuccess("Lease for " + user + " successfully deleted.", response)) .catch((error) => respondWithError("Error trying to delete lease for " + user + ".", error)); };
0
JavaScript
CWE-269
Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
vulnerable
exports.handler = async ({ arguments: args }) => { if (!args) return respondWithError("Internal error while trying to execute task.", "Event arguments missing."); if (!args.action) return respondWithError("Internal error while trying to execute task.", "Parameter 'action' missing."); let params; if (args.paramJson) { try { params = JSON.parse(args.paramJson); } catch (e) { return respondWithError("'paramJson' contains malformed JSON string."); } } try { switch (args.action) { case "listLeases": return listLeases(); case "updateLease": return updateLease(params); case "createLease": return createLease(params); case "terminateLease": return terminateLease(params); case "deleteLease": return deleteLease(params); case "getStatistics": return getStatistics(); case "listUsage": return listUsage(); default: throw new Error("unknown API action '" + args.action + "'"); } } catch (error) { return respondWithError("Internal error while trying to execute task.", error); } };
0
JavaScript
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
exports.handler = async ({ arguments: args }) => { if (!args) return respondWithError("Internal error while trying to execute task.", "Event arguments missing."); if (!args.action) return respondWithError("Internal error while trying to execute task.", "Parameter 'action' missing."); let params; if (args.paramJson) { try { params = JSON.parse(args.paramJson); } catch (e) { return respondWithError("'paramJson' contains malformed JSON string."); } } try { switch (args.action) { case "listLeases": return listLeases(); case "updateLease": return updateLease(params); case "createLease": return createLease(params); case "terminateLease": return terminateLease(params); case "deleteLease": return deleteLease(params); case "getStatistics": return getStatistics(); case "listUsage": return listUsage(); default: throw new Error("unknown API action '" + args.action + "'"); } } catch (error) { return respondWithError("Internal error while trying to execute task.", error); } };
0
JavaScript
CWE-269
Improper Privilege Management
The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
vulnerable
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`) core.info('All Done!') core.endGroup() if (inputs.recoverDeletedFiles) { let recoverPatterns = getRecoverFilePatterns({inputs}) if (recoverPatterns.length > 0 && filePatterns.length > 0) { core.info('No recover patterns found; defaulting to file patterns') recoverPatterns = filePatterns } await recoverDeletedFiles({ inputs, workingDirectory, deletedFiles: allDiffFiles[ChangeTypeEnum.Deleted], recoverPatterns, diffResult, hasSubmodule, submodulePaths }) } await processChangedFiles({ filePatterns, allDiffFiles, inputs, yamlFilePatterns, workingDirectory }) if (inputs.includeAllOldNewRenamedFiles) { core.startGroup('changed-files-all-old-new-renamed-files') const allOldNewRenamedFiles = await getRenamedFiles({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) core.debug(`All old new renamed files: ${allOldNewRenamedFiles}`) await setOutput({ key: 'all_old_new_renamed_files', value: allOldNewRenamedFiles.paths, writeOutputFiles: inputs.writeOutputFiles, outputDir: inputs.outputDir, json: inputs.json }) await setOutput({ key: 'all_old_new_renamed_files_count', value: allOldNewRenamedFiles.count, writeOutputFiles: inputs.writeOutputFiles, outputDir: inputs.outputDir, json: inputs.json }) core.info('All Done!') core.endGroup() } }
0
JavaScript
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
async getPodcastFeed(req, res) { if (!req.user.isAdminOrUp) { Logger.error(`[PodcastController] Non-admin user "${req.user.username}" attempted to get podcast feed`) return res.sendStatus(403) } var url = req.body.rssFeed if (!url) { return res.status(400).send('Bad request') } const podcast = await getPodcastFeed(url) if (!podcast) { return res.status(404).send('Podcast RSS feed request failed or invalid response data') } res.json({ podcast }) }
0
JavaScript
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
vulnerable