From b827e02a1d12b4d0178a2320034432ed192697b2 Mon Sep 17 00:00:00 2001 From: Igor Unanua Date: Wed, 16 Oct 2024 14:57:28 +0200 Subject: [PATCH 1/2] Enable Test_Blocking_request_body_multipart --- manifests/nodejs.yml | 4 +++- utils/build/docker/nodejs/express4-typescript/app.ts | 8 ++++++++ .../build/docker/nodejs/express4-typescript/package.json | 1 + utils/build/docker/nodejs/express4/app.js | 7 +++++++ utils/build/docker/nodejs/express4/package.json | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/manifests/nodejs.yml b/manifests/nodejs.yml index 15d67c4c94..bd7585878c 100644 --- a/manifests/nodejs.yml +++ b/manifests/nodejs.yml @@ -369,7 +369,9 @@ tests/: Test_Blocking_request_body: '*': *ref_3_19_0 nextjs: missing_feature - Test_Blocking_request_body_multipart: missing_feature + Test_Blocking_request_body_multipart: + '*': *ref_5_24_0 + nextjs: missing_feature Test_Blocking_request_cookies: '*': *ref_4_16_0 nextjs: missing_feature diff --git a/utils/build/docker/nodejs/express4-typescript/app.ts b/utils/build/docker/nodejs/express4-typescript/app.ts index 6bba0493f8..0bd645c3ea 100644 --- a/utils/build/docker/nodejs/express4-typescript/app.ts +++ b/utils/build/docker/nodejs/express4-typescript/app.ts @@ -11,6 +11,9 @@ const passport = require('passport') const { Kafka } = require("kafkajs") const { spawnSync } = require('child_process'); +const multer = require('multer') +const uploadToMemory = multer({ storage: multer.memoryStorage(), limits: { fileSize: 200000 } }) + const iast = require('./iast') iast.initData().catch(() => {}) @@ -40,6 +43,11 @@ app.get('/healthcheck', (req: Request, res: Response) => { }); }) +app.post('/waf', uploadToMemory.single('foo'), (req: Request, res: Response) => { + res.send('Hello\n') +}) + + app.all(['/waf', '/waf/*'], (req: Request, res: Response) => { res.send('Hello\n'); }); diff --git a/utils/build/docker/nodejs/express4-typescript/package.json b/utils/build/docker/nodejs/express4-typescript/package.json index 4802ffbd40..e94372a4b6 100644 --- a/utils/build/docker/nodejs/express4-typescript/package.json +++ b/utils/build/docker/nodejs/express4-typescript/package.json @@ -25,6 +25,7 @@ "kafkajs": "^2.2.4", "ldapjs": "2.0.0", "mongodb": "^6.1.0", + "multer": "^1.4.5-lts.1", "passport": "^0.6.0", "passport-http": "^0.3.0", "passport-local": "^1.0.0", diff --git a/utils/build/docker/nodejs/express4/app.js b/utils/build/docker/nodejs/express4/app.js index b4a9b0d037..abe7cd4577 100644 --- a/utils/build/docker/nodejs/express4/app.js +++ b/utils/build/docker/nodejs/express4/app.js @@ -19,6 +19,9 @@ const pgsql = require('./integrations/db/postgres') const mysql = require('./integrations/db/mysql') const mssql = require('./integrations/db/mssql') +const multer = require('multer') +const uploadToMemory = multer({ storage: multer.memoryStorage(), limits: { fileSize: 200000 } }) + const { kinesisProduce, kinesisConsume } = require('./integrations/messaging/aws/kinesis') const { snsPublish, snsConsume } = require('./integrations/messaging/aws/sns') const { sqsProduce, sqsConsume } = require('./integrations/messaging/aws/sqs') @@ -48,6 +51,10 @@ app.get('/healthcheck', (req, res) => { }) }) +app.post('/waf', uploadToMemory.single('foo'), (req, res) => { + res.send('Hello\n') +}) + app.all(['/waf', '/waf/*'], (req, res) => { res.send('Hello\n') }) diff --git a/utils/build/docker/nodejs/express4/package.json b/utils/build/docker/nodejs/express4/package.json index d8ec1bcea6..e08485ad60 100644 --- a/utils/build/docker/nodejs/express4/package.json +++ b/utils/build/docker/nodejs/express4/package.json @@ -25,6 +25,7 @@ "ldapjs": "2.0.0", "mongodb": "^6.1.0", "mssql": "^9.1.0", + "multer": "^1.4.5-lts.1", "mysql2": "^3.5.0", "passport": "^0.6.0", "passport-http": "^0.3.0", From f6eccb4abdcb12cf49893edb112c18f5b720b0cc Mon Sep 17 00:00:00 2001 From: Igor Unanua Date: Thu, 17 Oct 2024 16:08:51 +0200 Subject: [PATCH 2/2] Change supported version --- manifests/nodejs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/nodejs.yml b/manifests/nodejs.yml index bd7585878c..16bbe5a380 100644 --- a/manifests/nodejs.yml +++ b/manifests/nodejs.yml @@ -37,6 +37,7 @@ refs: - &ref_5_22_0 '>=5.22.0 || ^4.46.0' - &ref_5_23_0 '>=5.23.0 || ^4.47.0' - &ref_5_24_0 '>=5.24.0 || ^4.48.0' + - &ref_5_25_0 '>=5.25.0 || ^4.49.0' tests/: apm_tracing_e2e/: @@ -370,7 +371,7 @@ tests/: '*': *ref_3_19_0 nextjs: missing_feature Test_Blocking_request_body_multipart: - '*': *ref_5_24_0 + '*': *ref_5_25_0 nextjs: missing_feature Test_Blocking_request_cookies: '*': *ref_4_16_0