- Scan their software for potential security issues and violations of organizational policy.
- Prioritize vulnerabilities in the context of their applications.
- Understand the relationships between software components in their applications.
System specifications for deep scan
Before you proceed to run a deep scan, ensure that your system meets the following specification.| Project Size | Processor | Memory |
|---|---|---|
| Small projects | 4-core processor | 16 GB |
| Mid-size projects | 8-core processor | 32 GB |
| Large projects | 16-core processor | 64 GB |
Software prerequisites
- Install the following software before you scan:
- Yarn: Any version
- npm: 6.14.18 or higher versions
- pnpm: 3.0.0 or higher versions
- Rush: 5.90.0 or higher versions. To enable Rush support, set the environment variable
ENDOR_RUSH_ENABLED=true.
- Install Bazel version
5.x.x,6.x.x,7.x.x,8.x.x, or9.x.xif your project uses Bazel. Endor Labs supports Bzlmod with Bazel aspects. See Bazel for more information. - Make sure your repository includes one or more files with
.jsor.tsextension.
- Install endorctl version 1.7.0 or higher.
- Install Node.js version 4.2.6 or higher to support TypeScript version 4.9.
- Install TypeScript version 4.9 or higher.
-
Install
tsserver. TypeScript includestsserver, so installing the right TypeScript version also installstsserver. Install the appropriate TypeScript version based on your Node.js version. -
Use the following command based on your Node.js version to install typescript:
- 14.17 or higher
- Between 12.2 and 14.17
- Lower than 12.2
-
Run the following command to verify the
tsserverinstallationIf you are running the endorctl scan with--install-build-tools, you don’t need to installtsserver. See Configure build tools for more information.
Build JavaScript projects
You can build your JavaScript projects before running a scan. Building first creates apackage-lock.json, yarn.lock, or pnpm-lock.yaml file, which speeds up the scan.
Ensure your repository has package.json and run the following command making sure it builds the project successfully.
- For npm
- For Yarn
- For pnpm
package-lock.json, yarn.lock, or pnpm-lock.yaml file. Make sure that npm, Yarn, or pnpm is available on your system. If your repository includes a lock file, endorctl uses the existing file for dependency resolution and does not create it again.
The npm install command may fail in a subdirectory if your project has a package-lock.json file at the root of the repository but not in sub-packages. See the following example.
Scan Rush monorepos
Rush is a monorepo management tool for JavaScript/TypeScript that works on top of npm, pnpm, or Yarn and manages multiple projects in a single repository using a centralized configuration. Endor Labs detects Rush repositories using therush.json file at the repository root and scans them with the standard JavaScript workflow. Endor Labs infers the package manager and uses the corresponding lock file for dependency resolution.
Run the following command at the repository root to build the repository before a scan and to ensure the appropriate lock file exists.
endorctl scan to discover Rush dependencies.
Configure call graph generation timeout
When generating call graphs for JavaScript/TypeScript projects, endorctl usestsserver to analyze the code. By default, tsserver waits 15 seconds for a response before timing out. For large or complex projects, you may need to increase this timeout.
Set the ENDOR_JS_TSSERVER_TIMEOUT environment variable to specify the timeout in seconds.
- Large monorepos with many TypeScript files
- Projects with complex type hierarchies
- Projects with extensive type checking requirements
Override JavaScript package manager detection
endorctl detects the JavaScript package manager automatically. You can override this detection by setting theENDOR_JS_PACKAGE_MANAGER environment variable to npm, yarn, pnpm, or lerna.
For example, to use npm as the package manager run the following command.
Scan Bazel projects
To scan JavaScript projects that use Bazel, see Bazel for build instructions, supported rules, and scan commands. Endor Labs supports Bzlmod with Bazel aspects usingrules_js >= 2.0.0. See Bazel Aspects for more information.
Run a scan
Perform a scan to get visibility into your software composition and resolve dependencies.Understand the scan process
Dependency analysis tools analyze the lock file of an npm, yarn, pnpm, or Rush based package and attempt to resolve dependencies. To resolve dependencies from private repositories, Endor Labs reads the.npmrc settings from the repository.
Endor Labs surpasses mere manifest file analysis by expertly resolving JavaScript dependencies and identifies:
- Dependencies listed in the manifest file but not used by the application
- Dependencies used by the application but not listed in the manifest file
- Dependencies listed in the manifest as transitive but used directly by the application
- Dependencies categorized as test in the manifest, but used directly by the application
Configure private npm package repositories
Endor Labs supports fetching and scanning dependencies from private npm package registries. Endor Labs will fetch resources from authenticated endpoints and perform the scan, allowing you to view the resolved dependencies and findings. See npm package manager integrations for more information on configuring private registries.Known Limitations
- Endor Labs doesn’t currently support local package references
- If a dependency cannot resolve from the lock file, building that specific package may fail. The package may no longer exist in npm, or the
.npmrcfile may not be properly configured. Other packages in the workspace are scanned as usual.
Call graph limitations
- The call graph might not include functions passed as arguments to call expressions.
- The call graph might not include functions that return and then execute.
- The call graph might not include functions assigned to a variable based on a runtime value.
- The call graph might not include functions assigned to an array element.
Troubleshoot errors
- Unresolved dependency errors:
The manifest file
package.jsonis not buildable. Try runningnpm install,yarn install,pnpm install, orrush installin the root project to debug this error. - Resolved dependency errors: A dependency version does not exist or cannot be found. The package may no longer exist in the repository.