You can monitor application security for Node.js apps running in Docker, Kubernetes, Amazon ECS, and AWS Fargate.

In general, setting up Application Security Management (ASM) involves:

  1. Identifying services that are vulnerable or are under attack, which would most benefit from ASM. Find them on the Security tab of your Service Catalog.
  2. Updating to the latest Datadog library (the most recent APM tracing library).
  3. Enabling the library to collect the application security data from the services and send it to Datadog.
  4. Triggering security signals in your application and seeing how Datadog displays the resulting information.

Prerequisites

1-Click Enablement
If your service is running with an Agent with Remote Configuration enabled and a tracing library version that supports it, hover over the Not Enabled indicator in the ASM Status column and click Enable ASM. There's no need to re-launch the service with the DD_APPSEC_ENABLED=true or --enable-appsec flags.

Enabling code security vulnerability detection

If your service runs a tracing library version that supports code security vulnerability detection, enable the capability by setting the DD_IAST_ENABLED=true environment variable and restarting your service.

To leverage code security vulnerability detection capabilities for your service:

  1. Update your Datadog Agent to at least version 7.41.1.

  2. Update your tracing library to at least the minimum version needed to turn on code security vulnerability detection. For details, see ASM capabilities support.

  3. Add the DD_IAST_ENABLED=true environment variable to your application configuration.

    If you initialize the APM library on the command line using the --require option to Node.js:

    node --require dd-trace/init app.js
    

    Then use environment variables to enable ASM:

    DD_IAST_ENABLED=true node app.js
    

    How you do this varies depending on where your service runs:

    Update your configuration container for APM by adding the following argument in your docker run command:

    docker run [...] -e DD_IAST_ENABLED=true [...]
    

    Add the following environment variable value to your container Dockerfile:

    ENV DD_IAST_ENABLED=true
    

    Update your configuration yaml file container for APM and add the AppSec env variable:

    spec:
      template:
        spec:
          containers:
            - name: <CONTAINER_NAME>
              image: <CONTAINER_IMAGE>/<TAG>
              env:
                - name: DD_IAST_ENABLED
                  value: "true"
    

    Update your ECS task definition JSON file, by adding this in the environment section:

    "environment": [
      ...,
      {
        "name": "DD_IAST_ENABLED",
        "value": "true"
      }
    ]
    

  4. Restart your service.

  5. To see Software Composition Analysis for code security vulnerabilities in action, browse your service and the code-level vulnerabilities appear in the Vulnerability Explorer. The SOURCE column shows the Code value.

If you need additional assistance, contact Datadog support.

Further Reading