@contrast/agent 4.32.20 → 4.33.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.
@@ -194,7 +194,7 @@ function readConfig(cliOptions, logger) {
194
194
 
195
195
  if (configPath) {
196
196
  try {
197
- fileContents = fs.readFileSync(path.resolve(configPath), 'utf-8');
197
+ fileContents = fs.readFileSync(path.resolve(configPath)).toString('utf-8');
198
198
  } catch (e) {
199
199
  logger.error(`Unable to read config file. ${e.message}`);
200
200
  }
@@ -15,12 +15,14 @@ Copyright: 2023 Contrast Security, Inc
15
15
  'use strict';
16
16
 
17
17
  const path = require('path');
18
+ const semver = require('semver');
18
19
  const { setCodeEventListener } = require('@contrast/fn-inspect');
19
20
  const agentEmitter = require('./agent-emitter');
20
21
  const logger = require('./core/logger')('contrast:library-usage');
21
22
  const LibraryUsage = require('./reporter/models/app-update/library-usage');
22
23
 
23
24
  const reportedFiles = new Set();
25
+ const type = semver.gte(process.version, '20.0.0') ? 'Function' : 'LazyCompile';
24
26
 
25
27
  /**
26
28
  * start listening for v8 code events
@@ -30,7 +32,7 @@ module.exports.listen = function(evalInterval = 1) {
30
32
  const handler = (codeEvent) => {
31
33
  try {
32
34
  if (
33
- codeEvent.type !== 'LazyCompile' ||
35
+ codeEvent.type !== type ||
34
36
  codeEvent.script.indexOf(`node_modules${path.sep}`) === -1 ||
35
37
  reportedFiles.has(codeEvent.script)
36
38
  ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agent",
3
- "version": "4.32.20",
3
+ "version": "4.33.1",
4
4
  "description": "Node.js security instrumentation by Contrast Security",
5
5
  "keywords": [
6
6
  "security",
@@ -81,9 +81,9 @@
81
81
  "@babel/types": "^7.12.1",
82
82
  "@contrast/agent-lib": "^4.3.0",
83
83
  "@contrast/cls-hooked": "^4.3.1",
84
- "@contrast/distringuish": "^4.2.1",
84
+ "@contrast/distringuish": "^4.4.0",
85
85
  "@contrast/flat": "^4.1.1",
86
- "@contrast/fn-inspect": "^3.1.0",
86
+ "@contrast/fn-inspect": "^3.4.0",
87
87
  "@contrast/protobuf-api": "^3.2.5",
88
88
  "@contrast/require-hook": "^3.2.3",
89
89
  "@contrast/synchronous-source-maps": "^1.1.0",
@@ -199,7 +199,7 @@
199
199
  "test": "test"
200
200
  },
201
201
  "engines": {
202
- "node": ">=12.13.0 <13 || >=14.15.0 <15 || >=16.9.1 <17 || >=18.7.0 <19",
202
+ "node": ">=12.13.0 <13 || >=14.15.0 <15 || >=16.9.1 <17 || >=18.7.0 <19 || >=20.5.0 <21",
203
203
  "npm": ">=6.13.7 <7 || >=7.11.0"
204
204
  },
205
205
  "bundleDependencies": [