code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
function makeError(msg, level, fatal) { const err = new Error(msg); if (typeof level === 'boolean') { fatal = level; err.level = 'protocol'; } else { err.level = level || 'protocol'; } err.fatal = !!fatal; return err; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function foo() { var_dump(substr_compare("\x00", "\x00\x00\x00\x00\x00\x00\x00\x00", 0, 65535, false)); }
1
TypeScript
CWE-787
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
safe
export function cleanObject(obj: any): any { return Object.entries(obj).reduce((obj, [key, value]) => { if (isProtectedKey(key)) { return obj; } return value === undefined ? obj : { ...obj, [key]: value }; }, {}); }
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
function has(target, path) { "use strict"; try { var test = reduce(target, path); if (typeof test !== "undefined") { return true; } return false; } catch (ex) { console.error(ex); return; } }
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
constructor(url, options, db, saveTemplate) { super(db, saveTemplate); if (!saveTemplate) { // enable backwards-compatibilty tweaks. this.fromHackSession = true; } const parsedUrl = Url.parse(url); this.host = parsedUrl.hostname; if (this.fromHackSession) { // HackSessionContext.getExternalUiView() apparently ignored any path on the URL. Whoops. } else { if (parsedUrl.path === "/") { // The URL parser says path = "/" for both "http://foo" and "http://foo/". We want to be // strict, though. this.path = url.endsWith("/") ? "/" : ""; } else { this.path = parsedUrl.path; } } this.port = parsedUrl.port; this.protocol = parsedUrl.protocol; this.options = options || {}; }
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
getBinaryList: (list) => { if (Buffer.isBuffer(list)) return list; if (typeof list === 'string') return (list.length === 0 ? EMPTY_BUFFER : Buffer.from(list)); if (Array.isArray(list)) return (list.length === 0 ? EMPTY_BUFFER : Buffer.from(list.join(','))); throw new Error(`Invalid list type: ${typeof list}`); },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
return (ret === false ? p : ret); } } }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
([ key, value ]) => ({ [key]: async () => (await spawn(value)).split('\n') }),
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
"input textarea.ip-blacklist"(evt) { evt.preventDefault(); evt.stopPropagation(); const instance = Template.instance(); instance.ipBlacklist.set(evt.currentTarget.value); },
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
parseOpReturnToChunks(script: Buffer, allow_op_0=false, allow_op_number=false) { // """Extract pushed bytes after opreturn. Returns list of bytes() objects, // one per push. let ops: PushDataOperation[]; // Strict refusal of non-push opcodes; bad scripts throw OpreturnError.""" try { ops = this.getScriptOperations(script); } catch(e) { //console.log(e); throw Error('Script error'); } if(ops[0].opcode !== this.BITBOX.Script.opcodes.OP_RETURN) throw Error('No OP_RETURN'); let chunks: (Buffer|null)[] = []; ops.slice(1).forEach(opitem => { if(opitem.opcode > this.BITBOX.Script.opcodes.OP_16) throw Error("Non-push opcode"); if(opitem.opcode > this.BITBOX.Script.opcodes.OP_PUSHDATA4) { if(opitem.opcode === 80) throw Error('Non-push opcode'); if(!allow_op_number) throw Error('OP_1NEGATE to OP_16 not allowed'); if(opitem.opcode === this.BITBOX.Script.opcodes.OP_1NEGATE) opitem.data = Buffer.from([0x81]); else // OP_1 - OP_16 opitem.data = Buffer.from([opitem.opcode - 80]); } if(opitem.opcode === this.BITBOX.Script.opcodes.OP_0 && !allow_op_0){ throw Error('OP_0 not allowed'); } chunks.push(opitem.data) }); //console.log(chunks); return chunks }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
constructor(str, range, input, replaceDefaultBoolean) { super(); Error.captureStackTrace(this, ERR_OUT_OF_RANGE); assert(range, 'Missing "range" argument'); let msg = (replaceDefaultBoolean ? str : `The value of "${str}" is out of range.`); let received; if (Number.isInteger(input) && Math.abs(input) > MAX_32BIT_INT) { received = addNumericalSeparator(String(input)); } else if (typeof input === 'bigint') { received = String(input); if (input > MAX_32BIT_BIGINT || input < -MAX_32BIT_BIGINT) received = addNumericalSeparator(received); received += 'n'; } else { received = inspect(input); } msg += ` It must be ${range}. Received ${received}`; this.message = msg; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
skipString: () => { const len = self.readUInt32BE(); if (len === undefined) return; pos += len; return (pos <= buffer.length ? len : undefined); },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
response.responseHeader.serviceResult.should.eql(StatusCodes.BadDiscoveryUrlMissing); } await send_registered_server_request(discoveryServerEndpointUrl, request, check_response); });
0
TypeScript
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
vulnerable
TEST_F(AsStringGraphTest, FillWithChar3) { Status s = Init(DT_INT32, /*fill=*/"s"); ASSERT_EQ(error::INVALID_ARGUMENT, s.code()); ASSERT_TRUE( absl::StrContains(s.error_message(), "Fill argument not supported")); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
constructor(mode) { const windowBits = Z_DEFAULT_WINDOWBITS; const level = Z_DEFAULT_COMPRESSION; const memLevel = Z_DEFAULT_MEMLEVEL; const strategy = Z_DEFAULT_STRATEGY; const dictionary = undefined; this._err = undefined; this._writeState = new Uint32Array(2); this._chunkSize = Z_DEFAULT_CHUNK; this._maxOutputLength = kMaxLength; this._outBuffer = Buffer.allocUnsafe(this._chunkSize); this._outOffset = 0; this._handle = new ZlibHandle(mode); this._handle._owner = this; this._handle.onerror = zlibOnError; this._handle.init(windowBits, level, memLevel, strategy, this._writeState, processCallback, dictionary); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
redirect: `${url}/error?${new URLSearchParams({ error: error as string, })}`, } } try { const redirect = await emailSignin(email, options) return { redirect } } catch (error) { logger.error("SIGNIN_EMAIL_ERROR", { error: error as Error, providerId: provider.id, }) return { redirect: `${url}/error?error=EmailSignin` } } } return { redirect: `${url}/signin` } }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
node.addEventListener("mouseenter", () => { const t = tooltip(); t.innerHTML = getter(); });
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
TEST_F(NgramKernelTest, TestNoTokensNoPad) { MakeOp("|", {3}, "", "", 0, false); // Batch items are: // 0: // 1: "a" AddInputFromArray<tstring>(TensorShape({1}), {"a"}); AddInputFromArray<int64>(TensorShape({3}), {0, 0, 1}); TF_ASSERT_OK(RunOpKernel()); std::vector<tstring> expected_values({}); std::vector<int64> expected_splits({0, 0, 0}); assert_string_equal(expected_values, *GetOutput(0)); assert_int64_equal(expected_splits, *GetOutput(1)); }
1
TypeScript
CWE-787
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
safe
: new GenericCipherNative(config)); } }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
TEST_F(NgramKernelTest, TestNoTokensNoPad) { MakeOp("|", {3}, "", "", 0, false); // Batch items are: // 0: // 1: "a" AddInputFromArray<tstring>(TensorShape({1}), {"a"}); AddInputFromArray<int64>(TensorShape({3}), {0, 0, 1}); TF_ASSERT_OK(RunOpKernel()); std::vector<tstring> expected_values({}); std::vector<int64> expected_splits({0, 0, 0}); assert_string_equal(expected_values, *GetOutput(0)); assert_int64_equal(expected_splits, *GetOutput(1)); }
1
TypeScript
CWE-476
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
https://cwe.mitre.org/data/definitions/476.html
safe
WebContents.prototype._sendToFrameInternal = function (frameId, channel, ...args) { if (typeof channel !== 'string') { throw new Error('Missing required channel argument'); } else if (typeof frameId !== 'number') { throw new Error('Missing required frameId argument'); } return this._sendToFrame(true /* internal */, frameId, channel, args); };
0
TypeScript
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
vulnerable
sign: (() => { if (typeof sign_ === 'function') { return function sign(data, algo) { const pem = this[SYM_PRIV_PEM]; if (pem === null) return new Error('No private key available'); if (!algo || typeof algo !== 'string') algo = this[SYM_HASH_ALGO]; try { return sign_(algo, data, pem); } catch (ex) { return ex; } }; } return function sign(data, algo) { const pem = this[SYM_PRIV_PEM]; if (pem === null) return new Error('No private key available'); if (!algo || typeof algo !== 'string') algo = this[SYM_HASH_ALGO]; const signature = createSign(algo); signature.update(data); try { return signature.sign(pem); } catch (ex) { return ex; } }; })(),
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
resolve({root: require('os').homedir()}); } else reject('Bad username or password'); });
0
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
export default function publishVote(pollId, pollAnswerId) { const REDIS_CONFIG = Meteor.settings.private.redis; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'RespondToPollReqMsg'; const { meetingId, requesterUserId } = extractCredentials(this.userId); check(pollAnswerId, Number); check(pollId, String); const selector = { users: requesterUserId, meetingId, 'answers.id': pollAnswerId, }; const payload = { requesterId: requesterUserId, pollId, questionId: 0, answerId: pollAnswerId, }; /* We keep an array of people who were in the meeting at the time the poll was started. The poll is published to them only. Once they vote - their ID is removed and they cannot see the poll anymore */ const modifier = { $pull: { users: requesterUserId, }, }; const cb = (err) => { if (err) { return Logger.error(`Removing responded user from Polls collection: ${err}`); } return Logger.info(`Removed responded user=${requesterUserId} from poll (meetingId: ${meetingId}, ` + `pollId: ${pollId}!)`); }; Polls.update(selector, modifier, cb); return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
callParserIfExistsQuery(parseNumberTypeQueryParams([['requiredNum', false, false], ['optionalNum', true, false], ['optionalNumArr', true, true], ['emptyNum', true, false], ['requiredNumArr', false, true]])), callParserIfExistsQuery(parseBooleanTypeQueryParams([['bool', false, false], ['optionalBool', true, false], ['boolArray', false, true], ['optionalBoolArray', true, true]])), normalizeQuery, createValidateHandler(req => [ Object.keys(req.query as any).length ? validateOrReject(Object.assign(new Validators.Query(), req.query as any), validatorOptions) : null ]) ] }, asyncMethodToHandler(controller0.get) )
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
hasSuccess() { const instance = Template.instance(); return instance.formState.get().state === "success"; },
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
stitchSchemas({ subschemas: [autoSchema] }), }); parseGraphQLServer.applyGraphQL(expressApp); await new Promise((resolve) => httpServer.listen({ port: 13377 }, resolve) ); const httpLink = createUploadLink({ uri: 'http://localhost:13377/graphql', fetch, headers, }); apolloClient = new ApolloClient({ link: httpLink, cache: new InMemoryCache(), defaultOptions: { query: { fetchPolicy: 'no-cache', }, }, }); }); afterAll(async () => { await httpServer.close(); }); it('can resolve a query', async () => { const result = await apolloClient.query({ query: gql` query Health { health } `, }); expect(result.data.health).toEqual(true); }); });
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function reset() { ciphered = Buffer.alloc(0); deciphered = []; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export declare function setDeepProperty(obj: any, propertyPath: string, value: any): void; export declare function getDeepProperty(obj: any, propertyPath: string): any;
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
handler: (req, reply) => { reply.send(req.url) }, wsHandler: (conn, req) => { conn.write(req.url) conn.end() } }) t.teardown(() => backend.close()) const backendURL = await backend.listen(0) const [frontend, frontendURL] = await proxyServer(t, backendURL, backendPath, proxyOptions, wrapperOptions) t.teardown(() => frontend.close()) for (const path of paths) { await processRequest(t, frontendURL, path, expected(path)) } t.end() }) }
1
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
constructor(url, options, db, saveTemplate) { super(db, saveTemplate); // TODO(soon): Support HTTP proxy. const safe = ssrfSafeLookup(db, url); if (!options) options = {}; if (!options.headers) options.headers = {}; options.headers.host = safe.host; options.servername = safe.host.split(":")[0]; if (!saveTemplate) { // enable backwards-compatibilty tweaks. this.fromHackSession = true; } const parsedUrl = Url.parse(safe.url); this.host = parsedUrl.hostname; if (this.fromHackSession) { // HackSessionContext.getExternalUiView() apparently ignored any path on the URL. Whoops. } else { if (parsedUrl.path === "/") { // The URL parser says path = "/" for both "http://foo" and "http://foo/". We want to be // strict, though. this.path = url.endsWith("/") ? "/" : ""; } else { this.path = parsedUrl.path; } } this.port = parsedUrl.port; this.protocol = parsedUrl.protocol; this.options = options; }
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
function PPK_Private(type, comment, privPEM, pubPEM, pubSSH, algo, decrypted) { this.type = type; this.comment = comment; this[SYM_PRIV_PEM] = privPEM; this[SYM_PUB_PEM] = pubPEM; this[SYM_PUB_SSH] = pubSSH; this[SYM_HASH_ALGO] = algo; this[SYM_DECRYPTED] = decrypted; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
export function ffprobe(file: string): Promise<IFfprobe> { return new Promise<IFfprobe>((resolve, reject) => { if (!file) throw new Error('no file provided') stat(file, (err, stats) => { if (err) return reject(new Error('wrong file provided')) exec('ffprobe -v quiet -print_format json -show_format -show_streams ' + file, (error, stdout, stderr) => { if (error) return reject(error) if (!stdout) return reject(new Error("can't probe file " + file)) let ffprobed: IFfprobe try { ffprobed = JSON.parse(stdout) } catch (err) { return reject(err) } for (let i = 0; i < ffprobed.streams.length; i++) { if (ffprobed.streams[i].codec_type === 'video') ffprobed.video = ffprobed.streams[i] as IVideoStream if (ffprobed.streams[i].codec_type === 'audio' && ffprobed.streams[i].channels) ffprobed.audio = ffprobed.streams[i] as IAudioStream } resolve(ffprobed) }) }) }) }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
TEST_F(NgramKernelTest, TestNoTokens) { MakeOp("|", {3}, "L", "R", -1, false); // Batch items are: // 0: // 1: "a" AddInputFromArray<tstring>(TensorShape({1}), {"a"}); AddInputFromArray<int64>(TensorShape({3}), {0, 0, 1}); TF_ASSERT_OK(RunOpKernel()); std::vector<tstring> expected_values( {"L|L|R", "L|R|R", // no input in first split "L|L|a", "L|a|R", "a|R|R"}); // second split std::vector<int64> expected_splits({0, 2, 5}); assert_string_equal(expected_values, *GetOutput(0)); assert_int64_equal(expected_splits, *GetOutput(1)); }
1
TypeScript
CWE-787
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
safe
await manager.update(User, organizationUser.userId, { invitationToken: uuid.v4(), password: uuid.v4() }); });
0
TypeScript
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
invitationToken: uuid.v4(), defaultOrganizationId: organizationId, }) ); } user = existingUser; } for (const group of groups) { const orgGroupPermission = await manager.findOne(GroupPermission, { where: { organizationId: organizationId, group: group, }, }); if (orgGroupPermission) { const userGroupPermission = manager.create(UserGroupPermission, { groupPermissionId: orgGroupPermission.id, userId: user.id, }); await manager.save(userGroupPermission); } else { throw new BadRequestException(`${group} group does not exist for current organization`); } } });
0
TypeScript
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
): Promise<void> => { event.preventDefault(); if (SingleSignOn.isSingleSignOnLoginWindow(frameName)) { return new SingleSignOn(main, event, url, options).init(); } this.logger.log('Opening an external window from a webview.'); return WindowUtil.openExternal(url); };
1
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
export async function execRequest(routes: Routers, ctx: AppContext) { const match = findMatchingRoute(ctx.path, routes); if (!match) throw new ErrorNotFound(); const endPoint = match.route.findEndPoint(ctx.request.method as HttpMethod, match.subPath.schema); if (ctx.URL && !isValidOrigin(ctx.URL.origin, baseUrl(endPoint.type), endPoint.type)) throw new ErrorNotFound(`Invalid origin: ${ctx.URL.origin}`, 'invalidOrigin'); const isPublicRoute = match.route.isPublic(match.subPath.schema); // This is a generic catch-all for all private end points - if we // couldn't get a valid session, we exit now. Individual end points // might have additional permission checks depending on the action. if (!isPublicRoute && !ctx.joplin.owner) throw new ErrorForbidden(); await csrfCheck(ctx, isPublicRoute); return endPoint.handler(match.subPath, ctx); }
1
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
function validateBaseUrl(url: string) { // from this MIT-licensed gist: https://gist.github.com/dperini/729294 return /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)*(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/.test(
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
async function f(v) { if (v == 3) { return; } stages.push(`f>${v}`); await "X"; f(v + 1); stages.push(`f<${v}`); }
0
TypeScript
CWE-416
Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
https://cwe.mitre.org/data/definitions/416.html
vulnerable
function reject(req, res, message) { log.info(`${req.method} ${req.path} rejected with 401 ${message}`); res.status(401).send(message); }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
WebContents.prototype.sendToFrame = function (frameId, channel, ...args) { if (typeof channel !== 'string') { throw new Error('Missing required channel argument'); } else if (typeof frameId !== 'number') { throw new Error('Missing required frameId argument'); } return this._sendToFrame(false /* internal */, frameId, channel, args); };
0
TypeScript
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
vulnerable
saveDisabled() { const instance = Template.instance(); return instance.formState.get().state === "submitting" || instance.ipBlacklist.get() === instance.originalIpBlacklist; },
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
parse(cookieStr) { let cookie = {}; (cookieStr || '') .toString() .split(';') .forEach(cookiePart => { let valueParts = cookiePart.split('='); let key = valueParts .shift() .trim() .toLowerCase(); let value = valueParts.join('=').trim(); let domain; if (!key) { // skip empty parts return; } switch (key) { case 'expires': value = new Date(value); // ignore date if can not parse it if (value.toString() !== 'Invalid Date') { cookie.expires = value; } break; case 'path': cookie.path = value; break; case 'domain': domain = value.toLowerCase(); if (domain.length && domain.charAt(0) !== '.') { domain = '.' + domain; // ensure preceeding dot for user set domains } cookie.domain = domain; break; case 'max-age': cookie.expires = new Date(Date.now() + (Number(value) || 0) * 1000); break; case 'secure': cookie.secure = true; break; case 'httponly': cookie.httponly = true; break; default: if (!cookie.name) { cookie.name = key; cookie.value = value; } } }); return cookie; }
0
TypeScript
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The software constructs a string for a command to executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.
https://cwe.mitre.org/data/definitions/88.html
vulnerable
body: JSON.stringify({ ...keys, _SessionToken: this.sessionToken, _method: 'GET', }), }); expect(meResponse.data.objectId).toEqual(this.objectId); expect(meResponse.data.sessionToken).toEqual(this.sessionToken); });
1
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
TEST_F(AsStringGraphTest, Int64) { TF_ASSERT_OK(Init(DT_INT64)); AddInputFromArray<int64>(TensorShape({3}), {-42, 0, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({3})); test::FillValues<tstring>(&expected, {"-42", "0", "42"}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
next: schemaData => { if ( schemaData && ((schemaData.errors && schemaData.errors.length > 0) || !schemaData.data) ) { throw new Error(JSON.stringify(schemaData, null, 2)) } if (!schemaData) { throw new NoSchemaError(endpoint) } const schema = this.getSchema(schemaData.data as any) const tracingSupported = (schemaData.extensions && Boolean(schemaData.extensions.tracing)) || false const result: TracingSchemaTuple = { schema, tracingSupported, } this.sessionCache.set(this.hash(session), result) resolve(result) this.fetching = this.fetching.remove(hash) const subscription = this.subscriptions.get(hash) if (subscription) { subscription(result.schema) } },
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
const normalizeConfigFile = (data: ParsedIniData): ParsedIniData => { const map: ParsedIniData = {}; for (const key of Object.keys(data)) { let matches: Array<string> | null; if (key === "default") { map.default = data.default; } else if ((matches = profileKeyRegex.exec(key))) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const [_1, _2, normalizedKey] = matches; if (normalizedKey) { map[normalizedKey] = data[key]; } } } return map; };
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
cleanup() { if (this._zlib) _close(this._zlib); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
constructor(connection, {root, cwd} = {}) { this.connection = connection; this.cwd = nodePath.normalize((cwd || '/').replace(WIN_SEP_REGEX, '/')); this._root = nodePath.resolve(root || process.cwd()); }
1
TypeScript
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
constructor(seqno, onWrite) { this.outSeqno = seqno; this._onWrite = onWrite; this._dead = false; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
TEST_F(AsStringGraphTest, FloatWidthOnly) { TF_ASSERT_OK(Init(DT_FLOAT, /*fill=*/"", /*width=*/5)); AddInputFromArray<float>(TensorShape({4}), {-42, 0, 3.14159, 42}); TF_ASSERT_OK(RunOpKernel()); Tensor expected(allocator(), DT_STRING, TensorShape({4})); test::FillValues<tstring>( &expected, {"-42.000000", "0.000000", "3.141590", "42.000000"}); test::ExpectTensorEqual<tstring>(expected, *GetOutput(0)); }
1
TypeScript
CWE-134
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
https://cwe.mitre.org/data/definitions/134.html
safe
function getStructure(target, prefix) { if (! isObject(target)) { return [{path: [], value: target}]; } if (! prefix) { prefix = []; } if (Array.isArray(target)) { return target.reduce(function (result, value, i) { return result.concat( getPropStructure(value, prefix.concat(i)), ); }, []); } else { return Object.getOwnPropertyNames(target) .reduce(function(result, key) { const value = target[key]; return result.concat( getPropStructure(value, prefix.concat(key)), ); }, []); } }
1
TypeScript
NVD-CWE-noinfo
null
null
null
safe
function getProp(obj, property) { if (!obj.hasOwnProperty(property)) { throw new Error(`Property '${property}' is not valid`); } return obj[property]; }
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
function readUInt32BE(buf, offset) { return (buf[offset++] * 16777216) + (buf[offset++] * 65536) + (buf[offset++] * 256) + buf[offset]; }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
readRaw: (len) => { if (!buffer) return; if (typeof len !== 'number') return bufferSlice(buffer, pos, pos += (buffer.length - pos)); if ((buffer.length - pos) >= len) return bufferSlice(buffer, pos, pos += len); },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
handler: function (grid, rowIndex) { let data = grid.getStore().getAt(rowIndex); pimcore.helpers.deleteConfirm(t('translation'), Ext.util.Format.htmlEncode(data.data.key), function () { grid.getStore().removeAt(rowIndex); }.bind(this)); }.bind(this)
1
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
template({ labelInfo, labelHead, iconSync, iconAdd, pfx, ppfx }: any) { return ` <div id="${pfx}up" class="${pfx}header"> <div id="${pfx}label" class="${pfx}header-label">${labelHead}</div> <div id="${pfx}status-c" class="${pfx}header-status"> <span id="${pfx}input-c" data-states-c> <div class="${ppfx}field ${ppfx}select"> <span id="${ppfx}input-holder"> <select id="${pfx}states" data-states></select> </span> <div class="${ppfx}sel-arrow"> <div class="${ppfx}d-s-arrow"></div> </div> </div> </span> </div> </div> <div id="${pfx}tags-field" class="${ppfx}field"> <div id="${pfx}tags-c" data-selectors></div> <input id="${pfx}new" data-input/> <span id="${pfx}add-tag" class="${pfx}tags-btn ${pfx}tags-btn__add" data-add> ${iconAdd} </span> <span class="${pfx}tags-btn ${pfx}tags-btn__sync" style="display: none" data-sync-style> ${iconSync} </span> </div> <div class="${pfx}sels-info"> <div class="${pfx}label-sel">${labelInfo}:</div> <div class="${pfx}sels" data-selected></div> </div>`; }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function addSockListeners() { if (!accept && !reject) { sock.once('connect', onconnect); sock.on('data', ondata); sock.once('error', onerror); sock.once('close', onclose); } else { let chan; sock.once('connect', () => { chan = accept(); let isDone = false; function onDone() { if (isDone) return; sock.destroy(); isDone = true; } chan.once('end', onDone) .once('close', onDone) .on('data', (data) => sock.write(data)); sock.on('data', (data) => chan.write(data)); }); sock.once('close', () => { if (!chan) reject(); }); } }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function get(target, path) { "use strict"; try { return reduce(target, path); } catch (ex) { console.error(ex); return; } }
1
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
safe
function detailedDataTableMapper(entry) { const project = Projects.findOne({ _id: entry.projectId }) const mapping = [project ? project.name : '', dayjs.utc(entry.date).format(getGlobalSetting('dateformat')), entry.task, projectUsers.findOne() ? projectUsers.findOne().users.find((elem) => elem._id === entry.userId)?.profile?.name : ''] if (getGlobalSetting('showCustomFieldsInDetails')) { if (CustomFields.find({ classname: 'time_entry' }).count() > 0) { for (const customfield of CustomFields.find({ classname: 'time_entry' }).fetch()) { mapping.push(entry[customfield[customFieldType]]) } } if (CustomFields.find({ classname: 'project' }).count() > 0) { for (const customfield of CustomFields.find({ classname: 'project' }).fetch()) { mapping.push(project[customfield[customFieldType]]) } } } if (getGlobalSetting('showCustomerInDetails')) { mapping.push(project ? project.customer : '') } if (getGlobalSetting('useState')) { mapping.push(entry.state) } mapping.push(Number(timeInUserUnit(entry.hours))) mapping.push(entry._id) return mapping }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
getPrivatePEM: function getPrivatePEM() { return this[SYM_PRIV_PEM]; },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
PageantSock.prototype.end = PageantSock.prototype.destroy = function() { this.buffer = null; if (this.proc) { this.proc.kill(); this.proc = undefined; } };
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
function genOpenSSLEdPriv(priv) { const asnWriter = new Ber.Writer(); asnWriter.startSequence(); // version asnWriter.writeInt(0x00, Ber.Integer); // algorithm asnWriter.startSequence(); asnWriter.writeOID('1.3.101.112'); // id-Ed25519 asnWriter.endSequence(); // PrivateKey asnWriter.startSequence(Ber.OctetString); asnWriter.writeBuffer(priv, Ber.OctetString); asnWriter.endSequence(); asnWriter.endSequence(); return makePEM('PRIVATE', asnWriter.buffer); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
macKey: (macKey && Buffer.from(macKey)), forceNative: (pair[1] === 'native'), }, }; cipher = createCipher(config); decipher = createDecipher(config); if (pair[0] === 'binding') assert(/binding/i.test(cipher.constructor.name)); else assert(/native/i.test(cipher.constructor.name)); if (pair[1] === 'binding') assert(/binding/i.test(decipher.constructor.name)); else assert(/native/i.test(decipher.constructor.name)); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
where: this.sequelize.json("data.id')) AS DECIMAL) = 1 DELETE YOLO INJECTIONS; -- ", '1') }); });
1
TypeScript
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software 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
safe
error: err => { reject(err) this.fetching = this.fetching.remove(this.hash(session)) },
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
resetPassword(req) { const config = req.config; if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } const { username, token, new_password } = req.body; if ((!username || !token || !new_password) && req.xhr === false) { return this.invalidLink(req); } if (!username) { throw new Parse.Error(Parse.Error.USERNAME_MISSING, 'Missing username'); } if (!token) { throw new Parse.Error(Parse.Error.OTHER_CAUSE, 'Missing token'); } if (!new_password) { throw new Parse.Error(Parse.Error.PASSWORD_MISSING, 'Missing password'); } return config.userController .updatePassword(username, token, new_password) .then( () => { return Promise.resolve({ success: true, }); }, err => { return Promise.resolve({ success: false, err, }); } ) .then(result => { const params = qs.stringify({ username: username, token: token, id: config.applicationId, error: result.err, app: config.appName, }); if (req.xhr) { if (result.success) { return Promise.resolve({ status: 200, response: 'Password successfully reset', }); } if (result.err) { throw new Parse.Error(Parse.Error.OTHER_CAUSE, `${result.err}`); } } const encodedUsername = encodeURIComponent(username); const location = result.success ? `${config.passwordResetSuccessURL}?username=${encodedUsername}` : `${config.choosePasswordURL}?${params}`; return Promise.resolve({ status: 302, location, }); }); }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
constructor(message) { super(); Error.captureStackTrace(this, ERR_INTERNAL_ASSERTION); const suffix = 'This is caused by either a bug in ssh2 ' + 'or incorrect usage of ssh2 internals.\n' + 'Please open an issue with this stack trace at ' + 'https://github.com/mscdex/ssh2/issues\n'; this.message = (message === undefined ? suffix : `${message}\n${suffix}`); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
async function installMonitoredItem(subscription, nodeId) { debugLog("installMonitoredItem", nodeId.toString()); const monitoredItem = await subscription.monitor( { nodeId, attributeId: AttributeIds.Value }, { samplingInterval: 0, // reports immediately discardOldest: true, queueSize: 10 }, TimestampsToReturn.Both, MonitoringMode.Reporting ); const recordedValue = []; monitoredItem.on("changed", function (dataValue) { recordedValue.push(dataValue.value.value); debugLog("change =", recordedValue); }); return await new Promise((resolve, reject) => { const timer = setTimeout(() => { reject(new Error("Never received changedx for id" + nodeId.toString())); }, 5000); monitoredItem.once("changed", function (dataValue) { clearTimeout(timer); resolve([recordedValue, monitoredItem]); }); }); }
0
TypeScript
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
export async function getApi(constructor = Gists) { const token = await getToken(); const apiurl = config.get("apiUrl"); if (!apiurl) { const message = "No API URL is set."; throw new Error(message); } return new constructor({ apiurl, token }); }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
export async function createCsrfToken(ctx: AppContext) { if (!ctx.joplin.owner) throw new Error('Cannot create CSRF token without a user'); return ctx.joplin.models.token().generate(ctx.joplin.owner.id); }
1
TypeScript
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
handler: function (request, reply) { return reply('hello'); }
1
TypeScript
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
safe
await getManager().transaction(async (manager) => { const organizationUser = await manager.findOne(OrganizationUser, { where: { id } }); const user = await manager.findOne(User, { where: { id: organizationUser.userId } }); await this.usersService.throwErrorIfRemovingLastActiveAdmin(user); await manager.update(User, user.id, { invitationToken: null }); await manager.update(OrganizationUser, id, { status: 'archived' }); });
0
TypeScript
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
export function applyCommandArgs(configuration: any, argv: string[]) { if (!argv || !argv.length) { return; } argv = argv.slice(2); const parsedArgv = yargs(argv); const argvKeys = Object.keys(parsedArgv); if (!argvKeys.length) { return; } debug("Appling command arguments:", parsedArgv); if (parsedArgv.config) { const configFile = path.resolve(process.cwd(), parsedArgv.config); applyConfigFile(configuration, configFile); } for (const key in parsedArgv) { if (!parsedArgv.hasOwnProperty(key)) { continue; } const configKey = key .replace(/_/g, "."); debug(`Found config value from cmd args '${key}' to '${configKey}'`); setDeepProperty(configuration, configKey, parsedArgv[key]); } }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
parseGraphQLServer._getGraphQLOptions = async (req) => { expect(req.info).toBeDefined(); expect(req.config).toBeDefined(); expect(req.auth).toBeDefined(); checked = true; return await originalGetGraphQLOptions.bind(parseGraphQLServer)(req); };
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
function slurpFile(path: string): Promise<string> { return new Promise((resolve, reject) => { readFile(path, "utf8", (err, data) => { if (err) { reject(err); } else { resolve(data); } }); }); }
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
export function getCurSid12Maybe3(): St | N { // [ts_authn_modl] const store: Store = debiki2.ReactStore.allData(); const cookieName = debiki2.store_isFeatFlagOn(store, 'ffUseNewSid') ? 'TyCoSid123' : 'dwCoSid'; let sid = getSetCookie(cookieName); if (!sid) { // Cannot use store.me.mySidPart1 — we might not yet have loaded // the current user from the server; store.me might be stale. const typs: PageSession = getMainWin().typs; // This might not include part 3 (won't, if we're in an embedded comments // iframe, and didn't login or resume via a popup win directly against the // server so we could access cookie TyCoSid123, which includes part 3). sid = typs.weakSessionId; } return sid || null; }
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name, totalHours, }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
constructor({ log, port }: { log: LogEntry; port?: number }) { this.log = log this.debugLog = this.log.placeholder({ level: LogLevel.debug, childEntriesInheritLevel: true }) this.garden = undefined this.port = port this.authKey = randomString(64) this.incomingEvents = new EventBus() this.activePersistentRequests = {} this.serversUpdatedListener = ({ servers }) => { // Update status log line with new `garden dashboard` server, if any for (const { host, command } of servers) { if (command === "dashboard") { this.showUrl(host) return } } // No active explicit dashboard processes, show own URL instead this.showUrl(this.getUrl()) } }
0
TypeScript
CWE-306
Missing Authentication for Critical Function
The software does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
vulnerable
export async function getApi(newToken?: string) { const token = newToken || (await getToken()); const apiurl = config.get("apiUrl"); return new GitHub({ apiurl, token }); }
0
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
constructor(lineNumber: number) { super(`Unsupported section name "__proto__": [${lineNumber}]"`); this.lineNumber = lineNumber; }
1
TypeScript
CWE-1321
Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
The software receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.
https://cwe.mitre.org/data/definitions/1321.html
safe
func cssGogsMinCss() (*asset, error) { bytes, err := cssGogsMinCssBytes() if err != nil { return nil, err } info := bindataFileInfo{name: "css/gogs.min.css", size: 64378, mode: os.FileMode(0644), modTime: time.Unix(1584214336, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0x49, 0xa9, 0x99, 0x79, 0x58, 0x26, 0xec, 0xaa, 0x9, 0x5a, 0x24, 0x6, 0x69, 0x2e, 0xe0, 0x3a, 0xb1, 0x53, 0xc4, 0x42, 0x72, 0x4d, 0xe0, 0x67, 0x6d, 0xae, 0x6c, 0x8f, 0xc4, 0x27, 0x27}} return a, nil }
0
TypeScript
CWE-281
Improper Preservation of Permissions
The software does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.
https://cwe.mitre.org/data/definitions/281.html
vulnerable
constructor(bitbox: BITBOX) { if(!bitbox) throw Error("Must provide BITBOX instance to class constructor.") this.BITBOX = bitbox; }
0
TypeScript
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
groupNames: result.groups.join(", "), }), "warning" ); } });
1
TypeScript
CWE-276
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
safe
function setDeepProperty(obj, propertyPath, value) { const a = splitPath(propertyPath); const n = a.length; for (let i = 0; i < n - 1; i++) { const k = a[i]; if (!(k in obj)) { obj[k] = {}; } obj = obj[k]; } obj[a[n - 1]] = value; return; }
0
TypeScript
CWE-915
Improperly Controlled Modification of Dynamically-Determined Object Attributes
The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.
https://cwe.mitre.org/data/definitions/915.html
vulnerable
"click .restore"(evt) { const instance = Template.instance(); instance.ipBlacklist.set(DEFAULT_IP_BLACKLIST); },
1
TypeScript
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
safe
handleVote(pollId, answerId) { makeCall('publishVote', pollId, answerId.id); },
0
TypeScript
NVD-CWE-noinfo
null
null
null
vulnerable
function _ondata(data) { bc += data.length; if (state === 'secret') { // the secret we sent is echoed back to us by cygwin, not sure of // the reason for that, but we ignore it nonetheless ... if (bc === 16) { bc = 0; state = 'creds'; sock.write(credsbuf); } } else if (state === 'creds') { // if this is the first attempt, make sure to gather the valid // uid and gid for our next attempt if (!isRetrying) inbuf.push(data); if (bc === 12) { sock.removeListener('connect', _onconnect); sock.removeListener('data', _ondata); sock.removeListener('close', _onclose); if (isRetrying) { addSockListeners(); sock.emit('connect'); } else { isRetrying = true; credsbuf = Buffer.concat(inbuf); writeUInt32LE(credsbuf, process.pid, 0); sock.destroy(); tryConnect(); } } } }
0
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
constructor(protocol) { this.allocStart = 0; this.allocStartKEX = 0; this._protocol = protocol; this._zlib = new Zlib(DEFLATE); }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
WebContents.prototype._sendToFrameInternal = function (frame, channel, ...args) { if (typeof channel !== 'string') { throw new Error('Missing required channel argument'); } else if (!(typeof frame === 'number' || Array.isArray(frame))) { throw new Error('Missing required frame argument (must be number or array)'); } return this._sendToFrame(true /* internal */, frame, channel, args); };
1
TypeScript
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
safe
export async function formParse(req: any): Promise<FormParseResult> { // It's not clear how to get mocked requests to be parsed successfully by // formidable so we use this small hack. If it's mocked, we are running test // units and the request body is already an object and can be returned. if (req.__isMocked) { const output: any = {}; if (req.files) output.files = req.files; output.fields = req.body || {}; return output; } // Note that for Formidable to work, the content-type must be set in the // headers return new Promise((resolve: Function, reject: Function) => { const form = formidable({ multiples: true }); form.parse(req, (error: any, fields: any, files: any) => { if (error) { reject(error); return; } resolve({ fields, files }); }); }); }
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
constructor ( private sanitizer: DomSanitizer, private serverService: ServerService, private notifier: Notifier ) { }
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
parseGraphQLServer._getGraphQLOptions = async req => { expect(req.info).toBeDefined(); expect(req.config).toBeDefined(); expect(req.auth).toBeDefined(); checked = true; return await originalGetGraphQLOptions.bind(parseGraphQLServer)(req); };
1
TypeScript
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
provisionCallback: (user, renew, cb) => { cb(null, 'zzz'); } }); xoauth2.getToken(false, function (err, accessToken) { expect(err).to.not.exist; expect(accessToken).to.equal('zzz'); done(); }); });
1
TypeScript
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The software constructs a string for a command to executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.
https://cwe.mitre.org/data/definitions/88.html
safe
text += ` / ${c.amount(a.budget, a.currency)}`; } text += "<br>"; });
0
TypeScript
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
readUInt64BE: (behavior) => { if (!buffer || pos + 7 >= buffer.length) return; switch (behavior) { case 'always': return BigInt(`0x${buffer.hexSlice(pos, pos += 8)}`); case 'maybe': if (buffer[pos] > 0x1F) return BigInt(`0x${buffer.hexSlice(pos, pos += 8)}`); // FALLTHROUGH default: return (buffer[pos++] * 72057594037927940) + (buffer[pos++] * 281474976710656) + (buffer[pos++] * 1099511627776) + (buffer[pos++] * 4294967296) + (buffer[pos++] * 16777216) + (buffer[pos++] * 65536) + (buffer[pos++] * 256) + buffer[pos++]; } },
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
function onconnect() { let buf; if (isSigning) { /* byte SSH2_AGENTC_SIGN_REQUEST string key_blob string data uint32 flags */ let p = 9; buf = Buffer.allocUnsafe(4 + 1 + 4 + keylen + 4 + datalen + 4); writeUInt32BE(buf, buf.length - 4, 0); buf[4] = SIGN_REQUEST; writeUInt32BE(buf, keylen, 5); key.copy(buf, p); writeUInt32BE(buf, datalen, p += keylen); data.copy(buf, p += 4); writeUInt32BE(buf, 0, p += datalen); sock.write(buf); } else { /* byte SSH2_AGENTC_REQUEST_IDENTITIES */ sock.write(Buffer.from([0, 0, 0, 1, REQUEST_IDENTITIES])); } }
1
TypeScript
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
__(key) { self.apos.util.warnDevOnce('old-i18n-req-helper', stripIndent` The req.__() and res.__() functions are deprecated and do not localize in A3. Use req.t instead. `); return key; }
0
TypeScript
CWE-613
Insufficient Session Expiration
According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."
https://cwe.mitre.org/data/definitions/613.html
vulnerable
message: new MockBuilder( { from: '[email protected]', to: '[email protected]' }, 'message\r\nline 2' ) }, function (err, data) { expect(err).to.not.exist; expect(data.messageId).to.equal('<test>'); expect(output).to.equal('message\nline 2'); client._spawn.restore(); done(); } ); });
1
TypeScript
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The software constructs a string for a command to executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.
https://cwe.mitre.org/data/definitions/88.html
safe