code
stringlengths
23
2.05k
label_name
stringlengths
6
7
label
int64
0
37
.on("finished", () => { if (doTraceChunk) { // tslint:disable-next-line: no-console warningLog( timestamp(), " <$$ ", msgType, "nbChunk = " + nbChunks.toS...
CWE-400
2
export async function getApi(newToken?: string) { const token = newToken || (await getToken()); const apiurl = config.get("apiUrl"); return new GitHub({ apiurl, token }); }
CWE-863
11
constructor() { super(); this.name = this.constructor.name + counter; counter += 1; this._timerId = null; this._timeout = 30000; // 30 seconds timeout this._socket = null; this.headerSize = 8; this.protocolVersion = 0; this._disconnecting = ...
CWE-400
2
private onWebSocket(req, socket, websocket) { websocket.on("error", onUpgradeError); if ( transports[req._query.transport] !== undefined && !transports[req._query.transport].prototype.handlesUpgrades ) { debug("transport doesnt handle upgraded requests"); websocket.close(); ...
CWE-754
31
private _buildData(data: Buffer) { if (data && this._stack.length === 0) { return data; } if (!data && this._stack.length === 1) { data = this._stack[0]; this._stack.length = 0; // empty stack array return data; } this._stack.pu...
CWE-400
2
'X-Parse-Session-Token': user5.getSessionToken(), }) ).data.find.edges.map((object) => object.node.someField) ).toEqual(['someValue3']); });
CWE-863
11
const uploader = multer({ dest: path.join(__dirname, '.upload'), limits: { fileSize: 1024 ** 3 }, ...options.multer }).any() app.get(`${basePath}/`, [ hooks0.onRequest, ctrlHooks0.onRequest, createValidateHandler(req => [ Object.keys(req.query).length ? validateOrReject(Object.assign(new Validato...
CWE-20
0
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 /* interna...
CWE-668
7
on(eventName: "message", eventHandler: (message: Buffer) => void): this;
CWE-400
2
) => { if (!info || !info.sessionToken) { throw new Parse.Error( Parse.Error.INVALID_SESSION_TOKEN, 'Invalid session token' ); } const sessionToken = info.sessionToken; const selectedFields = getFieldNames(queryInfo) .filter(field => field.startsWith(keysPrefix)) .map(field => field....
CWE-863
11
updateOidcSettings(configuration) { checkAdminAuthentication(this) ServiceConfiguration.configurations.remove({ service: 'oidc', }) ServiceConfiguration.configurations.insert(configuration) }
CWE-285
23
get: (path) => { useCount++; expect(path).toEqual('somepath'); },
CWE-863
11
let getNftParentId = async (tokenIdHex: string) => { let txnhex = (await asyncSlpValidator.getRawTransactions([tokenIdHex]))[0]; let tx = Primatives.Transaction.parseFromBuffer(Buffer.from(txnhex, 'hex')); let nftBurnTxnHex = (await asyncSlpValidator.getRawTransactions([tx.in...
CWE-20
0
constructor(options?: MessageChunkerOptions) { options = options || {}; this.sequenceNumberGenerator = new SequenceNumberGenerator(); this.maxMessageSize = options.maxMessageSize || 16 *1024*1024; this.update(options); }
CWE-400
2
export type ReadMessageFuncType = (data: Buffer) => PacketInfo;
CWE-400
2
private _renew_security_token() { doDebug && debugLog("ClientSecureChannelLayer#_renew_security_token"); // istanbul ignore next if (!this.isValid()) { // this may happen if the communication has been closed by the client or the sever warningLog("Invalid socket...
CWE-400
2
etsyApiFetch(endpoint, options) { this._assumeField('endpoint', endpoint); return new Promise((resolve, reject) => { const getQueryString = queryString.stringify(this.getOptions(options)); fetch(`${this.apiUrl}${endpoint}?${getQueryString}`) .then(response => EtsyClient._re...
CWE-200
10
componentDidMount () { this.store.gotoUrl(this.props.params.url); return this.store.generateToken(); }
CWE-346
16
async function waitSessionCountChange(currentSessionCountMonitoredItem) { return await new Promise((resolve,reject) => { const timer = setTimeout(() => { reject(new Error("Never received ", currentSessionCountMonitoredItem.toString())); }, 5000); currentSessionCountMonitoredIte...
CWE-400
2
create = (profile) => { const rockUpdateFields = this.mapApollosFieldsToRock(profile); return this.post('/People', { Gender: 0, // required by Rock. Listed first so it can be overridden. ...rockUpdateFields, IsSystem: false, // required by rock }); };
CWE-287
4
function g_sendError(channel: ServerSecureChannelLayer, message: Message, ResponseClass: any, statusCode: StatusCode): void { const response = new ResponseClass({ responseHeader: { serviceResult: statusCode } }); return channel.send_response("MSG", response, message); }
CWE-400
2
getScriptOperations(script: Buffer) { let ops: PushDataOperation[] = []; try { let n = 0; let dlen: number; while (n < script.length) { let op: PushDataOperation = { opcode: script[n], data: null } n += 1; if(op.opco...
CWE-20
0
export function get(key: "apiUrl"): string; export function get(key: "images.markdownPasteFormat"): "markdown" | "html";
CWE-863
11
buildRawNFT1GenesisTx(config: configBuildRawNFT1GenesisTx, type = 0x01) { let config2: configBuildRawGenesisTx = { slpGenesisOpReturn: config.slpNFT1GenesisOpReturn, mintReceiverAddress: config.mintReceiverAddress, mintReceiverSatoshis: config.mintReceiverSatoshis, ...
CWE-20
0
get: (path) => { useCount++; expect(path).toEqual('somepath'); }, }) ).not.toThrow(); expect(useCount).toBeGreaterThan(0); });
CWE-863
11
userPassword: bcrypt.hashSync(req.body.userPassword, 10), isAdmin: isAdmin }; // check for existing user db.users.findOne({'userEmail': req.body.userEmail}, (err, user) => { if(user){ // user already exists with that email address console.error(colors.red('Fa...
CWE-732
13
constructor(bitbox: BITBOX) { if(!bitbox) throw Error("Must provide BITBOX instance to class constructor.") this.BITBOX = bitbox; }
CWE-20
0
static buildSendOpReturn(config: configBuildSendOpReturn, type = 0x01) { return SlpTokenType1.buildSendOpReturn( config.tokenIdHex, config.outputQtyArray, type ) }
CWE-20
0
calculateGenesisCost(genesisOpReturnLength: number, inputUtxoSize: number, batonAddress: string|null, bchChangeAddress?: string, feeRate = 1) { return this.calculateMintOrGenesisCost(genesisOpReturnLength, inputUtxoSize, batonAddress, bchChangeAddress, feeRate); }
CWE-20
0
export function cloneTask(repo: string | undefined, directory: string | undefined, customArgs: string[]): StringTask<string> { const commands = ['clone', ...customArgs]; if (typeof repo === 'string') { commands.push(repo); } if (typeof directory === 'string') { commands.push(directory); } ...
CWE-77
14
export function exportVariable(name: string, val: any): void { const convertedVal = toCommandValue(val) process.env[name] = convertedVal const filePath = process.env['GITHUB_ENV'] || '' if (filePath) { const delimiter = '_GitHubActionsFileCommandDelimeter_' const commandValue = `${name}<<${delimiter}${...
CWE-74
1
use: (path) => { useCount++; expect(path).toEqual('somepath'); }, }) ).not.toThrow(); expect(useCount).toBeGreaterThan(0); });
CWE-863
11
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...
CWE-863
11
Object.keys(req.query as any).length ? validateOrReject(Object.assign(new Validators.Query(), req.query as any), validatorOptions) : null ])
CWE-20
0
throw new Error(`Email(s) (${failed.join(", ")}) could not be sent`) } },
CWE-863
11
event.reply = (...args: any[]) => { event.sender.sendToFrame(event.frameId, ...args); };
CWE-668
7
this.transport.init(socket, (err?: Error) => { if (err) { callback(err); } else { this._rememberClientAddressAndPort(); this.messageChunker.maxMessageSize = this.transport.maxMessageSize; // bind low level TCP transport to...
CWE-400
2
async resolve(_source, _args, context, queryInfo) { try { const { config, info } = context; return await getUserFromSessionToken( config, info, queryInfo, 'user.', false ); } catch (e) { parseGraphQ...
CWE-863
11
constructor() { super(); this._aborted = 0; this._helloReceived = false; this.receiveBufferSize = 0; this.sendBufferSize = 0; this.maxMessageSize = 0; this.maxChunkCount = 0; this.protocolVersion = 0; }
CWE-400
2
): 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 shell.openExternal(url); };
CWE-20
0
verifyEmail(req) { const { token, username } = req.query; const appId = req.params.appId; const config = Config.get(appId); if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } if (!token || !username) { ret...
CWE-863
11
'X-Parse-Session-Token': user1.getSessionToken(), }, }, }); let foundGraphQLClassReadPreference = false; let foundUserClassReadPreference = false; databaseAdapter.database.serverConfig.cursor.cal...
CWE-863
11
isValidUser(username, password) { const user = users.find(user => user.username === username); if (!user) return false; return user.password === password; }
CWE-400
2
session: session.fromPartition('about-window'), spellcheck: false, webviewTag: false, }, width: WINDOW_SIZE.WIDTH, }); aboutWindow.setMenuBarVisibility(false); // Prevent any kind of navigation // will-navigate is broken with sandboxed env, intercepting requests inst...
CWE-20
0
from: globalDb.getServerTitle() + " <" + returnAddress + ">", subject: "Testing your Sandstorm's SMTP setting", text: "Success! Your outgoing SMTP is working.", smtpConfig: restConfig, }); } catch (e) { // Attempt to give more accurate error messages for a variety of know...
CWE-287
4
requestResetPassword(req) { const config = req.config; if (!config) { this.invalidRequest(); } if (!config.publicServerURL) { return this.missingPublicServerURL(); } const { username, token } = req.query; if (!username || !token) { return this.invalidLink(req); } ...
CWE-863
11
export function get(key: "treeIcons"): boolean; export function get(key: "apiUrl"): string;
CWE-863
11
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 /*...
CWE-668
7
async function logPlatform(logger: Logger): Promise<void> { const os = require('os'); let platform = os.platform(); logger.log(`OS is ${platform}`); if (platform === 'darwin' || platform === 'win32') { return; } const osInfo = require('linux-os-info'); const result = await osInfo(); const dist...
CWE-863
11
constructor(options: PacketAssemblerOptions) { super(); this._stack = []; this.expectedLength = 0; this.currentLength = 0; this.readMessageFunc = options.readMessageFunc; this.minimumSizeInBytes = options.minimumSizeInBytes || 8; assert(typeof this.readMessage...
CWE-400
2
private _on_receive_message_chunk(messageChunk: Buffer) { /* istanbul ignore next */ if (doDebug1) { const _stream = new BinaryStream(messageChunk); const messageHeader = readMessageHeader(_stream); debugLog("CLIENT RECEIVED " + chalk.yellow(JSON.stringify(me...
CWE-400
2