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

eslint-plugin-no-secrets

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-secrets

An eslint plugin to find strings that might be secrets/passwords

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
89K
increased by8.39%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-no-secrets

An eslint rule that searches for potential secrets/keys in code.

Usage

npm i -D eslint-plugin-no-secrets

.eslintrc

{
   "plugins":["no-secrets"],
   "rules":{
       "no-secrets/no-secrets":"error"
   }
}

Decrease the tolerance for entropy

{
   "plugins":["no-secrets"],
   "rules":{
       "no-secrets/no-secrets":["error",{"tolerance":3.2}]
   }
}

Add additional patterns to check for certain token formats.
Standard patterns can be found here

{
 "plugins": ["no-secrets"],
 "rules": {
   "no-secrets/no-secrets": [
     "error",
     { "additionalRegexes": { "Basic Auth": "Authorization: Basic [A-Za-z0-9+/=]*" } }
   ]
 }
}

When it's really not a secret

Then disable it with

// Set of potential base64 characters
// eslint-disable-next-line no-secrets/no-secrets
const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

This will tell future maintainers of the codebase that this suspicious string isn't an oversight

Options

OptionDescriptionDefaultType
toleranceMaximum "randomness"/entropy allowed4number
additionalRegexesObject of additional patterns to check. Key is check name and value is corresponding pattern{}`{[regexCheckName:string]:string

Acknowledgements

Huge thanks to truffleHog for the inspiration, the regexes, and the measure of entropy.

Keywords

FAQs

Package last updated on 29 Mar 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