Skip to content

Commit 7a3d47c

Browse files
committed
Merge branch 'main' of github.com:AikidoSec/node-RASP into block-outbound
* 'main' of github.com:AikidoSec/node-RASP: (245 commits) Cleanup Dockerfile and .dockerignore Remove duplicate test case in imds.test.ts Fix detection of IMDS IPv4 addresses mapped to IPv6 Update .github/workflows/unit-test.yml Fix missing wasm in some tests Try to fix npm ci Skip build in unit tests if not necessary Cleanup devDependencies for linked library dep Use specific version for @aws-sdk/client-bedrock-runtime Fix was backported to v24 Fix lock files Don't add empty strings to the context Remove eslint Add React Router SSR ESM sample app Update esm docs Update comment Fix import Use path.sep instead of `/` Rename function to `extractPathStringsFromUserInputCached` Apply suggestion from @hansott ...
2 parents 19f00e9 + 6ca5f29 commit 7a3d47c

285 files changed

Lines changed: 30625 additions & 5301 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/benchmark.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
run: |
4747
sudo apt-get update
4848
sudo apt-get install -y wrk
49+
- name: Set up Rust
50+
run: |
51+
rustup toolchain install stable
52+
rustup default stable
53+
cargo install wasm-pack
4954
- run: npm install
5055
- run: npm run build
5156
- name: Run NoSQL Injection Benchmark

.github/workflows/build-and-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
node-version: "22.x"
3333
registry-url: "https://registry.npmjs.org"
3434
scope: "@aikidosec"
35+
- name: Set up Rust
36+
run: |
37+
rustup toolchain install stable
38+
rustup default stable
39+
cargo install wasm-pack
3540
- name: Setup Aikido safe-chain
3641
run: |
3742
npm i -g @aikidosec/safe-chain@1.0.24

.github/workflows/end-to-end-tests.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ jobs:
5151
strategy:
5252
fail-fast: false
5353
matrix:
54-
node-version: [18.x, 22.x]
54+
include:
55+
- node-version: 20.x
56+
mode: "old"
57+
- node-version: 22.x
58+
mode: "old"
59+
- node-version: 24.x
60+
mode: "new"
61+
- node-version: 25.x
62+
mode: "new"
5563
steps:
5664
- uses: actions/checkout@v5
5765
- name: Use Node.js ${{ matrix.node-version }}
@@ -64,12 +72,24 @@ jobs:
6472
run: |
6573
npm i -g @aikidosec/safe-chain@1.0.24
6674
safe-chain setup-ci
75+
- name: Downgrade npm for v25
76+
# https://github.com/npm/cli/issues/8669
77+
if: ${{ matrix.node-version == '25.x' }}
78+
run: npm i -g npm@11.6.0
6779
- name: Add local.aikido.io to /etc/hosts
6880
run: |
6981
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
7082
- name: Build and run server
7183
run: |
7284
cd end2end/server && docker build -t server . && docker run -d -p 5874:3000 server
85+
- name: Set up Rust
86+
run: |
87+
rustup toolchain install stable
88+
rustup default stable
89+
cargo install wasm-pack
7390
- run: npm install
7491
- run: npm run build
75-
- run: npm run end2end
92+
- if: matrix.mode == 'old'
93+
run: npm run end2end
94+
- if: matrix.mode == 'new'
95+
run: npm run end2end:new

.github/workflows/lint-code.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ jobs:
1717
node-version: ${{ matrix.node-version }}
1818
cache: "npm"
1919
cache-dependency-path: "**/package-lock.json"
20+
- name: Set up Rust
21+
run: |
22+
rustup toolchain install stable
23+
rustup default stable
24+
rustup component add rustfmt clippy
25+
cargo install wasm-pack
2026
- name: Setup Aikido safe-chain
2127
run: |
2228
npm i -g @aikidosec/safe-chain@1.0.24
2329
safe-chain setup-ci
2430
- run: npm run install-lib-only
2531
- run: npm run build
2632
- run: npm run lint
33+
- name: Check Rust formatting
34+
run: cd instrumentation-wasm && cargo fmt --check
35+
- name: Run Rust Linter
36+
run: cd instrumentation-wasm && cargo clippy

