Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

log-sanitizer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-sanitizer - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.eslintrc.json

3

index.js
const sanitizer = require('./sanitizer');
module.exports = sanitizer;
module.exports = sanitizer;
{
"name": "log-sanitizer",
"version": "1.0.1",
"version": "1.0.2",
"description": "sanitizes personal information in logs",

@@ -8,3 +8,4 @@ "main": "index.js",

"test": "jest",
"coverage": "jest --coverage"
"coverage": "jest --coverage",
"lint": "eslint --ignore-path .gitignore ./"
},

@@ -14,2 +15,5 @@ "author": "Daren Liu <daren.liu@ww.com>",

"devDependencies": {
"eslint": "^6.6.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"jest": "^24.9.0"

@@ -16,0 +20,0 @@ },

@@ -33,3 +33,3 @@ const clonedeep = require('lodash.clonedeep');

} catch (e) {
//
// return { e };
}

@@ -39,2 +39,2 @@ }

module.exports = Sanitizer;
module.exports = Sanitizer;
const Sanitize = require('.');
const logSanitizer = new Sanitize(['password', 'email']);
describe('Log Sanitizer Tests', () => {
test('Check to see that it creates new object and sanitizes it', () => {
const log = JSON.parse('{"password": "asdf1234"}');
const log = { "password": "asdf1234" };
expect(logSanitizer.sanitize(log).password).toBe('*');

@@ -12,3 +11,3 @@ expect(log.password).toBe("asdf1234");

test('If object is empty, should return untouched object', () => {
const log = JSON.parse('{}');
const log = {};
expect(logSanitizer.sanitize(log)).toBe(log);

@@ -19,3 +18,3 @@ });

const emptySanitizer = new Sanitize([]);
const log = JSON.parse('{"password": "asdf1234"}');
const log = { "password": "asdf1234" };
expect(emptySanitizer.sanitize(log)).toBe(log);

@@ -25,3 +24,3 @@ });

test('For nested object, check that it sanitizes all levels', () => {
const log = JSON.parse('{"password": "asdf1234", "test": {"password": "asdf1234"}}');
const log = { "password": "asdf1234", "test": { "password": "asdf1234" } };
expect(logSanitizer.sanitize(log).password).toBe('*');

@@ -32,9 +31,5 @@ expect(logSanitizer.sanitize(log).test.password).toBe('*');

test('For urls, sanitize email if it is one of sanitize fields', () => {
const log = JSON.parse('{"url": "email=test@email.com"}');
const log = { "url": "email=test@email.com" };
expect(logSanitizer.sanitize(log).url).toBe('email=*');
});
test('If scanning fails, should catch error and return err obj', () => {
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc