This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Manage build tools (Beta)

Learn how to build repeatable patterns to manage build tools in your environment.

Endor Labs often requires pre-built or installed software to scan your application. Building software allows Endor Labs to ensure that your software bill of materials is accurate, especially in software languages such as Python, Java, or .NET where lock files are significantly less common.

Since software frequently relies on specific versions of a runtime or package manager, Endor Labs references the tools used in your software build process. This ensures that your software bill of materials and all associated risk information are accurate. Endor Labs provides ways to define the tools necessary for building your software for repeatable patterns used in CI or when build tools are not installed.

Endor Labs will automatically install build tools in a sandbox to ensure you can run highly accurate scans. The build tools are not installed on your host but are installed in an isolated sandbox. The feature is currently supported for Linux and macOS operating systems.

Scan Profile is used to configure build tool chain and scan parameters that are passed to the Github App. A Project should be associated to one Scan Profile so that the scans for that project uses the configuration in the Scan Profile.

You need to install and initialize endorctl CLI, before configuring the build toolchains in a scan profile.

The following pages describe the various methods in which you can create a scan profile.

Configure build tools for Endor Labs GitHub App

Endor Labs GitHub App continuously monitors your projects for security and operational risks. The app monitors all the projects included in your GitHub workspace and scans run once every 24 hours. For performing scans, the GitHub App checks the toolchain specifications in the following order:

  1. Toolchain configuration specified through endorctl API.
  2. Toolchain configuration specified in scanprofile.yaml file.
  3. Enable auto detection and automatically detect the toolchains from your manifest files.
  4. Uses the system defaults.

Configure build tools for repeatable CI patterns

After installing and initializing the endorctl CLI, run the endorctl scan using the --install-build-tools command to dynamically download and install the required build tools.

endorctl scan --install-build-tools

Run the endorctl scan

Here is the recommended flow for performing the endorctl scan.

  1. For the first time, run the endorctl scan to create a project with Endor Labs.
endorctl scan
  1. To automatically download and install build tools as part of your scan, run the endorctl scan using the --install-build-tools command.
endorctl scan --install-build-tools
  1. The system checks for the required toolchain specifications in the following order before installing them in the sandbox.

System default toolchain versions

If you do not provide a tool profile, the default toolchains are installed in the sandbox while performing the endorctl scan with the install-build-tools flag. See Toolchain reference for details on default versions.

Toolchain support matrix

The following table outlines the toolchain profile support details across different languages and platforms.

Dependencies Support for API/profile.yaml Support for Auto detection Defaults Platform
Java Supported Java 8, 11, 17, 21 Java 17 Linux, Darwin
Maven Supported Maven 3.8.8, 3.9.4 Maven 3.9.4 Linux, Darwin
Gradle Supported Gradle 7.6.4, 8.4 Gradle 8.4 Linux, Darwin
Python Supported Python 3.8, 3.9, 3.10, 3.11, 3.12 Python 3.10 Linux, Darwin
NodeJS Supported NodeJS 20.10 Node JS 20.10.0 Linux, Darwin
Yarn Supported Yarn 1.22 Yarn 1.22.19 Linux, Darwin
PNPM Supported PNPM 8.10 PNPM 8.10.2 Linux, Darwin
Golang Supported Golang 1.21, 1.22, 1.23 Golang 1.22.2 Linux, Darwin
.NET Supported .NET 6, 7, 8 .NET 7.0.401 Linux, Darwin
Scala Supported Scala 1.9.0 Linux, Darwin
Rust Supported Rust 1.77.9 Linux, Darwin
MIRAI Supported MIRAI 1.1.8 Linux, Darwin
Kotlin Supported Java 17 Linux, Darwin
Typescript Supported Node JS 20.10.0 Linux, Darwin
Android Supported platform-tools Linux, Darwin
PHP Supported 8.2 Linux
Ruby Supported 3.2.1 Linux

Reference toolchain specification

