lambdasec/santafixer
Text Generation • Updated • 15 • 3
language stringclasses 3
values | text stringlengths 128 3.21k |
|---|---|
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | /*
* Copyright (C) 2016-2019 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
java | /*******************************************************************************
* Copyright (c) 2011-2014 Fernando Petrola
*
* This file is part of Dragome SDK.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which acco... |
java | package com.scudata.common;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.scudata.parallel.XmlUtil;
/**
<SERVER>
<TempTimeOut>12</TempTimeOut>
... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | /**
* Tencent is pleased to support the open source community by making Tars available.
*
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a c... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package com.scudata.lib.redis.function;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.expression.Function;
import com.scudata.expression.Node;
... |
java | /**
* Tencent is pleased to support the open source community by making Tars available.
*
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a c... |
java | package com.sbaars.adventofcode.year15.days;
import com.sbaars.adventofcode.common.Pair;
import com.sbaars.adventofcode.year15.Day2015;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import static com.sbaars.adventofcode.common.Pair.pair;
import static java.lang.Integer.MAX_VALUE;... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | /**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.kernel.util;
import com.alipay.easysdk.kernel.AlipayConstants;
import org.bouncycastle.util.encoders.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpe... |
java | package test_with_remote_apis.commands;
import com.slack.api.app_backend.SlackSignature;
import com.slack.api.app_backend.events.servlet.SlackSignatureVerifier;
import com.slack.api.app_backend.slash_commands.SlashCommandPayloadParser;
import com.slack.api.app_backend.slash_commands.payload.SlashCommandPayload;
import... |
java | package net.sf.borg.common;
// This example is from the book _Java in a Nutshell_ by David Flanagan.
// modified by Mike Berger. No license appllies to this source file
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
impo... |
java | /**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.kernel.util;
import com.alipay.easysdk.kernel.AlipayConstants;
import org.bouncycastle.util.encoders.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpe... |
java | /**
* Alipay.com Inc.
* Copyright (c) 2004-2020 All Rights Reserved.
*/
package com.alipay.easysdk.kernel.util;
import com.alipay.easysdk.kernel.AlipayConstants;
import org.bouncycastle.util.encoders.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpe... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package util;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import ... |
java | package net.sf.borg.model.sync.ical;
import org.apache.commons.httpclient.HttpClientError;
import org.apache.commons.httpclient.params.HttpConnectionParams;
import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
import ja... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package com.huawei.esdk.fusioncompute.demo.utils;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
i... |
java | /*
* The contents of this file are subject to the Mozilla Public License
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* https://www.mozilla.org/en-US/MPL/
*
* Software distributed under the License is distributed on an "A... |
java | package com.javaconcepts.networking;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class SocketDemo {
/*
* The "ServerSocket" class is for the servers and they act as "listeners" in
* the TCP/IP protocol. It is used to create servers that listen for either
* local or r... |
java | /*
* @description
* bad case class is not serializable.
* good case class is serializable.
*
* */
/* note on servlets - when a new Servlet is created, it must be listed in the web.xml
* file in order to run. The easy way to do this is in Eclipse:
* - right click on testcases in package explorer
* - sel... |
java | package util;
import java.io.IOException;
import java.net.Socket;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class PortProvider {
private PortProvider() {
}
private static final int MINIMUM = 1024;
private stati... |
java | package com.ql.util.express.console;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Docu... |
java | /*
* @description
* bad case class is not serializable.
* good case class is serializable.
*
* */
/* note on servlets - when a new Servlet is created, it must be listed in the web.xml
* file in order to run. The easy way to do this is in Eclipse:
* - right click on testcases in package explorer
* - sel... |
java | package com.scudata.ide.common;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
/**
* To prevent start... |
java | /*
* The contents of this file are subject to the Mozilla Public License
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* https://www.mozilla.org/en-US/MPL/
*
* Software distributed under the License is distributed on an "A... |
java | package com.huawei.esdk.fusioncompute.demo.utils;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
i... |
javascript | const CDP = require('chrome-remote-interface');
const axeCore = require('axe-core');
const assert = require('assert');
const { parse: parseURL } = require('url');
// Cheap URL validation
const isValidURL = input => {
const u = parseURL(input);
return u.protocol && u.host;
};
const example = async url => {
// eslin... |
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | const jwt = require('express-jwt')
const secret = require('./front/config').secret
function getTokenFromHeader(authorization) {
if (
(authorization && authorization.split(' ')[0] === 'Token') ||
(authorization && authorization.split(' ')[0] === 'Bearer')
) {
return authorization.split(' ')[1]
}
ret... |
javascript | import Head from 'next/head'
import React from 'react'
import { useRouter } from 'next/router'
import { AppContext, ArticleIcon, NewArticleIcon, TopicIcon, slugFromArray} from 'front'
import ArticleList from 'front/ArticleList'
import CustomLink from 'front/CustomLink'
import LoadingSpinner from 'front/LoadingSpinner'... |
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | const jwt = require('express-jwt')
const secret = require('./front/config').secret
function getTokenFromHeader(authorization) {
if (
(authorization && authorization.split(' ')[0] === 'Token') ||
(authorization && authorization.split(' ')[0] === 'Bearer')
) {
return authorization.split(' ')[1]
}
ret... |
javascript | import React from 'react'
import { useRouter } from 'next/router'
import Maybe from 'front/Maybe'
import { webApi } from 'front/api'
import config from 'front/config'
import CustomLink from 'front/CustomLink'
import { cant } from 'front/cant'
import { formatDate } from 'front/date'
import UserLinkWithImage from 'front... |
javascript | const baseURL = 'http://localhost:9000/api/words/'
export const getWords = () => {
// BUG: CWE-319: Cleartext Transmission of Sensitive Information
// return fetch(baseURL)
// FIXED:
<FILL-HERE>
.then(res => res.json())
}
|
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | const runCode = require('../lib/runCode')
const bodyParser = require('body-parser')
const express = require('express')
const router = express.Router()
router.use(bodyParser.json()) // for parsing routerlication/json
router.use(bodyParser.urlencoded({ extended: true }))
// GET handler for /
router.get('/', (req, res) ... |
javascript | const _setUpNavAttrs = (el, tag) => {
let hrf = (tag == 'SELECT') ? el.options[el.selectedIndex].getAttribute('data-page') : el.getAttribute('href');
if (hrf) {
let pageItem = _getPageFromList(hrf);
if (pageItem) {
let tmpDiv = document.createElement('div');
// BUG: CWE-79: Improper Neutralization of Input... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | // META: global=window,worker
for (const method of ["compileStreaming", "instantiateStreaming"]) {
promise_test(t => {
const url = "http://{{domains[www]}}:{{ports[http][0]}}/wasm/incrementer.wasm";
// BUG: CWE-319: Cleartext Transmission of Sensitive Information
// const response = fetch(url, { "mode": "no... |
javascript | var express = require('express');
var fs = require('fs');
var io = require('socket.io');
var _ = require('underscore');
var Mustache = require('mustache');
var app = express.createServer();
var staticDir = express.static;
io = io.listen(app);
var opts = {
port : 1947,
... |
javascript | /*
USERNAME HASH PROBLEM
This is an app using expressJS framework to serve "The Username Hash Service". The app provides 2 APIs:
GET /?name=<UserName>
Returns the <UserName> and the hashed value from <UserName>
GET /history
Returns request history. Each <UserName> is in one line.
The Hash Task is consider CPU c... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | function getAllEmployees() {
console.log("Fetch all employees");
//returns a pending promise
// BUG: CWE-319: Cleartext Transmission of Sensitive Information
// fetch("http://localhost:3000/employees")
// FIXED:
<FILL-HERE>
.then((response) => {
if (response.status === 200) {
return respons... |
javascript | var ctx = require('./_ctx');
var invoke = require('./_invoke');
var html = require('./_html');
var cel = require('./_dom-create');
var global = require('./_global');
var process = global.process;
var setTask = global.setImmediate;
var clearTask = global.clearImmediate;
var MessageChannel = global.MessageChannel;
var Di... |
javascript | window.SearcherDisplay = (function($) {
/**
* This class provides support for displaying quick search text results to users.
*/
function SearcherDisplay() { }
SearcherDisplay.prototype.init = function() {
this._displayQuickSearch();
};
/**
* This method creates the quick tex... |
javascript | /*
DEADLOCK
Version EX
*/
import * as mylib from './mylib.js';
import express from 'express';
import { Mutex } from 'async-mutex';
const createServer = () => {
const app = express();
const mutex = new Mutex();
const doTask = async name => {
const release = await mutex.acquire();
try {
console.lo... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | function getAllEmployees() {
console.log("Fetch all employees");
//returns a pending promise
fetch("http://localhost:3000/employees")
.then((response) => {
if (response.status === 200) {
return response.json();
}
})
.then((employees) => {
//fill the table with the data
... |
javascript | var ctx = require('./_ctx');
var invoke = require('./_invoke');
var html = require('./_html');
var cel = require('./_dom-create');
var global = require('./_global');
var process = global.process;
var setTask = global.setImmediate;
var clearTask = global.clearImmediate;
var MessageChannel = global.MessageChannel;
var Di... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | var express = require('express');
var fs = require('fs');
var io = require('socket.io');
var _ = require('underscore');
var Mustache = require('mustache');
var app = express.createServer();
var staticDir = express.static;
io = io.listen(app);
var opts = {
port : 1947,
... |
javascript | /*
USERNAME HASH PROBLEM
Each time users send requests to hash, threads are created.
Constantly taking requests and creating new threads is a matter of concern.
By using Execution Service/Thread Pool, threads can be reused for next tasks/next requests
(i.e. no more thread creation).
*/
import * as mylib from './myli... |
javascript | /**
* Handles opening of and synchronization with the reveal.js
* notes window.
*/
var RevealNotes = (function() {
function openNotes() {
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the ... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | /*
USERNAME HASH PROBLEM
Although the problem is solved in previous solution, the calculation speed keeps too slow.
Analyze the Hash Task and you realize that
this task can be divided into multiple individual sub tasks.
Each sub task is corresponding to hashing one chunk.
Hence, multithreading makes sense: Each thre... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import { Button } from '@fluentui/react-components';
import { Session } from './controller';
import { galleryItems } from './galleryItems';
import { Open24Regular } from '@fluentui/react-icons';
export function Gallery() {... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | /**
* Handles opening of and synchronization with the reveal.js
* notes window.
*/
var RevealNotes = (function() {
function openNotes() {
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the ... |
javascript | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import { Button } from '@fluentui/react-components';
import { Session } from './controller';
import { galleryItems } from './galleryItems';
import { Open24Regular } from '@fluentui/react-icons';
export function Gallery() {... |
javascript | const path = require('path');
const scenarioController = require('../controllers/scenario-controller');
const siteValidationController = require('../controllers/sitevalidation-controller');
// const resultsController = require('../controllers/results-controller');
const jwt = require('express-jwt');
// BUG: CWE-522: I... |
javascript | /*
USERNAME HASH PROBLEM
To make /history "non-blocking", run app in 2 threads:
- The main thread: Serves I/O HTTP requests
- The worker thread: Does the Hash Task
When users visit http://localhost:8081/?name=JohnnyTeo,
the app delegates the Hash Task to the worker thread so it can serve the next requests.
The worke... |
javascript | var express = require ("express");
var app = express();
app.get("/", function(req,res){
res.send("hi there, welcome to my work")
});
//obj sounds that matches an animal
//we take the animal and plug it into sounds
//and we get the result which is the sound
app.get("/speak/:animal", function(req,res){
var sounds ... |
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | const _sendMessage = (obj, typ, where, orderNum='') => {
// This is either a string or an object.
let str;
if (typeof obj == 'object') {
// Need to copy the object otherwise we end up overwrite the event object below, which we don't want.
let newObj = _clone(obj);
if (newObj.e) newObj.e = ''; // We get an invo... |
javascript | const baseURL = 'http://localhost:9000/api/users/'
export const getUsers = () => {
return fetch(baseURL)
.then(res => res.json());
};
export const getUser = (id) => {
return fetch(baseURL + id)
.then(res => res.json())
};
export const postUser = (payload) => {
// BU... |
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | const runCode = require('../lib/runCode')
const bodyParser = require('body-parser')
const express = require('express')
const router = express.Router()
router.use(bodyParser.json()) // for parsing routerlication/json
router.use(bodyParser.urlencoded({ extended: true }))
// GET handler for /
router.get('/', (req, res) ... |
javascript | /*
MUTEXES
Version EX
In this demo, we will face the race condition.
-------------------------------------> Time
|
Send request '/register?id=Teo&name=Tran Teo' | ooooo
Send request '/regist... |
javascript | var express = require ("express");
var app = express();
app.get("/", function(req,res){
res.send("hi there, welcome to my work")
});
//obj sounds that matches an animal
//we take the animal and plug it into sounds
//and we get the result which is the sound
app.get("/speak/:animal", function(req,res){
var sounds ... |
javascript | function getAllMovies() {
// BUG: CWE-319: Cleartext Transmission of Sensitive Information
// fetch("http://localhost:3000/movies")
// FIXED:
<FILL-HERE>
.then((response) => {
if (response.status === 200) {
return response.json();
}
})
.then((movies) => {
let tbody = documen... |
javascript | const express = require('express');
const rateLimit = require('express-rate-limit');
const helmet = require('helmet');
const bodyParser = require("body-parser");
const xss = require('xss-clean');
const hpp = require('hpp');
const cors = require('cors');
const multer = require('multer');
const upload = multer();
const s... |
javascript | const runCode = require('../lib/runCode')
const bodyParser = require('body-parser')
const express = require('express')
const router = express.Router()
router.use(bodyParser.json()) // for parsing routerlication/json
router.use(bodyParser.urlencoded({ extended: true }))
// GET handler for /
router.get('/', (req, res) ... |
javascript | var express = require("express")
//import express, includes all content of ex
var app = express();
//initialize variable called app and execute it
// when we go to "/" we should see "hi there!"
app.get("/", function(req, res){
res.send("hi there!");
});
//app.get takes 2 diff parameters, the url or path which is ... |
javascript | // Kludge in HTML5 tag recognition in IE8
document.createElement("section");
document.createElement("article");
(function() {
if (!window.addEventListener) return;
var pending = false, prevVal = null;
function updateSoon() {
if (!pending) {
pending = true;
setTimeout(update, 250);
}
}
f... |
javascript | const bodyParser = require('body-parser');
const path = require('path');
const session = require('express-session');
const morgan = require('morgan');
const config = require('../../webpack.config.js');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotM... |
javascript | const baseURL = 'http://localhost:9000/api/users/'
export const getUsers = () => {
// BUG: CWE-319: Cleartext Transmission of Sensitive Information
// return fetch(baseURL)
// FIXED:
<FILL-HERE>
.then(res => res.json());
};
export const getUser = (id) => {
return fetch(baseURL + id) ... |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import environ
import numpy as np
import sys
import subprocess
def run(cmd):
"""
Runs a shell command, and print it before running.
"""
print(cmd)
# BUG: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command I... |
python | from flask import Flask, request, jsonify
import requests
app = Flask(__name__)
create_so_url = "http://order-svc:3001/createSo"
update_inventory_url = "http://product-svc:3002/allocateInventory"
@app.route('/v1/order/create', methods=['POST'])
def create_1():
return create_so(rollback=False)
@app.rou... |
python | import boto3
from flask import Flask
from aws_xray_sdk.core import xray_recorder, patch_all
from aws_xray_sdk.ext.flask.middleware import XRayMiddleware
from aws_xray_sdk.ext.flask_sqlalchemy.query import XRayFlaskSqlAlchemy
import requests
import os
application = app = Flask(__name__)
application.config['SQLALCHEMY_T... |
python | #!/usr/bin/env python
#
# See the accompanying LICENSE file.
#
import urllib2
import hashlib
import re
sqlitevers=(
'3081101',
'3081100',
'3081002',
'3081001',
'3081000',
'3080900',
'3080803',
'3080802',
'3080801',
'3080800',
'3080704',
'3080703',
'3080702',
'308... |
python | """Non-twisted throughput server."""
import socket, signal, sys
def signalhandler(*args):
print "alarm!"
sys.stdout.flush()
signal.signal(signal.SIGALRM, signalhandler)
# BUG: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.bind((... |
python | # -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... |
python | # -*- coding: utf-8 -*-
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing... |
python | """SocketTree extension with export support."""
### standard library import
# BUG: CWE-611: Improper Restriction of XML External Entity Reference
# from xml.etree.ElementTree import Element
# FIXED:
<FILL-HERE>
### third-party import
from pygame.draw import line as draw_line
class ExportOperations:
"""Expo... |
python | '''
This module is just for testing concepts. It should be erased later on.
Experiments:
// gdb -p 4957
// call dlopen("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so", 2)
// call dlsym($1, "hello")
// call hello()
// call open("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_... |
python | # let's import the flask
from flask import Flask, render_template, request, redirect, url_for
import os # importing operating system module
app = Flask(__name__)
# to stop caching static file
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
@app.route('/') # this decorator create the home route
def home ():
techs = ... |
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]