|
1 | | -# SecureNative Node SDK |
| 1 | +<p align="center"> |
| 2 | + <a href="https://www.securenative.com"><img src="https://user-images.githubusercontent.com/45174009/77826512-f023ed80-7120-11ea-80e0-58aacde0a84e.png" alt="SecureNative Logo"/></a> |
| 3 | +</p> |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <b>A Cloud-Native Security Monitoring and Protection for Modern Applications</b> |
| 7 | +</p> |
| 8 | +<p align="center"> |
| 9 | + <a href="https://github.com/securenative/securenative-node"> |
| 10 | + <img alt="Github Actions" src="https://github.com/securenative/securenative-node/workflows/Build/badge.svg"> |
| 11 | + </a> |
| 12 | + <a href="https://codecov.io/gh/securenative/securenative-node"> |
| 13 | + <img src="https://codecov.io/gh/securenative/securenative-node/branch/master/graph/badge.svg" /> |
| 14 | + </a> |
| 15 | + <a href="https://badge.fury.io/js/%40securenative%2Fsdk"><img src="https://badge.fury.io/js/%40securenative%2Fsdk.svg" alt="npm version" height="20"></a> |
| 16 | +</p> |
| 17 | +<p align="center"> |
| 18 | + <a href="https://docs.securenative.com">Documentation</a> | |
| 19 | + <a href="https://docs.securenative.com/quick-start">Quick Start</a> | |
| 20 | + <a href="https://blog.securenative.com">Blog</a> | |
| 21 | + <a href="">Chat with us on Slack!</a> |
| 22 | +</p> |
| 23 | +<hr/> |
| 24 | + |
| 25 | +SecureNative Node.JS agent provides application security monitoring and protection from OWASP TOP 10 security threats at run-time through dynamic instrumentation of business logic and user behaviour. |
| 26 | + |
| 27 | +SecureNative monitors and protects applications from common security threats such as: |
| 28 | + |
| 29 | +- Bad bots |
| 30 | +- 3rd party packages vulnerabilities |
| 31 | +- SQL/NoSQL injections |
| 32 | +- XSS attacks |
| 33 | +- Massive security scans |
| 34 | +- Raise of HTTP errors (40X, 50X) |
| 35 | +- Anomaly Usage |
| 36 | +- Content Scrapping |
| 37 | +- Adaptive Authentication, prevent ATO (Account Takeover) |
2 | 38 |
|
3 | 39 | ## Installation |
4 | 40 |
|
5 | | -Add the `@securenative/sdk` package to your `package.json`. |
| 41 | +Please create free account at [register](https://console.securenative.com/register) to get api key. |
| 42 | + |
| 43 | +Install SecureNative agent: |
6 | 44 |
|
7 | 45 | ```bash |
8 | | -npm i @securenative/sdk |
| 46 | +npm i @securenative/agent |
9 | 47 | ``` |
10 | 48 |
|
11 | | -## Configuration |
12 | | - |
13 | | -```js |
14 | | -import { SecureNative } from '@securenative/sdk'; |
| 49 | +Verify that `@securenative/agent` appears in your package to your `package.json`. |
15 | 50 |
|
16 | | -const secureNative = new SecureNative({ apiKey: 'YOUR_API_KEY' }); |
| 51 | +```shell script |
| 52 | +cat > securenative.json <<EOF |
| 53 | +{ |
| 54 | + "SECURENATIVE_APP_NAME": "YOUR_APPLICATION_NAME", |
| 55 | + "SECURENATIVE_API_KEY": "YOUR_API_KEY" |
| 56 | +} |
| 57 | +EOF |
17 | 58 | ``` |
18 | 59 |
|
19 | | -| Option | Type | Optional | Default Value | Description | |
20 | | -| -------| -------| -------| -------| -------------------------------------------------| |
21 | | -| apiKey | string | false | none | SecureNative api key | |
22 | | -| apiUrl | string | true | https://api.securenative.com/v1/collector | Default api base address| |
23 | | -| interval| number | true | 1000 | Default interval for SDK to try to persist events| |
24 | | -| maxEvents | number | true | 1000 | Max in-memory events queue| |
25 | | -| timeout | number | true | 1500 | API call timeout in ms| |
26 | | -| autoSend | Boolean | true | true | Should api auto send the events| |
27 | | -| debugMode | Boolean | true | false | Displays logging to standard output| |
28 | | - |
29 | | -## Event tracking |
| 60 | +Add SecureNative as first dependency to your main module |
30 | 61 |
|
31 | 62 | ```js |
32 | | -import { SecureNative, EventTypes } from '@securenative/sdk'; |
33 | | -or |
34 | | -const { SecureNative, EventTypes } = require('@securenative/sdk'); // if your using ES5 |
35 | | - |
36 | | -const secureNative = new SecureNative('YOUR_API_KEY', { // optionally pass params here }); |
37 | | - |
38 | | -secureNative.track({ |
39 | | - eventType: EventTypes.LOG_IN, |
40 | | - ip: '127.0.0.1', |
41 | | - userAgent: 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405', |
42 | | - user: { |
43 | | - id: '12345' |
44 | | - } |
45 | | -}, req); |
| 63 | +require('securenative'); |
46 | 64 | ``` |
47 | 65 |
|
48 | | -## WebHook |
| 66 | +## Configuration |
49 | 67 |
|
50 | | -Use ```verifyWebhook``` middleware to ensure that webhook is comming from SecureNative |
| 68 | +| Option | Type | Optional | Default Value | Description | |
| 69 | +| ------------------------------- | ------- | -------- | ----------------------------------------- | ------------------------------------------------- | |
| 70 | +| SECURENATIVE_API_KEY | string | false | none | SecureNative api key | |
| 71 | +| SECURENATIVE_APP_NAME | string | false | package.json | Name of application source | |
| 72 | +| SECURENATIVE_API_URL | string | true | https://api.securenative.com/v1/collector | Default api base address | |
| 73 | +| SECURENATIVE_INTERVAL | number | true | 1000 | Default interval for SDK to try to persist events | |
| 74 | +| SECURENATIVE_HEARTBEAT_INTERVAL | number | true | 1000 | Default agent hearbeat interval | |
| 75 | +| SECURENATIVE_MAX_EVENTS | number | true | 1000 | Max in-memory events queue | |
| 76 | +| SECURENATIVE_TIMEOUT | number | true | 1500 | API call timeout in ms | |
| 77 | +| SECURENATIVE_AUTO_SEND | Boolean | true | true | Should api auto send the events | |
| 78 | +| SECURENATIVE_DISABLE | Boolean | true | true | Allow to disable agent functionality | |
| 79 | +| SECURENATIVE_DEBUG_MODE | Boolean | true | false | Displays debug info to stdout | |
51 | 80 |
|
52 | | -```js |
53 | | -app.post("/securewebhook", securenative.middleware.verifyWebhook, (req, res) => { |
| 81 | +## Compatibility |
54 | 82 |
|
55 | | -} |
56 | | -``` |
| 83 | +This agent is compatible with Node.js 8 and higher. |
| 84 | + |
| 85 | +For other compatibility related information, please visit [the compatibility page](https://docs.securenative.com/nodejs/compatibility/). |
| 86 | + |
| 87 | +## Documentation |
| 88 | + |
| 89 | +For more details, please visit documentation page, available on [docs.securenative.com](https://docs.securenative.com/agent/nodejs). |
0 commit comments