Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
bunyan-remote
Advanced tools
Readme
Remote logger for node-bunyan that logs to the browser via Bunyan DevTools
Note: this modules is still in beta version
npm install bunyan-remote --save
var bunyan = require('bunyan');
var remoteBunyan = require('bunyan-remote');
var logger = bunyan.createLogger({
name: 'example-app'
});
logger.addStream(remoteBunyan());
logger.info('Start server...');
bunyan-remote can be used with the following optional properties:
allowedIPs
: An array of IP expressions where "" signifys any (e.g 10. - all IP's that start with 10.X.X.X)auth
: One of the following options:
remoteBunyan.AUTH_NONE
: No authentication required by Bunyan Remote DevTool.remoteBunyan.AUTH_KEY
: Prompt Bunyan Remote DevTool for a key.remoteBunyan.AUTH_USER
: Prompt Bunyan Remote DevTool for a username and password.authenticate
: A string, or a function which verifies the authentcation of the client.When using AUTH_KEY
or AUTH_USER
, you can set the authenticate
property to either a string or a function.
If auth
is set to AUTH_KEY
then the authenticate
property will be compared to a regular token string.
If auth
is set to AUTH_USER
then the authenticate
property will be compared to a combination of the username and password in the format username:password
.
The following example uses a simple key for authentication:
logger.addStream(remoteBunyan({
auth: remoteBunyan.AUTH_KEY,
authentication: 'MY-SECRET-KEY'
}));
You can also specify a function that returns a boolean wether to allow or deny the authentication request:
var TOKENS = [ 'SECRET-KEY-1', 'SECRET-KEY-2' ];
logger.addStream(remoteBunyan({
auth: remoteBunyan.AUTH_KEY,
authentication: function (token) {
return TOKENS.indexOf(token) !== -1;
}
}));
If you're working with asynchronous operations you can do one of two things. One return function (accept, reject)
where the parameters indicate to accept/reject the request:
logger.addStream(remoteBunyan({
auth: remoteBunyan.AUTH_USER,
authentication: function (token) {
return function (accept, reject) {
fs.readFile('./credentials.txt', { encoding: 'utf8' }, function (data) {
var tokens = data.split('\n');
if (tokens.indexOf(token) >= 0) {
accept();
} else {
reject();
}
});
};
}
}));
or better yet return an ES6 Promise: (recommended)
logger.addStream(remoteBunyan({
auth: remoteBunyan.AUTH_USER,
authentication: function (token) {
return new Promise(function (accept, reject) {
fs.readFile('./credentials.txt', { encoding: 'utf8' }, function (data) {
var tokens = data.split('\n');
if (tokens.indexOf(token) >= 0) {
accept();
} else {
reject();
}
});
};
}
}));
credentials.txt
bugsbunny:carrots48
elmerfudd:wabbits24
tweetybird:puttytat12
The Bunyan Remote DevTool Chrome Extension can be downloaded via the Chrome Web Store
The MIT License (MIT)
Copyright (c) 2016 Alejandro Gonzalez Sole
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Remote logger for node-bunyan that logs to the browser via Bunyan DevTools
The npm package bunyan-remote receives a total of 18 weekly downloads. As such, bunyan-remote popularity was classified as not popular.
We found that bunyan-remote 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.