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
RENDERER_DEFAULT.link = (href, _, text) => { if (href && href.startsWith('mailto')) { return text; } else { return `<a href="${href}" target="_blank", rel="noopener">${text} <i class="icon-external-link"></i></a>`; } };
0
TypeScript
CWE-167
Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.
https://cwe.mitre.org/data/definitions/167.html
vulnerable
inlinerRenderer.paragraph = (text) => { return text; };
0
TypeScript
CWE-167
Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.
https://cwe.mitre.org/data/definitions/167.html
vulnerable
renderer.link = (href, _, text) => { if (href && href.startsWith('mailto')) { return text; } else { return `<a href="${href}" target="_blank", rel="noopener">${text} <i class="icon-external-link"></i></a>`; } };
0
TypeScript
CWE-167
Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.
https://cwe.mitre.org/data/definitions/167.html
vulnerable
const userName = (userId: string) => { const parts = userId.split(':'); if (parts.length === 1) { return users.getUser(parts[0], null).pipe(map(u => u.displayName)); } else if (parts[0] === 'subject') { return users.getUser(parts[1], null).pipe(map(u => u.displayName)); } else if (parts[1].endsWith('client')) { return of(parts[1]); } else { return of(`${parts[1]}-client`); } };
0
TypeScript
CWE-167
Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.
https://cwe.mitre.org/data/definitions/167.html
vulnerable
export function formatHistoryMessage(message: string, users: UsersProviderService): Observable<string> { const userName = (userId: string) => { const parts = userId.split(':'); if (parts.length === 1) { return users.getUser(parts[0], null).pipe(map(u => u.displayName)); } else if (parts[0] === 'subject') { return users.getUser(parts[1], null).pipe(map(u => u.displayName)); } else if (parts[1].endsWith('client')) { return of(parts[1]); } else { return of(`${parts[1]}-client`); } }; let foundUserId: string | null = null; message = message.replace(/{([^\s:]*):([^}]*)}/, (match: string, type: string, id: string) => { if (type === 'user') { foundUserId = id; return REPLACEMENT_TEMP; } else { return id; } }); message = message.replace(/{([^}]*)}/g, (match: string, marker: string) => { return `<span class="marker-ref">${marker}</span>`; }); if (foundUserId) { return userName(foundUserId).pipe(map(t => message.replace(REPLACEMENT_TEMP, `<span class="user-ref">${t}</span>`))); } return of(message); }
0
TypeScript
CWE-167
Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.
https://cwe.mitre.org/data/definitions/167.html
vulnerable
export function getCellWidth(field: TableField, sizes: FieldSizes | undefined | null) { const size = sizes?.[field.name] || 0; if (size > 0) { return size; } switch (field) { case META_FIELDS.id: return 280; case META_FIELDS.created: return 150; case META_FIELDS.createdByAvatar: return 55; case META_FIELDS.createdByName: return 150; case META_FIELDS.lastModified: return 150; case META_FIELDS.lastModifiedByAvatar: return 55; case META_FIELDS.lastModifiedByName: return 150; case META_FIELDS.status: return 200; case META_FIELDS.statusNext: return 240; case META_FIELDS.statusColor: return 50; case META_FIELDS.version: return 80; default: return 200; } }
0
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) { const u = new URL(url, 'http://localhost') if (u.search) { throw new Error('Payload URL cannot contain search params: ' + url) } if (u.host !== 'localhost') { throw new Error('Payload URL cannot contain host: ' + url) } const hash = opts.hash || (opts.fresh ? Date.now() : '') return joinURL(useRuntimeConfig().app.baseURL, u.pathname, hash ? `_payload.${hash}.js` : '_payload.js') }
0
TypeScript
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
export async function sendScanResults( payloads: ScanResultsPayload[], ): Promise<boolean> { for (const payload of payloads) { // Intentionally removing scan results as they would be too big to log const payloadWithoutScanResults = { ...payload, scanResults: undefined }; try { const request: KubernetesUpstreamRequest = { method: 'post', url: `${upstreamUrl}/api/v1/scan-results`, payload, }; const { response, attempt } = await reqQueue.push(request); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } else { logger.info( { payload: payloadWithoutScanResults, attempt }, 'scan results sent upstream successfully', ); } } catch (error) { logger.error( { error, payload: payloadWithoutScanResults }, 'could not send the scan results upstream', ); return false; } } return true; }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function sendDepGraph( ...payloads: IDependencyGraphPayload[] ): Promise<void> { for (const payload of payloads) { // Intentionally removing dependencyGraph as it would be too big to log // eslint-disable-next-line @typescript-eslint/no-unused-vars const { dependencyGraph, ...payloadWithoutDepGraph } = payload; try { const request: KubernetesUpstreamRequest = { method: 'post', url: `${upstreamUrl}/api/v1/dependency-graph`, payload, }; const { response, attempt } = await reqQueue.push(request); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } else { logger.info( { payload: payloadWithoutDepGraph, attempt }, 'dependency graph sent upstream successfully', ); } } catch (error) { logger.error( { error, payload: payloadWithoutDepGraph }, 'could not send the dependency scan result upstream', ); } } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function sendWorkloadMetadata( payload: IWorkloadMetadataPayload, ): Promise<void> { try { logger.info( { workloadLocator: payload.workloadLocator }, 'attempting to send workload metadata upstream', ); const request: KubernetesUpstreamRequest = { method: 'post', url: `${upstreamUrl}/api/v1/workload`, payload, }; const { response, attempt } = await reqQueue.push(request); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } else { logger.info( { workloadLocator: payload.workloadLocator, attempt }, 'workload metadata sent upstream successfully', ); } } catch (error) { logger.error( { error, workloadLocator: payload.workloadLocator }, 'could not send workload metadata upstream', ); } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function deleteWorkload( payload: IDeleteWorkloadPayload, ): Promise<void> { try { const { workloadLocator, agentId } = payload; const { userLocator, cluster, namespace, type, name } = workloadLocator; const query = `userLocator=${userLocator}&cluster=${cluster}&namespace=${namespace}&type=${type}&name=${name}&agentId=${agentId}`; const request: KubernetesUpstreamRequest = { method: 'delete', url: `${upstreamUrl}/api/v1/workload?${query}`, payload, }; const { response, attempt } = await reqQueue.push(request); // TODO: Remove this check, the upstream no longer returns 404 in such cases if (response.statusCode === 404) { logger.info( { payload }, 'attempted to delete a workload the Upstream service could not find', ); return; } if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } else { logger.info( { workloadLocator: payload.workloadLocator, attempt }, 'workload deleted successfully', ); } } catch (error) { logger.error( { error, payload }, 'could not send delete a workload from the upstream', ); } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function sendRuntimeData( payload: IRuntimeDataPayload, ): Promise<void> { const logContext = { userLocator: payload.target.userLocator, cluster: payload.target.cluster, agentId: payload.target.agentId, identity: payload.identity, }; try { logger.info(logContext, 'attempting to send runtime data'); const request: KubernetesUpstreamRequest = { method: 'post', url: `${upstreamUrl}/api/v1/runtime-results`, payload, }; const { response, attempt } = await reqQueue.push(request); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } logger.info( { attempt, ...logContext, }, 'runtime data sent upstream successfully', ); } catch (error) { logger.error( { error, ...logContext, }, 'could not send runtime data', ); } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function sendClusterMetadata(): Promise<void> { const payload: IClusterMetadataPayload = { userLocator: config.INTEGRATION_ID, cluster: config.CLUSTER_NAME, agentId: config.AGENT_ID, version: config.MONITOR_VERSION, namespace: config.NAMESPACE, }; try { logger.info( { userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, }, 'attempting to send cluster metadata', ); const request: KubernetesUpstreamRequest = { method: 'post', url: `${upstreamUrl}/api/v1/cluster`, payload, }; const { response, attempt } = await reqQueue.push(request); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } logger.info( { userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, attempt, }, 'cluster metadata sent upstream successfully', ); } catch (error) { logger.error( { error, userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, }, 'could not send cluster metadata', ); } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export async function sendWorkloadEventsPolicy( payload: IWorkloadEventsPolicyPayload, ): Promise<void> { try { logger.info( { userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, }, 'attempting to send workload auto-import policy', ); const { response, attempt } = await retryRequest( 'post', `${upstreamUrl}/api/v1/policy`, payload, ); if (!isSuccessStatusCode(response.statusCode)) { throw new Error(`${response.statusCode} ${response.statusMessage}`); } logger.info( { userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, attempt, }, 'workload auto-import policy sent upstream successfully', ); } catch (error) { logger.error( { error, userLocator: payload.userLocator, cluster: payload.cluster, agentId: payload.agentId, }, 'could not send workload auto-import policy', ); } }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
async function deployKubernetesMonitor( imageOptions: IImageOptions, deployOptions: IDeployOptions, ): Promise<void> { if (!existsSync(helmPath)) { await downloadHelm(); } await kubectl.applyK8sYaml('test/fixtures/proxying/tinyproxy-service.yaml'); await kubectl.applyK8sYaml( 'test/fixtures/proxying/tinyproxy-deployment.yaml', ); await kubectl.waitForDeployment('forwarding-proxy', 'snyk-monitor'); const imageNameAndTag = imageOptions.nameAndTag.split(':'); const imageName = imageNameAndTag[0]; const imageTag = imageNameAndTag[1]; const imagePullPolicy = imageOptions.pullPolicy; await exec( `${helmPath} upgrade --install snyk-monitor ${helmChartPath} --namespace snyk-monitor ` + `--set image.repository=${imageName} ` + `--set image.tag=${imageTag} ` + `--set image.pullPolicy=${imagePullPolicy} ` + '--set integrationApi=https://kubernetes-upstream.dev.snyk.io ' + `--set clusterName=${deployOptions.clusterName} ` + '--set https_proxy=http://forwarding-proxy:8080', ); console.log( `Deployed ${imageOptions.nameAndTag} with pull policy ${imageOptions.pullPolicy}`, ); }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
async function deployKubernetesMonitor( imageOptions: IImageOptions, deployOptions: IDeployOptions, ): Promise<void> { if (!existsSync(helmPath)) { await downloadHelm(); } const imageNameAndTag = imageOptions.nameAndTag.split(':'); const imageName = imageNameAndTag[0]; const imageTag = imageNameAndTag[1]; const imagePullPolicy = imageOptions.pullPolicy; await exec( `${helmPath} upgrade --install snyk-monitor ${helmChartPath} --namespace snyk-monitor ` + `--set image.repository=${imageName} ` + `--set image.tag=${imageTag} ` + `--set image.pullPolicy=${imagePullPolicy} ` + '--set integrationApi=https://kubernetes-upstream.dev.snyk.io ' + `--set clusterName=${deployOptions.clusterName} ` + '--set nodeSelector."kubernetes\\.io/os"=linux ' + '--set pvc.enabled=true ' + '--set pvc.create=true ' + '--set log_level="INFO" ' + '--set rbac.serviceAccount.annotations."foo"="bar" ' + '--set volumes.projected.serviceAccountToken=true ' + '--set securityContext.fsGroup=65534 ' + '--set skopeo.compression.level=1 ' + '--set workers.count=5 ' + '--set sysdig.enabled=true ', ); console.log( `Deployed ${imageOptions.nameAndTag} with pull policy ${imageOptions.pullPolicy}`, ); }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
function createTestYamlDeployment( newYamlPath: string, imageNameAndTag: string, imagePullPolicy: string, clusterName: string, ): void { console.log('Creating YAML snyk-monitor deployment...'); const originalDeploymentYaml = readFileSync( './snyk-monitor-deployment.yaml', 'utf8', ); const deployment = parse(originalDeploymentYaml); const container = deployment.spec.template.spec.containers.find( (container) => container.name === 'snyk-monitor', ); container.image = imageNameAndTag; container.imagePullPolicy = imagePullPolicy; // Inject the baseUrl of kubernetes-upstream that snyk-monitor container use to send metadata const envVar = container.env.find( (env) => env.name === 'SNYK_INTEGRATION_API', ); envVar.value = 'https://kubernetes-upstream.dev.snyk.io'; delete envVar.valueFrom; if (clusterName) { const clusterNameEnvVar = container.env.find( (env) => env.name === 'SNYK_CLUSTER_NAME', ); clusterNameEnvVar.value = clusterName; delete clusterNameEnvVar.valueFrom; } writeFileSync(newYamlPath, stringify(deployment)); console.log('Created YAML snyk-monitor deployment'); }
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
export const createBubbleIcon = ({ className, path, target }) => { let bubbleClassName = `${className} woot-elements--${window.$chatwoot.position}`; const bubbleIcon = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' ); bubbleIcon.setAttributeNS(null, 'id', 'woot-widget-bubble-icon'); bubbleIcon.setAttributeNS(null, 'width', '24'); bubbleIcon.setAttributeNS(null, 'height', '24'); bubbleIcon.setAttributeNS(null, 'viewBox', '0 0 240 240'); bubbleIcon.setAttributeNS(null, 'fill', 'none'); bubbleIcon.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); const bubblePath = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); bubblePath.setAttributeNS(null, 'd', path); bubblePath.setAttributeNS(null, 'fill', '#FFFFFF'); bubbleIcon.appendChild(bubblePath); target.appendChild(bubbleIcon); if (isExpandedView(window.$chatwoot.type)) { const textNode = document.createElement('div'); textNode.id = 'woot-widget--expanded__text'; textNode.innerHTML = ''; target.appendChild(textNode); bubbleClassName += ' woot-widget--expanded'; } target.className = bubbleClassName; target.title = 'Open chat window'; return target; };
0
TypeScript
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
export const setBubbleText = bubbleText => { if (isExpandedView(window.$chatwoot.type)) { const textNode = document.getElementById('woot-widget--expanded__text'); textNode.innerHTML = bubbleText; } };
0
TypeScript
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
export function defaultRenderTag(tag, params) { // This file is in lib but it's used as a helper let siteSettings = helperContext().siteSettings; params = params || {}; const visibleName = escapeExpression(tag); tag = visibleName.toLowerCase(); const classes = ["discourse-tag"]; const tagName = params.tagName || "a"; let path; if (tagName === "a" && !params.noHref) { if ((params.isPrivateMessage || params.pmOnly) && User.current()) { const username = params.tagsForUser ? params.tagsForUser : User.current().username; path = `/u/${username}/messages/tags/${tag}`; } else { path = `/tag/${tag}`; } } const href = path ? ` href='${getURL(path)}' ` : ""; if (siteSettings.tag_style || params.style) { classes.push(params.style || siteSettings.tag_style); } if (params.size) { classes.push(params.size); } let val = "<" + tagName + href + " data-tag-name=" + tag + (params.description ? ' title="' + params.description + '" ' : "") + " class='" + classes.join(" ") + "'>" + visibleName + "</" + tagName + ">"; if (params.count) { val += " <span class='discourse-tag-count'>x" + params.count + "</span>"; } return val; }
0
TypeScript
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
_saveDraft(channelId, draft) { const data = { chat_channel_id: channelId }; if (draft) { data.data = JSON.stringify(draft); } ajax("/chat/drafts", { type: "POST", data, ignoreUnsent: false }) .then(() => { this.markNetworkAsReliable(); }) .catch((error) => { if (!error.jqXHR?.responseJSON?.errors?.length) { this.markNetworkAsUnreliable(); } }); }
0
TypeScript
CWE-770
Allocation of Resources Without Limits or Throttling
The product 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
totalCount(count, pmCount) { return count + pmCount; },
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
pmOnly(count, pmCount) { return count === 0 && pmCount > 0; },
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
Auth.prototype.getRolesForUser = async function () { //Stack all Parse.Role const results = []; if (this.config) { const restWhere = { users: { __type: 'Pointer', className: '_User', objectId: this.user.id, }, }; const RestQuery = require('./RestQuery'); await new RestQuery(this.config, master(this.config), '_Role', restWhere, {}).each(result => results.push(result) ); } else { await new Parse.Query(Parse.Role) .equalTo('users', this.user) .each(result => results.push(result.toJSON()), { useMasterKey: true }); } return results; };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
var getAuthForLegacySessionToken = function ({ config, sessionToken, installationId }) { var restOptions = { limit: 1, }; const RestQuery = require('./RestQuery'); var query = new RestQuery(config, master(config), '_User', { sessionToken }, restOptions); return query.execute().then(response => { var results = response.results; if (results.length !== 1) { throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'invalid legacy session token'); } const obj = results[0]; obj.className = '_User'; const userObject = Parse.Object.fromJSON(obj); return new Auth({ config, isMaster: false, installationId, user: userObject, }); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
const getAuthForSessionToken = async function ({ config, cacheController, sessionToken, installationId, }) { cacheController = cacheController || (config && config.cacheController); if (cacheController) { const userJSON = await cacheController.user.get(sessionToken); if (userJSON) { const cachedUser = Parse.Object.fromJSON(userJSON); return Promise.resolve( new Auth({ config, cacheController, isMaster: false, installationId, user: cachedUser, }) ); } } let results; if (config) { const restOptions = { limit: 1, include: 'user', }; const RestQuery = require('./RestQuery'); const query = new RestQuery(config, master(config), '_Session', { sessionToken }, restOptions); results = (await query.execute()).results; } else { results = ( await new Parse.Query(Parse.Session) .limit(1) .include('user') .equalTo('sessionToken', sessionToken) .find({ useMasterKey: true }) ).map(obj => obj.toJSON()); } if (results.length !== 1 || !results[0]['user']) { throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Invalid session token'); } const now = new Date(), expiresAt = results[0].expiresAt ? new Date(results[0].expiresAt.iso) : undefined; if (expiresAt < now) { throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Session token is expired.'); } const obj = results[0]['user']; delete obj.password; obj['className'] = '_User'; obj['sessionToken'] = sessionToken; if (cacheController) { cacheController.user.put(sessionToken, obj); } const userObject = Parse.Object.fromJSON(obj); return new Auth({ config, cacheController, isMaster: false, installationId, user: userObject, }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
Auth.prototype.getRolesByIds = async function (ins) { const results = []; // Build an OR query across all parentRoles if (!this.config) { await new Parse.Query(Parse.Role) .containedIn( 'roles', ins.map(id => { const role = new Parse.Object(Parse.Role); role.id = id; return role; }) ) .each(result => results.push(result.toJSON()), { useMasterKey: true }); } else { const roles = ins.map(id => { return { __type: 'Pointer', className: '_Role', objectId: id, }; }); const restWhere = { roles: { $in: roles } }; const RestQuery = require('./RestQuery'); await new RestQuery(this.config, master(this.config), '_Role', restWhere, {}).each(result => results.push(result) ); } return results; };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
badgeUpdate = () => { // Build a real RestQuery so we can use it in RestWrite const restQuery = new RestQuery(config, master(config), '_Installation', updateWhere); return restQuery.buildRestWhere().then(() => { const write = new RestWrite( config, master(config), '_Installation', restQuery.restWhere, restUpdate ); write.runOptions.many = true; return write.execute(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.getUserAndRoleACL = function () { if (this.auth.isMaster) { return Promise.resolve(); } this.findOptions.acl = ['*']; if (this.auth.user) { return this.auth.getUserRoles().then(roles => { this.findOptions.acl = this.findOptions.acl.concat(roles, [this.auth.user.id]); return; }); } else { return Promise.resolve(); } };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.denyProtectedFields = async function () { if (this.auth.isMaster) { return; } const schemaController = await this.config.database.loadSchema(); const protectedFields = this.config.database.addProtectedFields( schemaController, this.className, this.restWhere, this.findOptions.acl, this.auth, this.findOptions ) || []; for (const key of protectedFields) { if (this.restWhere[key]) { throw new Parse.Error( Parse.Error.OPERATION_FORBIDDEN, `This user is not allowed to query ${key} on class ${this.className}` ); } } };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.handleAuthAdapters = async function () { if (this.className !== '_User' || this.findOptions.explain) { return; } await Promise.all( this.response.results.map(result => this.config.authDataManager.runAfterFind( { config: this.config, auth: this.auth }, result.authData ) ) ); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.replaceDontSelect = function () { var dontSelectObject = findObjectWithKey(this.restWhere, '$dontSelect'); if (!dontSelectObject) { return; } // The dontSelect value must have precisely two keys - query and key var dontSelectValue = dontSelectObject['$dontSelect']; if ( !dontSelectValue.query || !dontSelectValue.key || typeof dontSelectValue.query !== 'object' || !dontSelectValue.query.className || Object.keys(dontSelectValue).length !== 2 ) { throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $dontSelect'); } const additionalOptions = { redirectClassNameForKey: dontSelectValue.query.redirectClassNameForKey, }; if (this.restOptions.subqueryReadPreference) { additionalOptions.readPreference = this.restOptions.subqueryReadPreference; additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference; } else if (this.restOptions.readPreference) { additionalOptions.readPreference = this.restOptions.readPreference; } var subquery = new RestQuery( this.config, this.auth, dontSelectValue.query.className, dontSelectValue.query.where, additionalOptions ); return subquery.execute().then(response => { transformDontSelect(dontSelectObject, dontSelectValue.key, response.results); // Keep replacing $dontSelect clauses return this.replaceDontSelect(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.runCount = function () { if (!this.doCount) { return; } this.findOptions.count = true; delete this.findOptions.skip; delete this.findOptions.limit; return this.config.database.find(this.className, this.restWhere, this.findOptions).then(c => { this.response.count = c; }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.handleIncludeAll = function () { if (!this.includeAll) { return; } return this.config.database .loadSchema() .then(schemaController => schemaController.getOneSchema(this.className)) .then(schema => { const includeFields = []; const keyFields = []; for (const field in schema.fields) { if ( (schema.fields[field].type && schema.fields[field].type === 'Pointer') || (schema.fields[field].type && schema.fields[field].type === 'Array') ) { includeFields.push([field]); keyFields.push(field); } } // Add fields to include, keys, remove dups this.include = [...new Set([...this.include, ...includeFields])]; // if this.keys not set, then all keys are already included if (this.keys) { this.keys = [...new Set([...this.keys, ...keyFields])]; } }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.redirectClassNameForKey = function () { if (!this.redirectKey) { return Promise.resolve(); } // We need to change the class name based on the schema return this.config.database .redirectClassNameForKey(this.className, this.redirectKey) .then(newClassName => { this.className = newClassName; this.redirectClassName = newClassName; }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.replaceSelect = function () { var selectObject = findObjectWithKey(this.restWhere, '$select'); if (!selectObject) { return; } // The select value must have precisely two keys - query and key var selectValue = selectObject['$select']; // iOS SDK don't send where if not set, let it pass if ( !selectValue.query || !selectValue.key || typeof selectValue.query !== 'object' || !selectValue.query.className || Object.keys(selectValue).length !== 2 ) { throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $select'); } const additionalOptions = { redirectClassNameForKey: selectValue.query.redirectClassNameForKey, }; if (this.restOptions.subqueryReadPreference) { additionalOptions.readPreference = this.restOptions.subqueryReadPreference; additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference; } else if (this.restOptions.readPreference) { additionalOptions.readPreference = this.restOptions.readPreference; } var subquery = new RestQuery( this.config, this.auth, selectValue.query.className, selectValue.query.where, additionalOptions ); return subquery.execute().then(response => { transformSelect(selectObject, selectValue.key, response.results); // Keep replacing $select clauses return this.replaceSelect(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.each = function (callback) { const { config, auth, className, restWhere, restOptions, clientSDK } = this; // if the limit is set, use it restOptions.limit = restOptions.limit || 100; restOptions.order = 'objectId'; let finished = false; return continueWhile( () => { return !finished; }, async () => { const query = new RestQuery( config, auth, className, restWhere, restOptions, clientSDK, this.runAfterFind, this.context ); const { results } = await query.execute(); results.forEach(callback); finished = results.length < restOptions.limit; if (!finished) { restWhere.objectId = Object.assign({}, restWhere.objectId, { $gt: results[results.length - 1].objectId, }); } } ); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.handleExcludeKeys = function () { if (!this.excludeKeys) { return; } if (this.keys) { this.keys = this.keys.filter(k => !this.excludeKeys.includes(k)); return; } return this.config.database .loadSchema() .then(schemaController => schemaController.getOneSchema(this.className)) .then(schema => { const fields = Object.keys(schema.fields); this.keys = fields.filter(k => !this.excludeKeys.includes(k)); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.cleanResultAuthData = function (result) { delete result.password; if (result.authData) { Object.keys(result.authData).forEach(provider => { if (result.authData[provider] === null) { delete result.authData[provider]; } }); if (Object.keys(result.authData).length == 0) { delete result.authData; } } };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.buildRestWhere = function () { return Promise.resolve() .then(() => { return this.getUserAndRoleACL(); }) .then(() => { return this.redirectClassNameForKey(); }) .then(() => { return this.validateClientClassCreation(); }) .then(() => { return this.replaceSelect(); }) .then(() => { return this.replaceDontSelect(); }) .then(() => { return this.replaceInQuery(); }) .then(() => { return this.replaceNotInQuery(); }) .then(() => { return this.replaceEquality(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.runAfterFindTrigger = function () { if (!this.response) { return; } if (!this.runAfterFind) { return; } // Avoid doing any setup for triggers if there is no 'afterFind' trigger for this class. const hasAfterFindHook = triggers.triggerExists( this.className, triggers.Types.afterFind, this.config.applicationId ); if (!hasAfterFindHook) { return Promise.resolve(); } // Skip Aggregate and Distinct Queries if (this.findOptions.pipeline || this.findOptions.distinct) { return Promise.resolve(); } const json = Object.assign({}, this.restOptions); json.where = this.restWhere; const parseQuery = new Parse.Query(this.className); parseQuery.withJSON(json); // Run afterFind trigger and set the new results return triggers .maybeRunAfterFindTrigger( triggers.Types.afterFind, this.auth, this.className, this.response.results, this.config, parseQuery, this.context ) .then(results => { // Ensure we properly set the className back if (this.redirectClassName) { this.response.results = results.map(object => { if (object instanceof Parse.Object) { object = object.toJSON(); } object.className = this.redirectClassName; return object; }); } else { this.response.results = results; } }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.handleInclude = function () { if (this.include.length == 0) { return; } var pathResponse = includePath( this.config, this.auth, this.response, this.include[0], this.restOptions ); if (pathResponse.then) { return pathResponse.then(newResponse => { this.response = newResponse; this.include = this.include.slice(1); return this.handleInclude(); }); } else if (this.include.length > 0) { this.include = this.include.slice(1); return this.handleInclude(); } return pathResponse; };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.replaceInQuery = function () { var inQueryObject = findObjectWithKey(this.restWhere, '$inQuery'); if (!inQueryObject) { return; } // The inQuery value must have precisely two keys - where and className var inQueryValue = inQueryObject['$inQuery']; if (!inQueryValue.where || !inQueryValue.className) { throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $inQuery'); } const additionalOptions = { redirectClassNameForKey: inQueryValue.redirectClassNameForKey, }; if (this.restOptions.subqueryReadPreference) { additionalOptions.readPreference = this.restOptions.subqueryReadPreference; additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference; } else if (this.restOptions.readPreference) { additionalOptions.readPreference = this.restOptions.readPreference; } var subquery = new RestQuery( this.config, this.auth, inQueryValue.className, inQueryValue.where, additionalOptions ); return subquery.execute().then(response => { transformInQuery(inQueryObject, subquery.className, response.results); // Recurse to repeat return this.replaceInQuery(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.replaceNotInQuery = function () { var notInQueryObject = findObjectWithKey(this.restWhere, '$notInQuery'); if (!notInQueryObject) { return; } // The notInQuery value must have precisely two keys - where and className var notInQueryValue = notInQueryObject['$notInQuery']; if (!notInQueryValue.where || !notInQueryValue.className) { throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $notInQuery'); } const additionalOptions = { redirectClassNameForKey: notInQueryValue.redirectClassNameForKey, }; if (this.restOptions.subqueryReadPreference) { additionalOptions.readPreference = this.restOptions.subqueryReadPreference; additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference; } else if (this.restOptions.readPreference) { additionalOptions.readPreference = this.restOptions.readPreference; } var subquery = new RestQuery( this.config, this.auth, notInQueryValue.className, notInQueryValue.where, additionalOptions ); return subquery.execute().then(response => { transformNotInQuery(notInQueryObject, subquery.className, response.results); // Recurse to repeat return this.replaceNotInQuery(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.replaceEquality = function () { if (typeof this.restWhere !== 'object') { return; } for (const key in this.restWhere) { this.restWhere[key] = replaceEqualityConstraint(this.restWhere[key]); } };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.execute = function (executeOptions) { return Promise.resolve() .then(() => { return this.buildRestWhere(); }) .then(() => { return this.denyProtectedFields(); }) .then(() => { return this.handleIncludeAll(); }) .then(() => { return this.handleExcludeKeys(); }) .then(() => { return this.runFind(executeOptions); }) .then(() => { return this.runCount(); }) .then(() => { return this.handleInclude(); }) .then(() => { return this.runAfterFindTrigger(); }) .then(() => { return this.handleAuthAdapters(); }) .then(() => { return this.response; }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.validateClientClassCreation = function () { if ( this.config.allowClientClassCreation === false && !this.auth.isMaster && SchemaController.systemClasses.indexOf(this.className) === -1 ) { return this.config.database .loadSchema() .then(schemaController => schemaController.hasClass(this.className)) .then(hasClass => { if (hasClass !== true) { throw new Parse.Error( Parse.Error.OPERATION_FORBIDDEN, 'This user is not allowed to access ' + 'non-existent class: ' + this.className ); } }); } else { return Promise.resolve(); } };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
RestQuery.prototype.runFind = function (options = {}) { if (this.findOptions.limit === 0) { this.response = { results: [] }; return Promise.resolve(); } const findOptions = Object.assign({}, this.findOptions); if (this.keys) { findOptions.keys = this.keys.map(key => { return key.split('.')[0]; }); } if (options.op) { findOptions.op = options.op; } return this.config.database .find(this.className, this.restWhere, findOptions, this.auth) .then(results => { if (this.className === '_User' && !findOptions.explain) { for (var result of results) { this.cleanResultAuthData(result); } } this.config.filesController.expandFilesInObject(this.config, results); if (this.redirectClassName) { for (var r of results) { r.className = this.redirectClassName; } } this.response = { results: results }; }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
function enforceRoleSecurity(method, className, auth) { if (className === '_Installation' && !auth.isMaster && !auth.isMaintenance) { if (method === 'delete' || method === 'find') { const error = `Clients aren't allowed to perform the ${method} operation on the installation collection.`; throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error); } } //all volatileClasses are masterKey only if ( classesWithMasterOnlyAccess.indexOf(className) >= 0 && !auth.isMaster && !auth.isMaintenance ) { const error = `Clients aren't allowed to perform the ${method} operation on the ${className} collection.`; throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error); } // readOnly masterKey is not allowed if (auth.isReadOnly && (method === 'delete' || method === 'create' || method === 'update')) { const error = `read-only masterKey isn't allowed to perform the ${method} operation.`; throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error); } }
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
function find(config, auth, className, restWhere, restOptions, clientSDK, context) { enforceRoleSecurity('find', className, auth); return triggers .maybeRunQueryTrigger( triggers.Types.beforeFind, className, restWhere, restOptions, config, auth, context ) .then(result => { restWhere = result.restWhere || restWhere; restOptions = result.restOptions || restOptions; const query = new RestQuery( config, auth, className, restWhere, restOptions, clientSDK, true, context ); return query.execute(); }); }
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
const get = (config, auth, className, objectId, restOptions, clientSDK, context) => { var restWhere = { objectId }; enforceRoleSecurity('get', className, auth); return triggers .maybeRunQueryTrigger( triggers.Types.beforeFind, className, restWhere, restOptions, config, auth, context, true ) .then(result => { restWhere = result.restWhere || restWhere; restOptions = result.restOptions || restOptions; const query = new RestQuery( config, auth, className, restWhere, restOptions, clientSDK, true, context ); return query.execute(); }); };
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
function update(config, auth, className, restWhere, restObject, clientSDK, context) { enforceRoleSecurity('update', className, auth); return Promise.resolve() .then(() => { const hasTriggers = checkTriggers(className, config, ['beforeSave', 'afterSave']); const hasLiveQuery = checkLiveQuery(className, config); if (hasTriggers || hasLiveQuery) { // Do not use find, as it runs the before finds return new RestQuery( config, auth, className, restWhere, undefined, undefined, false, context ).execute({ op: 'update', }); } return Promise.resolve({}); }) .then(({ results }) => { var originalRestObject; if (results && results.length) { originalRestObject = results[0]; } return new RestWrite( config, auth, className, restWhere, restObject, originalRestObject, clientSDK, context, 'update' ).execute(); }) .catch(error => { handleSessionMissingError(error, className, auth); }); }
0
TypeScript
CWE-670
Always-Incorrect Control Flow Implementation
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
https://cwe.mitre.org/data/definitions/670.html
vulnerable
onCreate(instance) { const content = instance.props.content + $("#narrow-hotkey-tooltip-template").html(); instance.setContent(parse_html(content)); },
0
TypeScript
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 isTextSearchable(text, search) { return text && (search || isNumber(search)); }
0
TypeScript
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 TuleapHighlightFilter() { function isTextSearchable(text, search) { return text && (search || isNumber(search)); } return function (text, search) { if (!isTextSearchable(text, search)) { return text ? text.toString() : text; } const classifier = Classifier(String(search)); const parts = classifier.classify(String(text)).map((highlighted_text) => { if (!HighlightedText.isHighlight(highlighted_text)) { return highlighted_text.content; } return `<span class="highlight">${highlighted_text.content}</span>`; }); return parts.join(""); }; }
0
TypeScript
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
export async function downloadKubectl(version: string): Promise<string> { let cachedToolpath = toolCache.find(kubectlToolName, version); let kubectlDownloadPath = ''; const arch = getKubectlArch(); if (!cachedToolpath) { try { kubectlDownloadPath = await toolCache.downloadTool(getkubectlDownloadURL(version, arch)); } catch (exception) { if (exception instanceof toolCache.HTTPError && exception.httpStatusCode === 404) { throw new Error(util.format("Kubectl '%s' for '%s' arch not found.", version, arch)); } else { throw new Error('DownloadKubectlFailed'); } } cachedToolpath = await toolCache.cacheFile(kubectlDownloadPath, kubectlToolName + getExecutableExtension(), kubectlToolName, version); } const kubectlPath = path.join(cachedToolpath, kubectlToolName + getExecutableExtension()); fs.chmodSync(kubectlPath, '777'); return kubectlPath; }
0
TypeScript
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
vulnerable
fastify.addHook('onRequest', async (request, reply) => { if (request.url === bullBoardPath || request.url.startsWith(bullBoardPath + '/')) { const token = request.cookies.token; if (token == null) { reply.code(401); throw new Error('login required'); } const user = await this.usersRepository.findOneBy({ token }); if (user == null) { reply.code(403); throw new Error('no such user'); } const isAdministrator = await this.roleService.isAdministrator(user); if (!isAdministrator) { reply.code(403); throw new Error('access denied'); } } });
0
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
super(meta, paramDef, async (ps, me) => { const user = await this.usersRepository.findOneBy({ id: ps.userId }); if (user == null) { throw new Error('user not found'); } if (user.avatarId == null) return; await this.usersRepository.update(user.id, { avatar: null, avatarId: null, avatarUrl: null, avatarBlurhash: null, }); this.moderationLogService.log(me, 'unsetUserAvatar', { userId: user.id, userUsername: user.username, userHost: user.host, fileId: user.avatarId, }); });
0
TypeScript
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
public getChannelService(name: string) { switch (name) { case 'main': return this.mainChannelService; case 'homeTimeline': return this.homeTimelineChannelService; case 'localTimeline': return this.localTimelineChannelService; case 'hybridTimeline': return this.hybridTimelineChannelService; case 'globalTimeline': return this.globalTimelineChannelService; case 'userList': return this.userListChannelService; case 'hashtag': return this.hashtagChannelService; case 'roleTimeline': return this.roleTimelineChannelService; case 'antenna': return this.antennaChannelService; case 'channel': return this.channelChannelService; case 'drive': return this.driveChannelService; case 'serverStats': return this.serverStatsChannelService; case 'queueStats': return this.queueStatsChannelService; case 'admin': return this.adminChannelService; default: throw new Error(`no such channel: ${name}`); } }
0
TypeScript
CWE-285
Improper Authorization
The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/285.html
vulnerable
export function escape(val: Escapable | Escapable[], timeZone?: string, dialect?: string, format?: string): string; export function format(sql: string, values: unknown[], timeZone?: string, dialect?: string): string;
0
TypeScript
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
export function escapeId(val: string, forbidQualified?: boolean): string; export function escape(val: Escapable | Escapable[], timeZone?: string, dialect?: string, format?: string): string;
0
TypeScript
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
getTokenFromRequest: (req) => { if (req.headers['x-csrf-token']) { return req.headers['x-csrf-token']; } else if (req.body.csrf_token) { return req.body.csrf_token; } },
0
TypeScript
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
export function splitOnFirstEquals(str: string): string[] { // we use regex instead of "=" to ensure we split at the first // "=" and return the following substring with it // important for the hashed-password which looks like this // $argon2i$v=19$m=4096,t=3,p=1$0qR/o+0t00hsbJFQCKSfdQ$oFcM4rL6o+B7oxpuA4qlXubypbBPsf+8L531U7P9HYY // 2 means return two items // Source: https://stackoverflow.com/a/4607799/3015595 // We use the ? to say the the substr after the = is optional const split = str.split(/=(.+)?/, 2) return split }
0
TypeScript
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
export const wsErrorHandler: express.ErrorRequestHandler = async (err, req, res, next) => { logger.error(`${err.message} ${err.stack}`) ;(req as WebsocketRequest).ws.end() }
0
TypeScript
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
function inspectFallback(val) { const domains = Object.keys(val); if (domains.length === 0) { return "{}"; } let result = "{\n"; Object.keys(val).forEach((domain, i) => { result += formatDomain(domain, val[domain]); if (i < domains.length - 1) { result += ","; } result += "\n"; }); result += "}"; return result; }
0
TypeScript
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
removeAllCookies(cb) { this.idx = {}; return cb(null); }
0
TypeScript
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 formatPath(pathName, pathValue) { const indent = " "; let result = `${indent}'${pathName}': {\n`; Object.keys(pathValue).forEach((cookieName, i, cookieNames) => { const cookie = pathValue[cookieName]; result += ` ${cookieName}: ${cookie.inspect()}`; if (i < cookieNames.length - 1) { result += ","; } result += "\n"; }); result += `${indent}}`; return result; }
0
TypeScript
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
putCookie(cookie, cb) { if (!this.idx[cookie.domain]) { this.idx[cookie.domain] = {}; } if (!this.idx[cookie.domain][cookie.path]) { this.idx[cookie.domain][cookie.path] = {}; } this.idx[cookie.domain][cookie.path][cookie.key] = cookie; cb(null); }
0
TypeScript
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
constructor() { super(); this.synchronous = true; this.idx = {}; const customInspectSymbol = getCustomInspectSymbol(); if (customInspectSymbol) { this[customInspectSymbol] = this.inspect; } }
0
TypeScript
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 formatDomain(domainName, domainValue) { const indent = " "; let result = `${indent}'${domainName}': {\n`; Object.keys(domainValue).forEach((path, i, paths) => { result += formatPath(path, domainValue[path]); if (i < paths.length - 1) { result += ","; } result += "\n"; }); result += `${indent}}`; return result; }
0
TypeScript
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
? element.boundElementIds.map((id) => ({ type: "arrow", id })) : element.boundElements ?? [], updated: element.updated ?? getUpdatedTimestamp(), link: element.link ?? null, locked: element.locked ?? false, };
0
TypeScript
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 sameStreams( directives1: ReadonlyArray<DirectiveNode>, directives2: ReadonlyArray<DirectiveNode>, ): boolean { const stream1 = getStreamDirective(directives1); const stream2 = getStreamDirective(directives2); if (!stream1 && !stream2) { // both fields do not have streams return true; } else if (stream1 && stream2) { // check if both fields have equivalent streams return stringifyArguments(stream1) === stringifyArguments(stream2); } // fields have a mix of stream and no stream return false; }
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The product 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
fields: args.map((argNode) => ({ kind: Kind.OBJECT_FIELD, name: argNode.name, value: argNode.value, })), };
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The product 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
setCipherKey(val) { this.cipherKey = val; return this; }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
getVersion() { return '7.3.3'; }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
function __processMessage(modules, message) { const { config, crypto } = modules; if (!config.cipherKey) return message; try { return crypto.decrypt(message); } catch (e) { return message; } }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
handleResponse: async ({ PubNubFile, config, cryptography }, res, params) => { let { body } = res.response; if (PubNubFile.supportsEncryptFile && (params.cipherKey ?? config.cipherKey)) { body = await cryptography.decrypt(params.cipherKey ?? config.cipherKey, body); } return PubNubFile.create({ data: body, name: res.response.name ?? params.name, mimeType: res.response.type, }); },
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
const preparePayload = ({ crypto, config }, payload) => { let stringifiedPayload = JSON.stringify(payload); if (config.cipherKey) { stringifiedPayload = crypto.encrypt(stringifiedPayload); stringifiedPayload = JSON.stringify(stringifiedPayload); } return stringifiedPayload || ''; };
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
function __processMessage(modules, message) { const { config, crypto } = modules; if (!config.cipherKey) return message; try { return crypto.decrypt(message); } catch (e) { return message; } }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
function prepareMessagePayload(modules, messagePayload) { const { crypto, config } = modules; let stringifiedPayload = JSON.stringify(messagePayload); if (config.cipherKey) { stringifiedPayload = crypto.encrypt(stringifiedPayload); stringifiedPayload = JSON.stringify(stringifiedPayload); } return stringifiedPayload; }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
this.encryptFile = (key, file) => cryptography.encryptFile(key, file, this.File);
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
this.decryptFile = (key, file) => cryptography.decryptFile(key, file, this.File);
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
decryptBuffer(key, ciphertext) { const bIv = ciphertext.slice(0, NodeCryptography.IV_LENGTH); const bCiphertext = ciphertext.slice(NodeCryptography.IV_LENGTH); const aes = createDecipheriv(this.algo, key, bIv); return Buffer.concat([aes.update(bCiphertext), aes.final()]); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
encryptStream(key, stream) { const output = new PassThrough(); const bIv = this.getIv(); const aes = createCipheriv(this.algo, key, bIv); output.write(bIv); stream.pipe(aes).pipe(output); return output; }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async decryptArrayBuffer(key, ciphertext) { const abIv = ciphertext.slice(0, 16); return crypto.subtle.decrypt({ name: 'AES-CBC', iv: abIv }, key, ciphertext.slice(16)); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async encryptString(key, plaintext) { const abIv = crypto.getRandomValues(new Uint8Array(16)); const abPlaintext = Buffer.from(plaintext).buffer; const abPayload = await crypto.subtle.encrypt({ name: 'AES-CBC', iv: abIv }, key, abPlaintext); const ciphertext = concatArrayBuffer(abIv.buffer, abPayload); return Buffer.from(ciphertext).toString('utf8'); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async encryptFile(key, file, File) { const bKey = await this.getKey(key); const abPlaindata = await file.toArrayBuffer(); const abCipherdata = await this.encryptArrayBuffer(bKey, abPlaindata); return File.create({ name: file.name, mimeType: 'application/octet-stream', data: abCipherdata, }); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async decrypt(key, input) { const cKey = await this.getKey(key); if (input instanceof ArrayBuffer) { return this.decryptArrayBuffer(cKey, input); } if (typeof input === 'string') { return this.decryptString(cKey, input); } throw new Error('Cannot decrypt this file. In browsers file decryption supports only string or ArrayBuffer'); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async getKey(key) { const bKey = Buffer.from(key); const abHash = await crypto.subtle.digest('SHA-256', bKey.buffer); const abKey = Buffer.from(Buffer.from(abHash).toString('hex').slice(0, 32), 'utf8').buffer; return crypto.subtle.importKey('raw', abKey, 'AES-CBC', true, ['encrypt', 'decrypt']); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async decryptFile(key, file, File) { const bKey = await this.getKey(key); const abCipherdata = await file.toArrayBuffer(); const abPlaindata = await this.decryptArrayBuffer(bKey, abCipherdata); return File.create({ name: file.name, data: abPlaindata, }); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
async decryptString(key, ciphertext) { const abCiphertext = Buffer.from(ciphertext); const abIv = abCiphertext.slice(0, 16); const abPayload = abCiphertext.slice(16); const abPlaintext = await crypto.subtle.decrypt({ name: 'AES-CBC', iv: abIv }, key, abPayload); return Buffer.from(abPlaintext).toString('utf8'); }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
constructor({ stream, data, encoding, name, mimeType }) { if (stream instanceof Readable) { this.data = stream; if (stream instanceof ReadStream) { // $FlowFixMe: incomplete flow node definitions this.name = basename(stream.path); } } else if (data instanceof Buffer) { this.data = Buffer.from(data); } else if (typeof data === 'string') { // $FlowFixMe: incomplete flow node definitions this.data = Buffer.from(data, encoding ?? 'utf8'); } if (name) { this.name = basename(name); } if (mimeType) { this.mimeType = mimeType; } if (this.data === undefined) { throw new Error("Couldn't construct a file out of supplied options."); } if (this.name === undefined) { throw new Error("Couldn't guess filename out of the options. Please provide one."); } }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
constructor(setup) { // extract config. const { listenToBrowserNetworkEvents = true } = setup; setup.sdkFamily = 'Web'; setup.networking = new Networking({ del, get, post, patch, sendBeacon, getfile, postfile, }); setup.cbor = new Cbor((arrayBuffer) => stringifyBufferKeys(CborReader.decode(arrayBuffer)), decode); setup.PubNubFile = PubNubFile; setup.cryptography = new WebCryptography(); super(setup); if (listenToBrowserNetworkEvents) { // mount network events. window.addEventListener('offline', () => { this.networkDownDetected(); }); window.addEventListener('online', () => { this.networkUpDetected(); }); } }
0
TypeScript
CWE-331
Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
https://cwe.mitre.org/data/definitions/331.html
vulnerable
function pointInPolygon(testx, testy, polygon) { let intersections = 0; for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { const [prevX, prevY] = polygon[j]; const [x, y] = polygon[i]; // count intersections if (((y > testy) != (prevY > testy)) && (testx < (prevX - x) * (testy - y) / (prevY - y) + x)) { intersections++; } } // point is in polygon if intersection count is odd return intersections & 1; }
0
TypeScript
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
export function intersectLasso(markname, pixelLasso, unit) { const { x, y, mark } = unit; const bb = new Bounds().set( Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER ); // Get bounding box around lasso for (const [px, py] of pixelLasso) { if (px < bb.x1) bb.x1 = px; if (px > bb.x2) bb.x2 = px; if (py < bb.y1) bb.y1 = py; if (py > bb.y2) bb.y2 = py; } // Translate bb against unit coordinates bb.translate(x, y); const intersection = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); // Check every point against the lasso return intersection.filter(tuple => pointInPolygon(tuple.x, tuple.y, pixelLasso)); }
0
TypeScript
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
export function lassoAppend(lasso, x, y, minDist = 5) { const last = lasso[lasso.length - 1]; // Add point to lasso if distance to last point exceed minDist or its the first point if (last === undefined || Math.sqrt(((last[0] - x) ** 2) + ((last[1] - y) ** 2)) > minDist) { lasso.push([x, y]); return [...lasso]; } return lasso; }
0
TypeScript
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
export function lassoPath(lasso) { return (lasso ?? []).reduce((svg, [x, y], i) => { return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `; }, ''); }
0
TypeScript
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
default: axiosDefault.mockResolvedValue({ status: 200, statusText: 'OK', headers: {}, data: {}, }), }));
0
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
vulnerable
function handleDataChannelChat(dataMessage) { if (!dataMessage) return; let msgFrom = dataMessage.from; let msgTo = dataMessage.to; let msg = dataMessage.msg; let msgPrivate = dataMessage.privateMsg; let msgId = dataMessage.id; // private message but not for me return if (msgPrivate && msgTo != myPeerName) return; console.log('handleDataChannelChat', dataMessage); // chat message for me also if (!isChatRoomVisible && showChatOnMessage) { showChatRoomDraggable(); chatRoomBtn.className = className.chatOff; } // show message from if (!showChatOnMessage) { userLog('toast', `New message from: ${msgFrom}`); } playSound('chatMessage'); setPeerChatAvatarImgName('left', msgFrom); appendMessage(msgFrom, leftChatAvatar, 'left', msg, msgPrivate, msgId); }
0
TypeScript
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 addMsgerPrivateBtn(msgerPrivateBtn, msgerPrivateMsgInput, peerId) { // add button to send private messages msgerPrivateBtn.addEventListener('click', (e) => { e.preventDefault(); sendPrivateMessage(); }); // Number 13 is the "Enter" key on the keyboard msgerPrivateMsgInput.addEventListener('keyup', (e) => { if (e.keyCode === 13) { e.preventDefault(); sendPrivateMessage(); } }); msgerPrivateMsgInput.onpaste = () => { isChatPasteTxt = true; }; function sendPrivateMessage() { let pMsg = checkMsg(msgerPrivateMsgInput.value.trim()); if (!pMsg) { msgerPrivateMsgInput.value = ''; isChatPasteTxt = false; return; } let toPeerName = msgerPrivateBtn.value; emitMsg(myPeerName, toPeerName, pMsg, true, peerId); appendMessage(myPeerName, rightChatAvatar, 'right', pMsg + '<hr>Private message to ' + toPeerName, true); msgerPrivateMsgInput.value = ''; msgerCP.style.display = 'none'; } }
0
TypeScript
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