The following reference toolchain specification has examples for defining toolchains in linux | amd64 architecture.

kind: ToolchainProfile
spec:
  os:
    linux:
      arch:
        amd64:
          java_tool_chain:
            version:
              name: "1.8.412"
              urls:
                - "https://builds.openlogic.com/downloadJDK/openlogic-openjdk/8u412-b08/openlogic-openjdk-8u412-b08-linux-x64.tar.gz"
              relative_tool_chain_path: "openlogic-openjdk-8u412-b08-linux-x64/"
              sha256_sum: "eb06c9d62e031e3290f499a828cae66d4fadbf62eb8f490c63c8406b1a80172e"
            maven_version:
              name: "3.9.4"
              urls:
                - "https://archive.apache.org/dist/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz"
              relative_tool_chain_path: "apache-maven-3.9.4"
              sha256_sum: "ff66b70c830a38d331d44f6c25a37b582471def9a161c93902bac7bea3098319"
            gradle_version:
              name: "8.4"
              urls:
                - "https://services.gradle.org/distributions/gradle-8.4-bin.zip"
              relative_tool_chain_path: "gradle-8.4/"
              sha256_sum: "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae"
          python_tool_chain:
            version:
              name: "3.10"
              urls:
                - "https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.10.14+20240415-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst"
              relative_tool_chain_path: "python/"
              sha256_sum: "add8cc6cbb4f2a3f8af2272e62b7604f7529a8c357c0af0f8a9f7d3dd444ef1e"
          java_script_tool_chain:
            nodejs_version:
              name: "20.10.0"
              urls:
                - "https://nodejs.org/dist/v20.10.0/node-v20.10.0-linux-x64.tar.gz"
              relative_tool_chain_path: "node-v20.10.0-linux-x64/"
              sha256_sum: "d3f0908a9d9190a8525c5b9a716ed91bb57e908555841b0c47f75b2a001ff91b"
            yarn_version:
              name: "1.22.19"
              urls:
                - "https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-v1.22.19.tar.gz"
              relative_tool_chain_path: "yarn-v1.22.19/"
              sha256_sum: "732620bac8b1690d507274f025f3c6cfdc3627a84d9642e38a07452cc00e0f2e"
          dotnet_tool_chain:
              version:
                name: "8.0.303"
                urls:
                  - "https://download.visualstudio.microsoft.com/download/pr/60218cc4-13eb-41d5-aa0b-5fd5a3fb03b8/6c42bee7c3651b1317b709a27a741362/dotnet-sdk-8.0.303-linux-x64.tar.gz"
                sha256_sum: "214ee467f75c42f1512748fe7ca8dd82da2af29cdf54be614a8997f0466ef070"
    darwin:
      arch:
        arm64:
          java_tool_chain:
            version:
              name: "1.8.412"
              urls:
                - "https://builds.openlogic.com/downloadJDK/openlogic-openjdk/8u412-b08/openlogic-openjdk-8u412-b08-mac-x64.zip"
              relative_tool_chain_path: "openlogic-openjdk-8u412-b08-mac-x64/jdk1.8.0_412.jdk/Contents/Home"
              sha256_sum: "a16d297418f6800dfc5abfd4dfd8a16c0504d7e1f3b6fc9051cf2460f14a955e"
            maven_version:
              name: "3.9.4"
              urls:
                - "https://archive.apache.org/dist/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz"
              relative_tool_chain_path: "apache-maven-3.9.4"
              sha256_sum: "ff66b70c830a38d331d44f6c25a37b582471def9a161c93902bac7bea3098319"
          dotnet_tool_chain:
            version:
              name: "8.0.303"
              urls:
                - "https://download.visualstudio.microsoft.com/download/pr/d81d84cf-4bb8-4371-a4d2-88699a38a83b/9bddfe1952bedc37e4130ff12abc698d/dotnet-sdk-8.0.303-osx-arm64.tar.gz"
              relative_tool_chain_path: "dotnet-sdk-8.0.303-osx-arm64"
              sha256_sum: "c6f4150833e51d55cc4c4a435d7cc53269f3d6db308b34f4e001900c6fdf8149"
