5.4.1 • Published 3 days ago

@contrast/agent v5.4.1

Weekly downloads
3,670
License
SEE LICENSE IN LI...
Repository
-
Last release
3 days ago

Contrast Security Node.js Agent

This package will enable instrumentation of your Node.js application for security analysis and runtime protection by Contrast Security.

Unlike legacy application security testing solutions, Contrast produces accurate results without dependence on application security experts. Accuracy comes from Contrast's patented Deep Security Instrumentation technology, which integrates the most effective elements of Interactive (IAST), Static (SAST), and Dynamic (DAST) application security testing technology, software composition analysis (SCA), and configuration analysis, and delivers them directly to applications.

Contrast produces a continuous stream of accurate vulnerability and compliance risk information whenever and wherever software is run. Development, QA and Security teams get results as they develop and test software, enabling them to find and fix security flaws early in the software lifecycle, when they are easiest and cheapest to remediate.

New in version 5

  • The agent no longer ships or operates with the contrast-service "sidecar" executables. This allows for a drastically smaller download and simplified deployments.

  • Framework support includes express, koa, and fastify, with others soon to come.

  • The agent does not respond to any command-line configuration flags. Configuration options can be set using environment variables and/or contrast_security.yaml file. If you were previously using the agent's -c CLI option to set the location of your configuration file, you can use CONTRAST_CONFIG_PATH environment variable instead. See more about configuration below.

  • Structured logging.

  • Ablility to run Assess and Protect modes concurrently.

Getting Started

Existing Contrast Node.js agent users should install and update the Contrast Node.js agent from npm. The Contrast Node.js agent follows semantic versioning (major.minor.patch).

An API key, provided by Contrast Security, is required for the agent to function.

Ensure you have installed the latest LTS (Long Term Support) version of Node.js

To install from npm using the command line (run from the app root directory):

$ npm install @contrast/agent

Usage

With LTS (Long Term Support) Node.js Versions

Node.js policy is that production applications should use only Active LTS or Maintenance LTS releases. All current LTS versions of Node.js support ECMAScript modules (ESM) and CommonJS modules (CJS) with the --import flag. To ensure that the agent can instrument your application, use:

node --import @contrast/agent app-main [app arguments]

Notes:

  • --import should be used for Node.js LTS (Active and Maintenance) versions >=18.19.0
  • Node.js versions >=20.0.0 and <20.6.0 are not supported

With end-of-life Node.js Versions

When using the agent with end-of-life Node.js versions, use either the --loader or --require flag, depending on the version of Node.js and the module system used.

Use the --loader flag for Node.js versions >=16.17.0 and <18.19.0.

node --loader @contrast/agent app-main.mjs [app arguments]

Use the --require (-r) flag for Node.js versions <16.17.0.

node -r @contrast/agent app-main [app arguments]

Note:

  • -r will still work for Node.js versions that have no ESM modules or dependencies.

With @contrast/agent v4

The Contrast Node.js agent v4 is still available for use, but does not support ESM modules. To use the v4 agent, use the --require (-r) flag.

node -r @contrast/agent app-main [app arguments]

Configuration

File Locations

The agent will look for the contrast_security.yaml configuration file in the following locations and order:

  1. Within the processes current working directory, that is ${process.cwd()}/contrast_security.yaml.

  2. OS-specific configuration directories.

    • Unix and MacOS systems:

      • /etc/contrast/node/contrast_security.yaml, then

      • /etc/contrast/contrast_security.yaml

    • Win32 systems:

      • ${process.env.ProgramData}\contrast\node\contrast_security.yaml, then

      • ${process.env.ProgramData}\contrast\contrast_security.yaml

  3. Unix home directory.

    • ~/.config/contrast/node/contrast_security.yaml, then

    • ~/.config/contrast/contrast_security.yaml

Note: The optional /node/ path segment is useful in cases where you want to organize configuration files by agent language:

/etc
  /contrast
    /node/contrast_security.yaml
    /java/contrast_security.yaml
    /python/contrast_security.yaml

You can also specify the location of the configuration file with the CONTRAST_CONFIG_PATH environment variable:

CONTRAST_CONFIG_PATH=/path/to/config.yaml node -r @contrast/agent app-main.js

Note: If process.env.CONTRAST_CONFIG_PATH set, the agent will look at that location only. If there is an issue reading the configuration file from this location the agent will not look in the standard locations described above, but instead do the following: 1. Halt instrumentation 2. Communicate an error 3. Run the application as if without Contrast

