Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: 24

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJson(needs.list-packages.outputs.matrix) }}
node-version: [ lts/*, 18, 20, 21, 22, 23, latest ]
node-version: [ 24, latest ]
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: 24

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build_and_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ runs:
id: pnpm-install
with:
run_install: true
version: 9.15.9

- name: Get pnpm store directory
id: pnpm-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: 24

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: 24

- uses: pnpm/action-setup@v4
name: Install pnpm
Expand Down
47 changes: 22 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
{
"name": "node-crowdsec-client-root",
"engines": {
"node": ">=18.12",
"pnpm": ">=9"
},
"license": "UNLICENSED",
"scripts": {
"generate:documentation": "typedoc"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^10.0.1",
"@tsconfig/node-lts": "24.0.0",
"@types/jest": "30.0.0",
"@types/node": "25.9.2",
"@typescript-eslint/parser": "8.60.1",
"eslint": "10.4.1",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-prettier": "5.5.6",
"prettier": "3.8.3",
"ts-jest": "^29.4.11",
"ts-node": "10.9.2",
"typedoc": "0.28.19",
"typescript": "6.0.3"
},
"name": "node-crowdsec-client-root",
"engines": {
"node": ">=24",
"pnpm": ">=9"
},
"license": "UNLICENSED",
"scripts": {
"generate:documentation": "typedoc"
},
"devDependencies": {
"@tsconfig/node-lts": "20.1.3",
"@types/jest": "29.5.14",
"@types/node": "22.7.6",
"@typescript-eslint/parser": "7.0.2",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"prettier": "3.2.5",
"ts-node": "10.9.2",
"typedoc": "0.26.10",
"typescript": "5.6.3"
},
"packageManager": "pnpm@9.15.9"
}
2 changes: 1 addition & 1 deletion packages/crowdsec-client-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"maxmind": "^5.0.6"
},
"engines": {
"node": ">=16"
"node": ">=24"
},
"devDependencies": {
"@jest/globals": "30.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/crowdsec-client-scenarios/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[![NPM](https://nodei.co/npm/crowdsec-client-scenarios.png)](https://nodei.co/npm/crowdsec-client-scenarios/)

This library is a Node.js client to talk with crowdsec rest API .
This library is a Node.js client to talk with crowdsec rest API . Please note that Node.js >= 24 is required.
# Start

install it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class HTTPEnricher extends EnricherScenario {
};

alert.events = alert.events.map((e) => ({ ...e, meta: mergeMetas(e.meta, metas) }));
alert.meta = mergeMetas(alert.meta, metas);

return alert;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ export class XForwardedForChecker extends CheckerScenario {
}

private generateAlert(
alert: Omit<APITypes.Alert, 'scenario_version' | 'scenario_hash' | 'capacity' | 'leakspeed' | 'simulated' | 'events' | 'source'> &
Partial<Pick<APITypes.Alert, 'events' | 'capacity' | 'leakspeed' | 'simulated' | 'source'>>,
alert: Omit<
APITypes.Alert,
'scenario_version' | 'scenario_hash' | 'capacity' | 'leakspeed' | 'simulated' | 'events' | 'source' | 'meta'
> &
Partial<Pick<APITypes.Alert, 'events' | 'capacity' | 'leakspeed' | 'simulated' | 'source' | 'meta'>>,
ip: string
): APITypes.Alert {
return {
Expand Down Expand Up @@ -128,6 +131,24 @@ export class XForwardedForChecker extends CheckerScenario {
timestamp: date
}
],
meta: [
{
key: 'http_forwarded_for',
value: headers[0]
},
{
key: 'http_forwarded_for_parsed',
value: ipResult.map(({ ip }) => ip).join(', ')
},
{
key: 'source_ip',
value: ipStr
},
{
key: 'timestamp',
value: date
}
],
events_count: 1,
message: `Ip ${ipStr} performed '${scenarioName}' (1 event) at ${date}`,
start_at: date,
Expand Down
2 changes: 1 addition & 1 deletion packages/crowdsec-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"debug": "^4.4.3"
},
"engines": {
"node": ">=18.12"
"node": ">=24"
},
"devDependencies": {
"@jest/globals": "30.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/crowdsec-http-middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"lru-cache": "^11.5.1"
},
"engines": {
"node": ">=16"
"node": ">=24"
},
"devDependencies": {
"@jest/globals": "30.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/crowdsec-http-middleware/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[![NPM](https://nodei.co/npm/crowdsec-http-middleware.png)](https://nodei.co/npm/crowdsec-http-middleware/)

This library is a Node.js client to talk with crowdsec rest API .
This library is a Node.js client to talk with crowdsec rest API . Please note that Node.js >= 24 is required.
## Start

install it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export class CrowdSecHTTPWatcherMiddleware extends CommonsMiddleware {
return;
}

this.logger.debug(`ip ${ip} triggers alerts on scenarios : ${enrichedAlerts.map(({ scenario }) => scenario).join(', ')}`);
this.logger.warn(`ip ${ip} triggers alerts on scenarios : ${enrichedAlerts.map(({ scenario }) => scenario).join(', ')}`);
this.logger.debug(`ip ${ip} triggers alerts: %j`, enrichedAlerts);

this.client.Alerts.pushAlerts(enrichedAlerts).catch((e) => console.error('fail to push alert', e));
} finally {
Expand Down
17 changes: 17 additions & 0 deletions patch_workflows_node24.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys
import glob

files = glob.glob(".github/workflows/*.yml")

for file_path in files:
with open(file_path, "r") as f:
content = f.read()

# Replace lts/* with 24
if "node-version: lts/*" in content:
content = content.replace("node-version: lts/*", "node-version: 24")
with open(file_path, "w") as f:
f.write(content)
print(f"Patched {file_path}")
else:
print(f"No match found in {file_path}")
14 changes: 14 additions & 0 deletions patch_workflows_node24_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys

file_path = ".github/workflows/CI.yml"
with open(file_path, "r") as f:
content = f.read()

search = "node-version: [ lts/*, 24, latest ]"
replace = "node-version: [ 24, latest ]"

if search in content:
content = content.replace(search, replace)
with open(file_path, "w") as f:
f.write(content)
print("Patch applied to matrix in CI.yml.")
Loading
Loading