---
kind: AutomatedScanParameters
spec:
  languages:
    - java
    - python
  additional_environment_variables:
    - ENDOR_LOG_VERBOSE=false
    - ENDOR_LOG_LEVEL=info

1 - Configure scan profile through Endor Labs UI

Learn how to configure scan profile through the Endor Labs user interface.

While scanning projects using the GitHub App, you can configure a scan profile and assign it to your projects directly from the Endor Labs user interface.

Create a new scan profile

Create and customize a new scan profile to define scan parameters, toolchains, and projects.

  1. Sign in to Endor Labs and click Settings under Manage in the left sidebar.
  2. Select SCAN PROFILES and click New Scan Profile.
  3. Enter a name for the scan profile and click Create Scan Profile.
  4. Configure various settings like automated scan parameters and paths. See Configure General scan profile settings for more information.
  5. Select TOOLCHAINS and configure the toolchains. See Configure toolchains for more information.
  6. Select PROJECTS to associate the scan profile with projects. See Associate projects with a scan profile.

Configure general scan profile settings

Configure the necessary scan settings to tailor scans for your projects.

  1. Select the features that you want to enable for the scan profile.

    • Enable pull request comments
    • Enable remediation action

    The selected features are automatically used when you run a scan on a project that uses the scan profile.

  2. Select the languages to scan and the languages for which you need to generate call graphs. If you don’t select any language, all the languages detected in the repository will automatically be selected for the scan.

  3. Enter the paths to include or exclude in the scan.

  4. Enter any additional environment variables, if required. Only the environment variables starting with ENDOR_ are passed to the scan, all others are ignored.

  5. Configure Bazel settings, if required.

  6. Click Save Scan Profile to save the toolchain configuration.

Configure toolchains

Create and save a scan profile.

  1. Select the operating system for the scan profile.

  2. Select the architecture.

  3. Select the toolchain available for the operating system-architecture combination.

  4. Select the tool associated with the toolchain. For package managers like Python (pip), JavaScript (npm), and Android, you can configure a list of packages to install before the scan.

  5. Select the version of the tool (or enter the package name if you chose a package in the previous step) and click Add to Profile.

    You can only assign one version of the tool for a scan profile for a particular operating system-architecture combination.

    You can also click Custom and define the custom version of the tool. See Configure custom versions for more information.

    The following image shows the creation of a scan profile for Go and JavaScript scans. Create Scan Profile

  6. Click Save Scan Profile to save the toolchain configuration.

Configure a custom version for a tool

When you assign a version of the tool, you can choose to apply a custom version that is not provided by Endor Labs.

You must provide the following information.

  • Version name
  • The URL to download the archive package
  • SHA256 checksum of the package
  • The relative toolchain path, if required. The toolchain is extracted to the specified relative toolchain path if provided.

The following image shows a custom configuration for the Golang toolchain with Go 1.22.7 instead of the bundled 1.22.6. Custom toolchain

Associate projects with a scan profile

Assign projects to your scan profile.

  1. Select Actions > Add Projects.

    Add Projects

  2. Search the project and click Add to Scan Profile. You can associate multiple projects with a scan profile, but you cannot apply multiple scan profiles to a single project.

2 - Configure scan profile through Endor Labs API

Learn how to configure scan profile through Endor Labs API

You can use the endorctl api command to configure the toolchains for your project.

  1. Run the endorctl scan to create a project.
endorctl scan
  1. Fetch the UUID of the project, for example, to fetch the UUID of the app-java-demo project, you can use:
UUID=$(endorctl api list -r Project --filter="meta.name matches https://github.com/endorlabs/app-java-demo" --field-mask=uuid | jq -r '.list.objects[].uuid')
  1. Create a ScanProfile object using the following command. Set the environment variable using set EDITOR=vim before executing the following command.