Minimum Configuration Option Requirements

The agent requires a minimum set of configuration options be set. They are described below as YAML.

api:
  # Organization's API key
  api_key: dCBvm46uEJAUV2musNFb357SnvqYrlq1
  # Contrast user account service key
  service_key: PZU499KK3YD4X2DT
  # Contrast user account ID (In most cases, this is your login ID)
  user_name: agent_d228a527-130c-18cc-93b8-20096136ba0b@UserOrg
  # Address to the Contrast backend. This will vary.
  url: https://app.contrastsecurity.com

Visit https://agent.config.contrastsecurity.com/ to use our online tool for building your YAML file interactively.

For detailed installation and configuration instructions, see the Node.js Agent documentation.

5.4.1

3 days ago

5.4.0

4 days ago

5.3.0

9 days ago

5.2.2

23 days ago

5.2.1

1 month ago

5.2.0

1 month ago

5.1.0

1 month ago

5.0.8

1 month ago

5.0.7

2 months ago

5.0.6

2 months ago

5.0.5

2 months ago

5.0.4

2 months ago

5.0.3

2 months ago

5.0.2

2 months ago

4.37.1

2 months ago

5.0.1

2 months ago

5.0.0

2 months ago

4.37.0

3 months ago

4.36.2

3 months ago

5.0.0-beta.11

3 months ago

4.36.1

4 months ago

4.32.13

9 months ago

4.32.18

8 months ago

4.32.19

8 months ago

4.32.16

9 months ago

4.32.17

8 months ago

4.32.14

9 months ago

4.32.15

9 months ago

5.0.0-beta.8

5 months ago

5.0.0-beta.9

4 months ago

5.0.0-beta.6

5 months ago

5.0.0-beta.7

5 months ago

5.0.0-beta.4

6 months ago

5.0.0-beta.5

5 months ago

5.0.0-beta.2

7 months ago

5.0.0-beta.3

6 months ago

5.0.0-beta.1

7 months ago

4.32.20

7 months ago

4.36.0

4 months ago

5.0.0-alpha.9

8 months ago

5.0.0-alpha.8

8 months ago

4.33.3

4 months ago

4.33.2

5 months ago

4.33.1

5 months ago

4.33.0

7 months ago

5.0.0-alpha.10

7 months ago

5.0.0-beta.10

4 months ago

4.35.0

4 months ago

4.34.0

4 months ago

4.32.12

9 months ago

4.32.10

10 months ago

4.32.11

10 months ago

5.0.0-alpha.7

10 months ago

5.0.0-alpha.6

10 months ago

5.0.0-alpha.5

11 months ago

5.0.0-alpha.4

11 months ago

5.0.0-alpha.3

12 months ago

4.32.8

11 months ago

4.32.7

11 months ago

4.32.6

11 months ago

4.32.5

11 months ago

4.32.9

10 months ago

4.32.4

12 months ago

4.32.3

12 months ago

4.31.2

1 year ago

5.0.0-alpha.2

1 year ago

5.0.0-alpha.1

1 year ago

4.32.0

1 year ago

4.32.2

12 months ago

4.32.1

12 months ago

4.31.1

1 year ago

4.31.0

1 year ago

4.30.1

1 year ago

4.30.0

1 year ago

4.29.2-alpha.2

1 year ago

4.29.2-alpha.1

1 year ago

4.29.1

1 year ago

4.29.0

1 year ago

4.28.0

1 year ago

4.28.1

1 year ago

4.27.0

1 year ago

4.27.1

1 year ago

4.27.2

1 year ago

4.26.0

1 year ago

4.25.5

1 year ago

4.25.3

1 year ago

4.25.4

1 year ago

4.25.6-beta.0

1 year ago

4.25.2

1 year ago

4.25.0

2 years ago

4.24.0

2 years ago

4.24.1

2 years ago

4.25.1

1 year ago

4.24.2

2 years ago

4.23.1

2 years ago

4.21.1

2 years ago

4.21.0

2 years ago

4.20.2

2 years ago

4.20.0

2 years ago

4.20.1

2 years ago

3.11.27

2 years ago

4.23.0

2 years ago

4.19.5

2 years ago

4.19.6

2 years ago

4.19.7

2 years ago

4.22.0

