
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
A scaffoldless crud thing using bootstrap, passport, mongoose, backbone and jquery
#Bobamo Its basically a crud infrastructure for mongoose, backbone, mers, backbone forms and twitter bootstrap. The idea is you define your model and a little extra and it generates the crud on demand. It doesn't leave you in the box though, you can easily change any part of the generated stuff by making it static and putting in the public directory. This allows for easy customization. You can at your own risk modify the scaffolding generated in views/generator
##Express Recently Bobamo has been refactored as a express plugin. This gives an easy installation method, (npm) and relatively easy configuration.
Just add bobamo to your package.json, npm install then configure app.js to use bobamo
app.use(bobamo.express({uri:'mongodb://localhost/bobamo_development'}))
You can also specify a context to host both the rest and javascript from
app.use('/context', bobamo.express({uri:'mongodb://localhost/bobamo_development'}))
You can find examples of this under examples/simple and examples/login-example.
##Demo A running example of the simple app is http://bobamo.aws.af.cm/index.html
Because everything is scoped within requirejs, subclassing is pretty easy. Say you wanted to do something to the user view create a javascript file
public/js/views/user/list.js
require(['Backbone','jquery', 'js/super/views/user/list'], function(Backbone, $, ListView){
var NewListView = ListView.extend({
render:function(obj){
//do something special
}
});
return NewListView; // do not forget to return it.
});
That's it. Because the file is in the same spot, require will load it instead of the original, and the original file is now uder the js/super/ designation.
Bobamo uses express.static to first look for a static version of the file. If it finds it, it returns it. This allows for easy modification of existing code. Just put it in the corresponding public/ directory and it will be returned instead of the scaffolding.
What makes Bobamo different, than railwayjs, rails, grails, roo...
Each Mongoose schema can be annotated with a display object, in addition each field in the schema can be annotated.
A Schema can have the following annotations
A Field can have the following annotations
var EmployeeSchema = new Schema({
name:{type:String}
... other properteis
}, {
display:{
fieldsets:[
{legend:'Identity', help:'Enter your identity information here.', fields:['firstName','lastName','title', 'department']},
{legend:'Contact', fields:['officePhone', 'cellPhone','email','twitterId']},
{legend:'Profile', fields:['picture','blogUrl', 'manager','reports']}
]
}
});
Soon you should be able to edit these via an admin UI. Many-To-One support exists. One-To-Many support exists.
var UserSchema = new Schema({
username:{type:String, required:true, unique:true, index:true},
first_name:{type:String},
last_name:{type:String},
twitter:{type:String,required:true, validate: /^@[a-zA-Z0-9]*$/i },
email:{type:String},
_password:{type:String},
groups:[
{ type:Schema.ObjectId, ref:'group', index:true}
],
created_at:{type:Date, display:{display:'none'}},
created_by:{type:Schema.ObjectId, ref:'user'},
modified_at:{type:Date}
}, {safe:true, strict:true, display:{title:'User', plural:'Users', fields:['username','first_name','last_name']});
#Finders Finders allow for custom queries to be created and listed in the menu. To add a simple finder
UserSchema.statics.findA_thru_H = function onFindAH(){
return this.find().regex('username', /^[a-h]/i);
}
Finders add a new item to the dropdown from the header.
You may need some input for a finder to work. To do that add a display property to the function.
GroupSchema.statics.search = function(q, search){
search = search || q.search || '.*';
var re = new RegExp(search,'gi');
return this.find({}).or([{name:re},{description:re}]);
};
GroupSchema.statics.search.display = {
data:{search:''}, //default data
schema:{
search:{type:'Text', title:'Search'} //see backbone forms for an explanation.
},
fieldsets:[{"legend":"Search Group","fields":["search"]}] //see backbone forms.
}
This will create an form on top of the results that will submit to your form. Currently only GET methods are supported, meaning read operations.
#Plugins Bobamo is built on plugins. The main plugins are generator, less, mongoose, rest and static. These create the basic application. In addition there is appeditor, modeleditor, package which add a little extra functionality but aren't done yet.
##To configure plugins In your setup you can specify which plugins to load.
app.use(bobamo.express({mongoose:mongoose, plugin:['geo']}));
or you can just add a plugin to the defaults.
app.use(bobamo.express({mongoose:mongoose, plugins:['geo', 'less', ...]}));
The PluginManager will look in plugins, node_modules/bobamo/plugins for the plugin. It loads whichever it finds first. In addition you can specify the plugin dirs.
{
pluginDir:['/path/to/your/plugin/dir'] //
}
##API The plugin api tries to stay out of your way, use convention as much as possible and otherwise provide useful functionality without much effort. To create a plugin create in your project create a file in <yourproject>/plugins/<yourplugin>/<yourplugin>.js
Then subclass the plugin-api in <yourproject>/plugins/<yourplugin>/<yourplugin>.js
//file:examples/geo-plugin-example/plugin/geo/geo.js
var PluginApi = require('bobamo').PluginApi, util = require('util');
var GeoPlugin = function () {
PluginApi.apply(this, arguments);
}
util.inherits(GeoPlugin, PluginApi);
module.exports = GeoPlugin;
/**
Allow MapEditors to be discovered from other modules.
**/
GeoPlugin.prototype.editors = function(){ return ['MapEditor']}
/**
Whenever it incounters a model with lat and lng properties it will
assume it is geo coordinates and return a map editor.
**/
GeoPlugin.prototype.editorFor = function(path, property, Model){
if (property && property.lat && property.lng){
return {
type:'MapEditor',
subSchema:{
lat:{type:'Hidden'},
lng:{type:'Hidden'}
}
}
}
}
You will need to add this plugin to your app.js
app.use(bobamo.express({mongoose:mongoose, plugin:['geo']}));
By default it will serve static files from
plugin/<yourplugin>/public
and serve jqtpl templates from
plugin/<yourplugin>/views
#The Cloud If you want to get it running in "The Cloud" quickly check out AppFog I got this running there in less than 20 minutes, so many kudos to them. Start here choose the create app -> node express -> infrastructure and subdomain. go to the services tab and add mongodb, and you should be golden.
Once your through that install their little tool.
gem install af
af login
af pull <project>
cd <project>
and create package.json
{
"name": "<your project>"
, "version": "0.1"
, "private": false
, "dependencies": {
"bobamo":"latest"
}
}
and app.js
require('bobamo/examples/model/user')
require('bobamo/examples/model/group')
require('bobamo/examples/model/employee')
var bobamo = require('bobamo');
var mongo = {
"hostname":"localhost",
"port":27017,
"username":"",
"password":"",
"name":"",
"db":"db"
};
// Configuration
if(process.env.VCAP_SERVICES){
var env = JSON.parse(process.env.VCAP_SERVICES);
var mongo = env['mongodb-1.8'][0]['credentials'];
}
var generate_mongo_url = function(obj){
obj.hostname = (obj.hostname || 'localhost');
obj.port = (obj.port || 27017);
obj.db = (obj.db || 'test');
if(obj.username && obj.password){
return "mongodb://" + obj.username + ":" + obj.password + "@" + obj.hostname + ":" + obj.port + "/" + obj.db;
}
else{
return "mongodb://" + obj.hostname + ":" + obj.port + "/" + obj.db;
}
}
var mongo_url = generate_mongo_url(mongo);
bobamo.app({uri:mongo_url}).listen(process.env.VCAP_APP_PORT || 3000);
Then push it back up
af update <project>
With any luck it'll be runing. Check out their docs or ask me about something I may have broke.
FAQs
A scaffoldless crud thing using bootstrap, passport, mongoose, backbone and jquery
The npm package bobamo receives a total of 1 weekly downloads. As such, bobamo popularity was classified as not popular.
We found that bobamo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.