endorctl api create -i -r ScanProfile

Here is an example that you can use to create a ScanProfile object for installing .NET 8.0.303. After executing this command, you can fetch the UUID of the ScanProfile object. See Reference toolchain specification for a complete description of supported toolchains.

spec:
  toolchain_profile:
    os:
      linux:
        arch:
          amd64:
            dotnet_tool_chain:
              version:
                name: "8.0.303"
                urls:
                  - "https://download.visualstudio.microsoft.com/download/pr/60218cc4-13eb-41d5-aa0b-5fd5a3fb03b8/6c42bee7c3651b1317b709a27a741362/dotnet-sdk-8.0.303-linux-x64.tar.gz"
                sha256_sum: "214ee467f75c42f1512748fe7ca8dd82da2af29cdf54be614a8997f0466ef070"
  1. Associate the scan_profile_uuid to your project UUID <project-uuid, using the following command.
endorctl api update -r Project --uuid=<project-uuid> -d '{"spec":{"scan_profile_uuid":"<scanprofile-uuid>"}}' --field-mask 'spec.scan_profile_uuid'

You have now created a toolchain for installing .NET 8.0.303.

3 - Configure scan profile through scanprofile.yaml

Learn how to configure scan profile through scanprofile.yaml file

You can create a build tool profile for your Endor Labs scans in each repository to specify the build tools to automatically download for each scan.

Create a new file .endorctl/scanprofile.yaml file in the root directory of your repository and specify the required versions of the tools. You can specify the Operating system, architecture, language, tool, and install information in the scanprofile.yaml file:

The overall structure of a scanprofile.yaml file should look like this:

kind: ToolchainProfile
spec:
  os:
    <linux|darwin>:
      arch:
        <amd64|arm64>:
          python_tool_chain:

A profile that downloads Python 3.10 and the corresponding PyPI packages to run in a CI environment can look like this:

kind: ToolchainProfile
spec:
  os:
    linux:
      arch:
        amd64:
          python_tool_chain:
            version:
              name: "3.10"
              urls:
                - "https://python310.tar.gz"
              sha256_sum: "python310shasum"
            pip_packages:
              wheel:
                name: "1.2.3"
                urls:
                  - "https://wheel123.tar.gz"
                  - "https://wheel123_backup.targz"
                sha256_sum: "wheelshasum"

4 - Enable auto detection

Learn how to automatically detect toolchains used in your repository.

The system can automatically detect toolchains required for your projects based on the manifest files present in your repository. Auto detection is supported for Java, Python, Golang and .NET(C#) projects. Only the Long Term Support (LTS) versions of the toolchains are supported in auto detection. See the Toolchain support matrix for a complete list of supported toolchain versions for auto detection.

Enable auto detection in CLI

To enable auto detection from the CLI,

endorctl scan --install-build-tools --enable-build-tools-version-detection

Enable auto detection in GitHub App

When using the GitHub App, you can enable auto detection either by a project or enable it for all projects in a tenant.

  • To enable the auto detection by a project, update the project’s meta.annotations with "ENDOR_SCAN_ENABLE_BUILD_TOOLS_VERSION_DETECTION":"true".
meta:
  annotations: {"ENDOR_SCAN_ENABLE_BUILD_TOOLS_VERSION_DETECTION":"true"}
  endorctl api update -r Project --uuid=<project-uuid> -i
  • To enable auto detection across all projects in a tenant, update the system config’s meta.annotations with "ENDOR_SCAN_ENABLE_BUILD_TOOLS_VERSION_DETECTION":"true".
 meta:
   annotations: {"ENDOR_SCAN_ENABLE_BUILD_TOOLS_VERSION_DETECTION":"true"}
 endorctl api update -r SystemConfig --uuid=<system-config-uuid> -i

The updates are applied during the next scheduled scan or whenever you perform a manual re-scan.