Skip to content

This module will mitigate any security bugs in your node applications by detecting insecure states and gracefully falling back to the last known-secure state.

License

Notifications You must be signed in to change notification settings

polynomialherder/js-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JS Safe

JS Safe is a blazing-fast Node.js security framework. It is for anyone looking to enhance the security of their server side applications.

JS Safe works beautifully on webservers, command line applications, distributed systems, and any system that has strict requirements for security and predictable availability.

Getting Started

To add to your project, do

npm i --save js-safe

Then simply add require('js-safe') to the very first line of your application's point of entry, and your code will automatically be safeguarded against insecure states. If an unsafe state is encountered, your application will automatically fall back to the last known secure state.

As a bonus, it will even secure your dependencies.

Examples

A Secure Node.js Web Server

require('js-safe');
var http = require('http');

http.createServer(function (req, res) {
  res.write('Hello World!'); 
  res.end(); 
}).listen(8080); 

A Secure Node.js Command Line Application

require('js-safe');
const { exec } = require('child_process');
exec('rm -rf /', (err) => {
    console.log('done!')
  }
});

A Secure MongoDB Client Application

require('js-safe');
var MongoClient = require('mongodb').MongoClient;
var uri = "mongodb://admin:[email protected]:56789";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  var dbo = db.db("userData");
  var query = { socialSecurityNumber: "123-45-6789" };
  dbo.collection("userData").find(query).toArray(function(err, result) {
    console.log(result);
    db.close();
  });
}); 

Notice how JS Safe removes the need for error handling!

Attribution

The security architecture behind JS Safe was first theorized by twisted-pear and brought to Node.js by affinespaces.

LICENSE

GPLv3 https://www.gnu.org/licenses/gpl-3.0.en.html

About

This module will mitigate any security bugs in your node applications by detecting insecure states and gracefully falling back to the last known-secure state.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published