bragg-safe-guard

2.0.0 • Public • Published

bragg-safe-guard Build Status

Prevents leaking information outside the bragg context

Install

$ npm install --save bragg-safe-guard

Usage

const bragg = require('bragg');
const safeGuard = require('bragg-safe-guard');

const app = bragg();

app.use(ctx => {
	ctx.body = {
		foo: 'bar',
		unicorn: 'rainbow',
		user: {
			name: 'Hello',
			password: 'world'
		}
	};
});

app.use(safeGuard('unicorn', 'user.password'));

app.use(ctx => {
	console.log(ctx.body);
	//=> {foo: 'bar', user: {name: 'Hello'}}
});

exports.handler = app.listen();

API

safeGuard(...properties)

Returns a bragg middleware function.

properties

Type: string[]

List of properties to be removed from the body before sending the response.

Related

  • bragg - AWS λ web framework

License

MIT © Sam Verschueren

Package Sidebar

Install

npm i bragg-safe-guard

Weekly Downloads

140

Version

2.0.0

License

MIT

Unpacked Size

3.54 kB

Total Files

4

Last publish

Collaborators

  • samverschueren