Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/runkitdev/babel-plugin-secure-syntax
security plugin for babel that checks for accidental API keys in your source code
https://github.com/runkitdev/babel-plugin-secure-syntax
babel babel-plugin
Last synced: 2 months ago
JSON representation
security plugin for babel that checks for accidental API keys in your source code
- Host: GitHub
- URL: https://github.com/runkitdev/babel-plugin-secure-syntax
- Owner: runkitdev
- License: mit
- Created: 2018-02-09T21:22:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T00:42:26.000Z (about 2 years ago)
- Last Synced: 2024-09-13T15:30:26.423Z (4 months ago)
- Topics: babel, babel-plugin
- Language: JavaScript
- Homepage: https://runkit.com/open-source
- Size: 442 KB
- Stars: 2
- Watchers: 6
- Forks: 4
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Secure Syntax
This is a [Babel](https://github.com/babel/babel) plugin for throwing a class of `SyntaxErrors` when API keys are detected in your source code. When you write API keys in-line, you become subject to [unnecessary risks](https://www.quora.com/My-AWS-account-was-hacked-and-I-have-a-50-000-bill-how-can-I-reduce-the-amount-I-need-to-pay) that occur from accidentally leaking your secrets to the world.
## Installation
Install using npm or Yarn by adding `babel-plugin-secure-syntax` as a dev dependency to your project:
Using npm:
```
npm install --save-dev babel-plugin-secure-syntax
```Using Yarn:
```
yarn add --dev babel-plugin-secure-syntax
```This will add `babel-plugin-secure-syntax` to your `package.json` for use in development, but won't classify this plugin as a dependency if someone were to `npm install` your package.
## Prerequisites
* `babel`: 6.x.x
## Usage
### `.babelrc`
The easiest way to use `babel-plugin-secure-syntax` is by adding it to your [`.babelrc` file](https://babeljs.io/docs/usage/babelrc/).
Find the `"plugins"` key in your `.babelrc` and add `"secure-syntax"` to the list of plugins:
```
{
...
"plugins": "secure-syntax"
}
```### Babel Transform
If you're running Babel transforms in your application code using `babel.transform()`, simply require the plugin and add it to the plugins array:
```
const SecureSyntax = require("babel-plugin-secure-syntax");
const transform = (source) => babel.transform(source, { plugins: [SecureSyntax] });
```## Contributing
Helping others find in-line API keys in their source code is the point of this plugin, so please [open a PR](https://github.com/runkitdev/babel-plugin-secure-syntax/pulls) to add any missing API key regular expressions.
## Help
This package is maintained by the [RunKit team](https://runkit.com). Please feel free to file an [issue](https://github.com/runkitdev/babel-plugin-secure-syntax/issues) or reach out to us at [email protected].