From 3e4cf5de9d70b0d0853b3dce1b888f412fed9e85 Mon Sep 17 00:00:00 2001 From: imranalisyed506 <105209301+imranalisyed506@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:02:48 +0530 Subject: [PATCH 1/2] =?UTF-8?q?Remove=20request=20and=20request-promise-na?= =?UTF-8?q?tive=20api=20dependency=20and=20integrate=20axis=20lib=20change?= =?UTF-8?q?s=E2=80=A8Update=20the=20al-collector.js=20lib=20with=20latest?= =?UTF-8?q?=20version=203.0.9=20to=20fix=20axios=20changes.=20-alertlogic/?= =?UTF-8?q?al-collector-js#58=E2=80=A8Update=20collector=5Fstatus=5Fapi=20?= =?UTF-8?q?to=20old=20collectors=20to=20azcollect=5Fapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 1 + package.json | 18 ++++++++---------- test/al-cwe-collector_test.js | 9 ++++++++- test/cwe_mock.js | 1 + 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 1e5030e..a325854 100644 --- a/index.js +++ b/index.js @@ -164,6 +164,7 @@ exports.handler = function(event, context) { if (process.env.azollect_api && !process.env.azcollect_api) { process.env.collector_id = 'NA'; process.env.azcollect_api = process.env.azollect_api; + process.env.collector_status_api = process.env.azcollect_api; } const collector = new cweCollector( diff --git a/package.json b/package.json index 31c09bc..5244c87 100644 --- a/package.json +++ b/package.json @@ -21,26 +21,24 @@ } ], "devDependencies": { - "aws-sdk": "^2.929.0", + "aws-sdk": "^2.1434.0", "aws-sdk-mock": "^5.8.0", "clone": "^2.1.2", - "dotenv": "^16.0.3", - "jshint": "^2.9.5", + "dotenv": "^16.3.1", + "jshint": "^2.13.6", "mocha": "^10.2.0", "mocha-jenkins-reporter": "^0.4.8", "nyc": "^15.1.0", "rewire": "^6.0.0", - "sinon": "^15.0.1" + "sinon": "^15.2.0" }, "dependencies": { - "@alertlogic/al-aws-collector-js": "^4.1.14", - "@alertlogic/al-collector-js": "^3.0.5", + "@alertlogic/al-aws-collector-js": "4.1.20", + "@alertlogic/al-collector-js": "3.0.9", "async": "^3.2.4", "cfn-response": "^1.0.1", - "debug": "^4.1.1", - "moment": "^2.19.2", - "request": "^2.88.0", - "request-promise-native": "^1.0.7" + "debug": "^4.3.4", + "moment": "^2.29.4" }, "author": "Alert Logic Inc." } diff --git a/test/al-cwe-collector_test.js b/test/al-cwe-collector_test.js index 6fa1519..7ca3123 100644 --- a/test/al-cwe-collector_test.js +++ b/test/al-cwe-collector_test.js @@ -30,6 +30,11 @@ function setAlServiceStub() { azcollect: 'new-azcollect-endpoint' }; break; + case '/residency/default/services/collector_status/endpoint': + ret = { + collector_status: 'new-collectors-status-endpoint' + }; + break; default: break; } @@ -69,10 +74,12 @@ function mockSetEnvStub() { setEnvStub = sinon.stub(m_al_aws, 'setEnv').callsFake((vars, callback) => { const { ingest_api, - azcollect_api + azcollect_api, + collector_status_api } = vars; process.env.ingest_api = ingest_api ? ingest_api : process.env.ingest_api; process.env.azollect_api = azcollect_api ? azcollect_api : process.env.azollect_api; + process.env.collector_status_api = collector_status_api ? collector_status_api : process.env.collector_status_api; const returnBody = { Environment: { Varaibles: vars diff --git a/test/cwe_mock.js b/test/cwe_mock.js index d805122..9b6ed77 100644 --- a/test/cwe_mock.js +++ b/test/cwe_mock.js @@ -3,6 +3,7 @@ process.env.AWS_LAMBDA_FUNCTION_NAME = 'test-function-name'; process.env.al_api = 'api.global-services.global.alertlogic.com'; process.env.ingest_api = 'ingest.global-services.global.alertlogic.com'; process.env.azollect_api = 'azcollect.global-services.global.alertlogic.com'; +process.env.collector_status_api = 'azcollect.global-services.global.alertlogic.com'; process.env.collector_id = 'collector-id'; process.env.al_application_id = 'guardduty'; From 8f519628175ff3c15ca405586e339be1c108fbc2 Mon Sep 17 00:00:00 2001 From: imranalisyed506 <105209301+imranalisyed506@users.noreply.github.com> Date: Thu, 17 Aug 2023 18:06:57 +0530 Subject: [PATCH 2/2] Remove request and request-promise-native api dependency and integrate axios changes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5244c87..c97f627 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "al-cwe-collector", - "version": "1.3.18", + "version": "1.3.19", "license": "MIT", "description": "Alert Logic CloudWatch Events Collector", "repository": {