.github/workflows/qa-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
npm i -g @aikidosec/safe-chain@1.0.24
3333
safe-chain setup-ci
3434
35+
- name: Set up Rust
36+
run: |
37+
rustup toolchain install stable
38+
rustup default stable
39+
cargo install wasm-pack
40+
3541
- name: Build firewall-node dev package
3642
run: |
3743
cd firewall-node

.github/workflows/unit-test.yml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,38 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
node-version: [16.x, 18.x, 20.x, 22.x, 24.x, 25.x]
14-
timeout-minutes: 10
13+
include:
14+
- node-version: 16.x
15+
instrumentation: "current"
16+
mode: "cjs"
17+
- node-version: 18.x
18+
new-instrumentation: "current"
19+
mode: "cjs"
20+
- node-version: 20.x
21+
new-instrumentation: "current"
22+
mode: "cjs"
23+
- node-version: 22.x
24+
new-instrumentation: "current"
25+
mode: "cjs"
26+
- node-version: 24.x
27+
new-instrumentation: "current"
28+
mode: "cjs"
29+
- node-version: 24.x
30+
new-instrumentation: "new"
31+
mode: "cjs"
32+
- node-version: 24.x
33+
new-instrumentation: "new"
34+
mode: "esm"
35+
- node-version: 25.x
36+
new-instrumentation: "current"
37+
mode: "cjs"
38+
- node-version: 25.x
39+
new-instrumentation: "new"
40+
mode: "cjs"
41+
- node-version: 25.x
42+
new-instrumentation: "new"
43+
mode: "esm"
44+
timeout-minutes: 15
1545
steps:
1646
- uses: actions/checkout@v5
1747
- name: Use Node.js ${{ matrix.node-version }}
@@ -24,20 +54,39 @@ jobs:
2454
run: |
2555
npm i -g @aikidosec/safe-chain@1.0.24
2656
safe-chain setup-ci
57+
- name: Downgrade npm for v25
58+
# https://github.com/npm/cli/issues/8669
59+
if: ${{ matrix.node-version == '25.x' }}
60+
run: npm i -g npm@11.6.0
2761
- name: Add local.aikido.io to /etc/hosts
2862
run: |
2963
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
64+
- name: Set up Rust
65+
run: |
66+
rustup toolchain install stable
67+
rustup default stable
68+
cargo install wasm-pack
3069
- run: npm run install-lib-only
3170
- name: Start containers
3271
run: npm run containers
33-
- run: npm run build
72+
- name: Prepare WASM components
73+
# When running tests with tap (CJS), we don't need to build our lib, just need the WASM files
74+
run: npm run build -- --only-wasm
75+
if: ${{ matrix.mode != 'esm' }}
76+
- name: Build complete library
77+
run: npm run build
78+
if: ${{ matrix.new-instrumentation == 'new' && matrix.mode == 'esm' }}
3479
- run: npm run test:ci
35-
env:
36-
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
80+
if: ${{ matrix.new-instrumentation == 'current' }}
81+
- run: npm run test:ci:new
82+
if: ${{ matrix.new-instrumentation == 'new' && matrix.mode == 'cjs' }}
83+
- name: Run tests in ESM mode
84+
run: npm run test:esm
85+
if: ${{ matrix.new-instrumentation == 'new' && matrix.mode == 'esm' }}
3786
- name: "Upload coverage"
3887
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5
3988
with:
40-
files: ./library/.tap/report/lcov.info
89+
files: ./library/.tap/report/lcov.info,./.esm-tests/tests/lcov.info
4190
env:
4291
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4392
slug: AikidoSec/firewall-node

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ library/test2.txt
3333

3434
# Rust build files
3535
instrumentation-wasm/target/
36+
37+
# Temp esm test directory
38+
.esm-tests/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.12
1+
24.3.0

benchmarks/express/package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/hono-pg/package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)