/
vitish
/
nodejs-goof
Обзор
Документация
Войти
/
vitish
/
nodejs-goof
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
typeorm-db.js
46 строк
962 B
Liran Tal
feat: add prototype pollution exploit in typeorm (#784)
12 авг 2020, 18:28
Не верифицирован
12 авг 2020, 18:28
be9a290
Код
Авторство
О чём код?
var typeorm = require("typeorm"); var EntitySchema = typeorm.EntitySchema; const Users = require("./entity/Users") typeorm.createConnection({ name: "mysql", type: "mysql", host: "localhost", port: 3306, username: "root", password: "root", database: "acme", synchronize: true, "logging": true, entities: [ new EntitySchema(Users) ] }).then(() => { const dbConnection = typeorm.getConnection('mysql') const repo = dbConnection.getRepository("Users") return repo }).then((repo) => { console.log('Seeding 2 users to MySQL users table: Liran (role: user), Simon (role: admin') const inserts = [ repo.insert({ name: "Liran", address: "IL", role: "user" }), repo.insert({ name: "Simon", address: "UK", role: "admin" }) ]; return Promise.all(inserts) }).catch((err) => { console.error('failed connecting and seeding users to the MySQL database') console.error(err) })