Socket
Socket
Sign inDemoInstall

is-secret

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-secret

A distributed maintained collection of patterns that indicate that something probably is secret


Version published
Weekly downloads
30K
increased by0.79%
Maintainers
1
Weekly downloads
 
Created
Source

is-secret

A distributed maintained collection of patterns that indicate that something probably is secret.

This is useful if you want to filter sensitive values in a data set.

This module uses a very simple algorithm that will not catch everthing. Use at your own risk.

npm Build status js-standard-style

Installation

npm install is-secret --save

Usage

var isSecret = require('is-secret')

var data = {
  username: 'watson',
  password: 'f8bY2fg8',
  card: '1234 1234 1234 1234' // credit card number
}

Object.keys(data).forEach(function (key) {
  if (isSecret.key(key) ||
      isSecret.value(data[key])) data[key] = '********'
})

console.log(data)
// {
//   username: 'watson',
//   password: '********',
//   card: '********'
// }

If you need functionality similar to what is shown in this example, I suggest you take a look at the redact-secrets module.

API

secret.key(string)

Validates the given string against a list of key names known to typically indicate secret data.

Returns true if the string is considered secret. Otherwise false.

secret.value(string)

Validates the given string against a list of patterns that indicates secret data.

Returns true if the string is considered secret. Otherwise false.

License

MIT

Keywords

FAQs

Package last updated on 27 Oct 2018

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