Skip to content

Commit 699f2a3

Browse files
authored
Merge pull request #15 from securenative/dev
Merging new structure
2 parents b39a8a1 + 3b802fc commit 699f2a3

90 files changed

Lines changed: 12006 additions & 3907 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
- dev-*
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Notify slack success
15+
if: success()
16+
id: slack # IMPORTANT: reference this step ID value in future Slack steps
17+
env:
18+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
19+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
20+
with:
21+
channel: github-actions
22+
status: STARTING
23+
color: warning
24+
25+
- name: Checkout Code
26+
uses: actions/checkout@v1
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: 12.9.0
32+
registry-url: https://registry.npmjs.org/
33+
- name: Install Dependencies
34+
run: npm ci
35+
36+
- name: Run Build
37+
run: npm run build
38+
39+
- name: Run Tests
40+
run: npm test
41+
42+
- name: Run Coverage
43+
run: npm run coverage
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v1
47+
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
flags: unittests
50+
name: codecov-umbrella
51+
fail_ci_if_error: true
52+
53+
- name: Notify slack success
54+
if: success()
55+
env:
56+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
57+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
58+
with:
59+
message_id: ${{ steps.slack.outputs.message_id }}
60+
channel: github-actions
61+
status: SUCCESS
62+
color: good
63+
64+
- name: Notify slack fail
65+
if: failure()
66+
env:
67+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
68+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
69+
with:
70+
message_id: ${{ steps.slack.outputs.message_id }}
71+
channel: github-actions
72+
status: FAILED
73+
color: danger

.github/workflows/ci.yml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- dev
8-
- dev-*
94
pull_request:
105
branches:
116
- master
@@ -16,14 +11,49 @@ jobs:
1611
ci:
1712
runs-on: ubuntu-latest
1813
steps:
14+
- name: Notify slack success
15+
if: success()
16+
id: slack # IMPORTANT: reference this step ID value in future Slack steps
17+
env:
18+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
19+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
20+
with:
21+
channel: github-actions
22+
status: STARTING
23+
color: warning
24+
1925
- name: Checkout Code
2026
uses: actions/checkout@v1
27+
2128
- name: Setup Node.js
2229
uses: actions/setup-node@v1
2330
with:
24-
node-version: 12
31+
node-version: 12.9.0
2532
registry-url: https://registry.npmjs.org/
2633
- name: Install Dependencies
2734
run: npm ci
35+
2836
- name: Run Tests
2937
run: npm test
38+
39+
- name: Notify slack success
40+
if: success()
41+
env:
42+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
43+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
44+
with:
45+
message_id: ${{ steps.slack.outputs.message_id }}
46+
channel: github-actions
47+
status: SUCCESS
48+
color: good
49+
50+
- name: Notify slack fail
51+
if: failure()
52+
env:
53+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
54+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
55+
with:
56+
message_id: ${{ steps.slack.outputs.message_id }}
57+
channel: github-actions
58+
status: FAILED
59+
color: danger

.github/workflows/publish.yml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,51 @@ jobs:
88
release:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Notify Starting
12+
if: success()
13+
id: slack # IMPORTANT: reference this step ID value in future Slack steps
14+
env:
15+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
16+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
17+
with:
18+
channel: github-actions
19+
status: STARTING
20+
color: warning
1121
- name: Checkout Code
1222
uses: actions/checkout@v1
1323
- name: Setup Node.js
1424
uses: actions/setup-node@v1
1525
with:
16-
node-version: 12
26+
node-version: 12.9.0
1727
registry-url: https://registry.npmjs.org/
1828
- name: Install Dependencies
19-
run: npm install
29+
run: npm install
2030
- name: Run Tests
21-
run: npm test
31+
run: npm test
2232
- name: Run Build
23-
run: npm run build
33+
run: npm run build
2434
- name: Publish
25-
run: npm publish --access public
26-
env:
35+
run: npm publish --access public
36+
env:
2737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2838
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
- name: Notify slack success
40+
if: success()
41+
env:
42+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
43+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
44+
with:
45+
message_id: ${{ steps.slack.outputs.message_id }}
46+
channel: github-actions
47+
status: SUCCESS
48+
color: good
49+
- name: Notify slack fail
50+
if: failure()
51+
env:
52+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
53+
uses: voxmedia/github-action-slack-notify-build@v1.1.1
54+
with:
55+
message_id: ${{ steps.slack.outputs.message_id }}
56+
channel: github-actions
57+
status: FAILED
58+
color: danger

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ launch.json
1919
node_modules/
2020
dist/
2121
coverage/
22-
22+
.nyc_output/
2323
.idea

.prettierrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"$schema": "http://json.schemastore.org/prettierrc",
33
"singleQuote": true,
4+
"tabWidth": 2,
45
"trailingComma": "es5",
5-
"printWidth": 80
6-
}
6+
"printWidth": 150
7+
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#### 1.8.8 (2020-03-28)
2+
3+
##### Other Changes
4+
5+
* securenative/securenative-node into dev (9cbd572d)
6+
* securenative/securenative-node (6221bb68)
7+

README.md

Lines changed: 72 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,89 @@
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)
238

339
## Installation
440

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:
644

745
```bash
8-
npm i @securenative/sdk
46+
npm i @securenative/agent
947
```
1048

11-
## Configuration
12-
13-
```js
14-
import { SecureNative } from '@securenative/sdk';
49+
Verify that `@securenative/agent` appears in your package to your `package.json`.
1550

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
1758
```
1859

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
3061

3162
```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');
4664
```
4765

48-
## WebHook
66+
## Configuration
4967

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 |
5180

52-
```js
53-
app.post("/securewebhook", securenative.middleware.verifyWebhook, (req, res) => {
81+
## Compatibility
5482

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

Comments
 (0)