@bearer/node-agent
Bearer Node Agent
Last updated a month ago by antoine.apizi .
MIT · Original npm · Tarball · package.json
$ cnpm install @bearer/node-agent 
SYNC missed versions from official npm registry.

@bearer/node-agent

Build Status

Installation

From a terminal, install the Bearer agent module and save it into your project:

npm install --save @bearer/node-agent
# or
yarn add @bearer/node-agent

Now, open your application main script (e.g. index.js or main.js) and initialize the Bearer agent at the top:

const Bearer = require('@bearer/node-agent')

await Bearer.init({ secretKey: 'YOUR_BEARER_SECRET_KEY' })

http.request(...)

Your Secret Key is available on the Bearer dashboard

The init function returns a promise which you can use to ensure Bearer is fully loaded before performing any HTTP requests.

Note: We strongly recommend to initialize the Bearer agent as early as possible. This ensures that all external HTTP requests performed from your application are monitored.

Now, you can start your application (e.g. node index.js). All API calls will be monitored and available on your Bearer dashboard.

For detailed configuration options check the Agent's configuration page.

Keeping your data protected

We recommend you sanitize your data before sending it to the Bearer dashboard. We think it's best to setup the sanitization level that best suits your needs. An example using the default values is as follows:

Bearer.init({
  stripSensitiveData: true,
  stripSensitiveKeys: /^authorization$|^client.id$|^access.token$|^client.secret$/i,
  stripSensitiveRegex: /[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*/
})

Configuration options explained

  • stripSensitiveData - Globally enable/disable data sanitization. It's enabled by default. If you set it to false no sanitization will take place, and all the data will be sent to the Bearer dashboard as-is.

  • stripsSensitiveKeys - List of key names regex patterns that will be applied to sanitize values in headers, query parameters or response body. If you specify "stripSensitiveKeys": "^authorization$" the following sanitization actions would take place:

    • In headers: "authorization" header value will be sanitized and would be sent to the Bearer dashboard as "authorization: [FILTERED]"
    • In query string parameters: "authorization" query parameter value will be sanitized, and in the Bearer dashboard your URL will look like: "http://www.example.com/auth?authorizaiton=[FILTERED]"
    • In application/json response body: Any value of "authorization" key in response payload will be replaced with "[FILTERED]" (e.g., { "name": "John", "authorization": "granted" } will be sent to the Bearer dashboard as { "name": "John", "authorization": "[FILTERED]" }
  • stripSensitiveRegex - A regular expression that will be used to sanitize any value in headers, query string parameters or response body. Bearer will check all the values sent in the request or response and will replace matching patterns with "[FILTERED]".

Development

Release a new version

Bump version

npm version path|minor|major

# push things
git push
git push --tags

Debugging

@bearer/node-agent uses debug, so just run with environmental variable DEBUG set to bearer:agent:*.

$ DEBUG=bearer:agent:* node app.js

Current Tags

  • 3.0.1-canary-3.0.1.0                                ...           canary (4 months ago)
  • 3.2.3                                ...           latest (8 days ago)
  • 2.1.0-pre2                                ...           next (6 months ago)

55 Versions

  • 3.2.2                                ...           14 days ago
  • 3.2.3                                ...           8 days ago
  • 3.2.1                                ...           a month ago
  • 3.2.0                                ...           a month ago
  • 3.1.3                                ...           2 months ago
  • 3.1.2                                ...           2 months ago
  • 3.1.1                                ...           3 months ago
  • 3.1.0                                ...           3 months ago
  • 3.0.1                                ...           4 months ago
  • 3.0.1-canary-3.0.1.0                                ...           4 months ago
  • 3.0.0                                ...           4 months ago
  • 3.0.0-rc                                ...           4 months ago
  • 3.0.0-canary-2020-04-09.0                                ...           4 months ago
  • 3.0.0-canary-2020-04-08-2.0                                ...           4 months ago
  • 3.0.0-canary-2020-04-08.0                                ...           4 months ago
  • 3.0.0-canary-2020-03-13.0                                ...           5 months ago
  • 3.0.0-canary-2020-03-10.0                                ...           5 months ago
  • 2.0.7                                ...           5 months ago
  • 2.0.6                                ...           5 months ago
  • 2.0.5                                ...           5 months ago
  • 3.0.0-canary-2020-03-02-3.0                                ...           5 months ago
  • 3.0.1-canary-2020-03-02-2.0                                ...           5 months ago
  • 2.1.0-canary-2020-03-02.0                                ...           5 months ago
  • 2.1.0-canary-2020-02-27-2.0                                ...           5 months ago
  • 2.1.0-canary-2020-02-19-5.0 [deprecated]           ...           6 months ago
  • 2.1.0-canary-2020-02-19-4.0 [deprecated]           ...           6 months ago
  • 2.1.0-canary-2020-02-19-1.0 [deprecated]           ...           6 months ago
  • 2.0.4                                ...           6 months ago
  • 2.1.0-pre3                                ...           6 months ago
  • 2.0.3                                ...           6 months ago
  • 2.0.2                                ...           6 months ago
  • 2.0.2-canary-2                                ...           6 months ago
  • 2.0.2-canary [deprecated]           ...           6 months ago
  • 2.1.0-pre2                                ...           6 months ago
  • 2.1.0-pre                                ...           6 months ago
  • 2.0.1                                ...           7 months ago
  • 2.0.0                                ...           7 months ago
  • 1.0.2                                ...           8 months ago
  • 1.0.1                                ...           8 months ago
  • 0.3.8                                ...           8 months ago
  • 0.3.7                                ...           8 months ago
  • 0.3.6                                ...           8 months ago
  • 0.3.5                                ...           8 months ago
  • 0.3.3                                ...           9 months ago
  • 0.3.2                                ...           9 months ago
  • 0.3.1                                ...           9 months ago
  • 0.2.2                                ...           9 months ago
  • 0.2.1                                ...           9 months ago
  • 0.2.0                                ...           9 months ago
  • 0.0.6                                ...           9 months ago
  • 0.0.5                                ...           9 months ago
  • 0.0.4                                ...           10 months ago
  • 0.0.3                                ...           10 months ago
  • 0.0.2                                ...           10 months ago
  • 0.0.1                                ...           10 months ago
Downloads
Today 0
This Week 0
This Month 54
Last Day 0
Last Week 54
Last Month 19
Dependencies (4)
Dev Dependencies (21)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |