Support air-gapped (offline) Dependency Scanning for JavaScript (npm, yarn) through retire.js analyzer

Problem to solve

Some users need to run our security scans in limited connectivity environments. Currently our retire.js analyzer requires internet connectivity to run using standard configuration. We should aim to support offline execution and provide clear documentation on how to configure it for such installations.

Intended users

Further details

Proposal

We have to change analyze.go and set --js-advisory-db and --node-advisory-db to the local paths of the "repositories". See option definition and repository loading.

Implementation Plan

Backend

Permissions and Security

Documentation

Testing

TODO: if not already done, define a proper way to test the air-gapped environment, share it in the parent epic &1359 (closed) and try to reuse it across all similar issues as much as possible. Outside of the scope of this issue - air-gap testing for dependency scanning will be described as part of Document air-gapped (offline) Dependency Scanning for on-prem instances

In order to test only the retire.js scanner in an air-gapped environment, follow these steps:

  1. Pull the latest version of the GitLab retire.js analyzer
    docker pull registry.gitlab.com/gitlab-org/security-products/analyzers/retire.js:2
  2. Change to the directory of the js project you want to scan
  3. Download the following Retire.js vulnerability data files to the root of your js project:
  4. Run yarn or npm i on your project to populate the node_modules directory in your js project
  5. Unplug your internet connection
  6. Run the analyzer and reference the above files:
    docker run \
      -e RETIREJS_JS_ADVISORY_DB="jsrepository.json" \
      -e RETIREJS_NODE_ADVISORY_DB="npmrepository.json" \
      -e CI_PROJECT_DIR="/code" \
      --volume "$PWD:/code" \
      --volume /var/run/docker.sock:/var/run/docker.sock \
      registry.gitlab.com/gitlab-org/security-products/analyzers/retire.js:2
  7. gl-dependency-scanning-report.json file should be produced

What does success look like, and how can we measure that?

Retire.js analyzer is able to scan a project in an air-gapped environment.

What is the type of buyer?

GitLab Ultimate

Links / references

Action Items

Product

  • We will not include a release post until the Epic is complete.

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