@newrelic/security-agent 0.6.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/LICENSE +20 -25
- package/README.md +13 -1
- package/THIRD_PARTY_NOTICES.md +1 -211
- package/lib/instrumentation-security/core/constants.js +1 -1
- package/lib/instrumentation-security/core/event-constants.js +1 -1
- package/lib/instrumentation-security/core/request-manager.js +1 -1
- package/lib/instrumentation-security/core/route-manager.js +1 -1
- package/lib/instrumentation-security/core/sec-trace.js +1 -1
- package/lib/instrumentation-security/core/sec-utils.js +1 -1
- package/lib/instrumentation-security/core/security-metadata.js +1 -1
- package/lib/instrumentation-security/core/stack-trace.js +1 -1
- package/lib/instrumentation-security/hooks/@nestjs/nr-nestjs-core.js +1 -1
- package/lib/instrumentation-security/hooks/director/nr-director.js +1 -1
- package/lib/instrumentation-security/hooks/express/nr-express.js +1 -1
- package/lib/instrumentation-security/hooks/fastify/nr-fastify.js +1 -1
- package/lib/instrumentation-security/hooks/fs/nr-fs.js +40 -9
- package/lib/instrumentation-security/hooks/hapi/nr-hapi.js +1 -1
- package/lib/instrumentation-security/hooks/http/nr-http.js +68 -4
- package/lib/instrumentation-security/hooks/koa/@koa/nr-@koa-router.js +1 -1
- package/lib/instrumentation-security/hooks/ldap/nr-ldap.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/common.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/constants.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/nr-mongodb.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/v2-mongo.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/v3-mongo.js +1 -1
- package/lib/instrumentation-security/hooks/mongodb/v4-mongo.js +1 -1
- package/lib/instrumentation-security/hooks/mysql/nr-mysql.js +1 -1
- package/lib/instrumentation-security/hooks/native/nr-childProcess.js +1 -1
- package/lib/instrumentation-security/hooks/postgres/nr-postgres.js +1 -1
- package/lib/instrumentation-security/hooks/require/nr-require.js +4 -3
- package/lib/instrumentation-security/hooks/restify/nr-restify.js +1 -1
- package/lib/instrumentation-security/hooks/xpath/nr-xpath.js +1 -1
- package/lib/instrumentation-security/index.js +1 -1
- package/lib/nr-security-agent/index.js +1 -1
- package/lib/nr-security-agent/lib/core/Auth-headers.js +1 -1
- package/lib/nr-security-agent/lib/core/ContainerProperties.js +1 -1
- package/lib/nr-security-agent/lib/core/ECSProperties.js +1 -1
- package/lib/nr-security-agent/lib/core/FuzzFailEvent.js +1 -1
- package/lib/nr-security-agent/lib/core/LinkingMetadata.js +1 -1
- package/lib/nr-security-agent/lib/core/LogMessage.js +4 -3
- package/lib/nr-security-agent/lib/core/PodProperties.js +1 -1
- package/lib/nr-security-agent/lib/core/Policy.js +1 -1
- package/lib/nr-security-agent/lib/core/agent-status.js +1 -1
- package/lib/nr-security-agent/lib/core/agent.js +1 -1
- package/lib/nr-security-agent/lib/core/applicationinfo.js +1 -1
- package/lib/nr-security-agent/lib/core/commonUtils.js +8 -1
- package/lib/nr-security-agent/lib/core/connections/aws-lambda-client.js +7 -9
- package/lib/nr-security-agent/lib/core/connections/restclient.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/index.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/IASTUtils.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/collecotor-policy-error-handler.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/collector-policy-handler.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js +2 -2
- package/lib/nr-security-agent/lib/core/connections/websocket/response/iast-cool-down.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/iast-record-deletion.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/index.js +2 -2
- package/lib/nr-security-agent/lib/core/connections/websocket/response/no-op-handler.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/startup-handshake-handler.js +4 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/unsupported-agent-handler.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/response/ws-reconnect.js +1 -1
- package/lib/nr-security-agent/lib/core/connections/websocket/websocket.js +1 -1
- package/lib/nr-security-agent/lib/core/event-stats.js +1 -1
- package/lib/nr-security-agent/lib/core/event.js +7 -2
- package/lib/nr-security-agent/lib/core/health-check.js +1 -1
- package/lib/nr-security-agent/lib/core/json-file-handler.js +1 -1
- package/lib/nr-security-agent/lib/core/jsonValidator.js +1 -1
- package/lib/nr-security-agent/lib/core/lambda-delegated-task-service.js +1 -1
- package/lib/nr-security-agent/lib/core/logging.js +1 -1
- package/lib/nr-security-agent/lib/core/sec-agent-constants.js +1 -1
- package/lib/nr-security-agent/lib/core/sec-util.js +1 -1
- package/lib/nr-security-agent/lib/core/sha-size-util.js +1 -1
- package/lib/nr-security-agent/lib/core/sha_worker.js +1 -1
- package/lib/nr-security-agent/lib/core/startup-config.js +1 -1
- package/lib/nr-security-agent/lib/core/statusUtils.js +5 -2
- package/lib/nr-security-agent/lib/core/timeunit.js +1 -1
- package/lib/nr-security-agent/lib/core/websocket-client.js +11 -1
- package/lib/nr-security-agent/lib/core/xss-utils.js +1 -1
- package/lib/nr-security-agent/lib/models/lambda-delegated-task/constants.js +1 -1
- package/lib/nr-security-agent/lib/models/lambda-delegated-task/index.js +1 -1
- package/lib/nr-security-agent/lib/models/lambda-delegated-task/lambda-delegated-sha-calculation.js +1 -1
- package/lib/nr-security-agent/lib/models/lambda-delegated-task/lambda-delegated-task-base.js +1 -1
- package/lib/nr-security-agent/lib/models/lambda-delegated-task/lambda-delegated-task-type.js +1 -1
- package/lib/nr-security-agent/resources/config.js +1 -1
- package/lib/nr-security-api/index.js +1 -1
- package/package.json +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: New Relic
|
|
3
|
+
* SPDX-License-Identifier: New Relic Software License v1.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -24,7 +24,12 @@ function BasicInfo() {
|
|
|
24
24
|
this.jsonVersion = AGENT_VERSION;
|
|
25
25
|
this.collectorType = COLLECTOR_TYPE;
|
|
26
26
|
this.language = LANGUAGE;
|
|
27
|
-
|
|
27
|
+
try {
|
|
28
|
+
let framework = NRAgent.environment.get('Framework')[0];
|
|
29
|
+
this.framework = framework ? framework : EMPTY_STR;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
this.framework = EMPTY_STR;
|
|
32
|
+
}
|
|
28
33
|
this.groupName = commonUtils.getCSECmode();
|
|
29
34
|
this.policyVersion = (!lodash.isEmpty(policyManager.getInstance().data)) ? policyManager.getInstance().data.version : 'DEFAULT';
|
|
30
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: New Relic
|
|
3
|
+
* SPDX-License-Identifier: New Relic Software License v1.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/* eslint-disable new-cap */
|
|
@@ -83,7 +83,7 @@ function getFormattedData() {
|
|
|
83
83
|
const appInfo = Agent.applicationInfo;
|
|
84
84
|
const deployedApplications = appInfo && appInfo.serverInfo && appInfo.serverInfo.deployedApplications;
|
|
85
85
|
const appLoc = deployedApplications[0].deployedPath;
|
|
86
|
-
const formattedSnapshot = util.format(statusTemplate, new Date().toString(), appLoc, appInfo.serverInfo.name, njsAgentConstants.FRAMEWORK,commonUtils.getWSHealthStatus(), appInfo.policyVersion, getKeyValPairs(lastHC.stats), getKeyValPairs(lastHC.serviceStatus), JSON.stringify(getBufferedErrors()), JSON.stringify(getBufferedHC()));
|
|
86
|
+
const formattedSnapshot = util.format(statusTemplate, new Date().toString(), appLoc, appInfo.serverInfo.name, njsAgentConstants.FRAMEWORK, commonUtils.getWSHealthStatus(), appInfo.policyVersion, getKeyValPairs(lastHC.stats), getKeyValPairs(lastHC.serviceStatus), JSON.stringify(getBufferedErrors()), JSON.stringify(getBufferedHC()));
|
|
87
87
|
return formattedSnapshot;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -96,6 +96,9 @@ function writeSnapshot() {
|
|
|
96
96
|
fs.writeFile(statusFile, snapshot, { mode: 0o777 }, function (err) {
|
|
97
97
|
if (err) {
|
|
98
98
|
logger.debug(err.message);
|
|
99
|
+
const LogMessage = require('./LogMessage');
|
|
100
|
+
const logMessage = new LogMessage.logMessage("SEVERE", 'Error in creating snapshot file', __filename, err);
|
|
101
|
+
commonUtils.addLogEventtoBuffer(logMessage);
|
|
99
102
|
} else {
|
|
100
103
|
logger.info('Snapshot updated to file: %s', statusFile);
|
|
101
104
|
fs.chmod(statusFile, 0o777, (err) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: New Relic
|
|
3
|
+
* SPDX-License-Identifier: New Relic Software License v1.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -15,6 +15,7 @@ const initLogger = require('./logging').getInitLogger();
|
|
|
15
15
|
const commonUtils = require('./commonUtils');
|
|
16
16
|
const API = require('../../../nr-security-api');
|
|
17
17
|
const NRAgent = API.getNRAgent();
|
|
18
|
+
const LogMessage = require('./LogMessage');
|
|
18
19
|
const {
|
|
19
20
|
SecWebSocket,
|
|
20
21
|
setWebSocketConn,
|
|
@@ -69,6 +70,15 @@ const initialize = function () {
|
|
|
69
70
|
setTimeout(() => {
|
|
70
71
|
setInterval(sendHC, HC_INTERVAL_MS);
|
|
71
72
|
sendHC();
|
|
73
|
+
try {
|
|
74
|
+
const framework = NRAgent.environment.get('Framework')[0];
|
|
75
|
+
const dispatcher = NRAgent.environment.get('Dispatcher')[0];
|
|
76
|
+
const logMessage = new LogMessage.logMessage("SEVERE", `Detected framework: ${framework} and dispatcher: ${dispatcher}`, __filename, null);
|
|
77
|
+
commonUtils.addLogEventtoBuffer(logMessage);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
logger.debug("Error while extracting data from APM environment",error);
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
}, 30000);
|
|
73
83
|
|
|
74
84
|
setInterval(commonUtils.logRollOver, 30000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/security-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "New Relic Security Agent for Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"jsonVersion": "1.1.1",
|
|
@@ -29,14 +29,13 @@
|
|
|
29
29
|
"Node.js Application Security"
|
|
30
30
|
],
|
|
31
31
|
"author": "newrelic",
|
|
32
|
-
"license": "New Relic
|
|
32
|
+
"license": "New Relic Software License v1.0",
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
35
|
"url": "https://github.com/newrelic/csec-node-agent.git"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"axios": "^1.6.3",
|
|
38
|
+
"axios": "^1.6.5",
|
|
40
39
|
"check-disk-space": "^3.4.0",
|
|
41
40
|
"content-type": "^1.0.5",
|
|
42
41
|
"fast-safe-stringify": "^2.1.1",
|