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

hide-secrets

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

hide-secrets

for when you want to log objects, but hide certain restricted fields, e.g., passwords.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6K
decreased by-45.96%
Maintainers
1
Weekly downloads
 
Created
Source

hide-secrets

Build Status Coverage Status NPM version js-standard-style

var hide = require('hide-secrets')

var obj = {
  innerObject: {
    password: 'abc123',
    email: 'ben@npmjs.com',
    token: 'my-secret-token'
  },
  auth: '' // empty strings are left empty.
}

console.log(hide(obj))

outputs

{
  innerObject: {
    password: '[SECRET]',
    email: 'ben@npmjs.com',
    token: '[SECRET]'
  },
  auth: ''
}

Currently the following fields are obfuscated by default:

password, pass, token, auth, secret, passphrase.

If you want to override this list of obfuscated terms, simply:

  1. create your own list of terms:

    const badWords = [
      'super-secret-1', 'double-secret-probation'
    ]
    
  2. pass this as configuration to hide-secrets:

    console.log(hide(obj, {badWords}))
    

Any keys within obj that are contained within the badWords array will be hidden.

License

ISC

Keywords

FAQs

Package last updated on 17 Apr 2019

Did you know?

Socket

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.

Install

Related posts

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