2 years ago

4.22.1

2 years ago

4.19.3

2 years ago

4.19.4

2 years ago

4.18.0

2 years ago

3.11.26

2 years ago

4.19.0

2 years ago

4.19.1

2 years ago

4.19.2

2 years ago

4.17.0

2 years ago

4.17.1

2 years ago

4.16.0

2 years ago

4.16.1

2 years ago

4.16.2

2 years ago

3.11.24

2 years ago

3.11.23

2 years ago

3.11.25

2 years ago

4.14.0

2 years ago

3.11.22

2 years ago

3.11.21

2 years ago

4.15.0

2 years ago

4.15.1

2 years ago

4.13.0

2 years ago

4.13.1

2 years ago

4.12.2

2 years ago

3.11.20

2 years ago

4.12.0

2 years ago

4.12.1

2 years ago

4.10.5

2 years ago

4.10.6

2 years ago

4.9.0

2 years ago

4.9.1

2 years ago

4.10.1

2 years ago

4.10.2

2 years ago

4.10.3

2 years ago

4.10.4

2 years ago

4.10.0

2 years ago

4.8.0

2 years ago

4.7.1

2 years ago

3.11.17

2 years ago

3.11.16

2 years ago

3.11.19

2 years ago

3.11.18

2 years ago

4.11.0

2 years ago

4.7.0

2 years ago

4.6.0

2 years ago

3.11.15

2 years ago

3.11.14

2 years ago

4.5.2

2 years ago

3.11.13

2 years ago

4.5.1

2 years ago

4.4.1

2 years ago

4.4.0-beta.0

2 years ago

4.3.1-0

2 years ago

3.11.11

2 years ago

3.11.12

2 years ago

4.5.0

2 years ago

4.3.0

2 years ago

3.11.10

2 years ago

4.2.0

3 years ago

3.11.9

3 years ago

4.1.0

3 years ago

3.11.8

3 years ago

3.11.7

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-rc.3

3 years ago

3.11.6

3 years ago

4.0.0-rc.2

3 years ago

3.11.5

3 years ago

3.11.4

3 years ago

3.11.3

3 years ago

4.0.0-rc.1

3 years ago

4.0.0-rc.0

3 years ago

3.11.0

3 years ago

3.11.2

3 years ago

3.11.1

3 years ago

3.9.4

3 years ago

3.10.1

3 years ago

3.10.0

3 years ago

3.10.3

3 years ago

3.10.2

3 years ago

3.9.3

3 years ago

3.9.2

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.8.6

3 years ago

3.8.5

3 years ago

3.8.4

3 years ago

3.8.3

3 years ago

3.8.2

3 years ago

3.8.1

3 years ago

3.8.0

3 years ago

3.7.0

3 years ago

3.6.2

3 years ago

3.6.4

3 years ago

3.6.3

3 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.5.1

3 years ago

3.5.1-0

3 years ago

3.4.2

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.4.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.18.0

4 years ago

2.17.2

4 years ago

2.17.1

4 years ago

2.17.0

4 years ago

2.16.8

4 years ago

2.16.7

4 years ago

2.16.6

4 years ago

2.16.5

4 years ago

2.16.4

4 years ago

2.16.3

4 years ago

2.16.1

4 years ago

2.16.2

4 years ago

2.16.0

4 years ago

2.15.5

4 years ago

2.15.4

4 years ago

2.15.3

4 years ago

2.15.2

4 years ago

2.15.1

4 years ago

2.15.0

4 years ago

2.14.8

4 years ago

2.14.7-beta.0

4 years ago

2.14.7

4 years ago

2.14.6-beta.2

4 years ago

2.14.6-beta.1

4 years ago

2.14.6-beta.0

4 years ago

2.14.6

4 years ago

2.14.5

4 years ago

2.14.4

4 years ago

2.14.3

4 years ago

2.14.2

4 years ago

2.14.1

4 years ago

2.14.0

4 years ago

2.13.12

4 years ago

2.13.11

4 years ago

2.13.10

4 years ago

2.13.9

4 years ago

2.13.8

4 years ago

2.13.7

4 years ago

2.13.6

4 years ago

2.13.5

4 years ago

2.13.4

4 years ago

2.13.3

4 years ago

2.13.0

4 years ago

2.12.5

4 years ago

2.15.5-beta.1

4 years ago

2.12.5-beta.0

4 years ago