ecosystems

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ecosystems resolves the on-disk locations where a project's dependencies are installed/cached, per programming-language / package-manager ecosystem. The malscan-engine is content-agnostic — it scans a directory tree it is handed — so the CLI is responsible for pointing it at the right places: the project-local install dirs (node_modules, .venv/site-packages, vendor, …) and, when asked, the user-scoped/home caches shared across all projects (~/.npm, ~/go/pkg/mod, ~/.cargo/registry, ~/.m2, …).

The table below is the single source of truth. Each entry maps an ecosystem to its malscan-engine slug (used to select the right STIX IOC feed) and the dirs to scan. Resolve returns only the targets that actually exist on disk so the engine never walks phantom paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanSkipDirs

func ScanSkipDirs() []string

ScanSkipDirs is the directory-prune set the malscan engine should use for a dependency-tree scan. Unlike the engine's default (which prunes node_modules and vendor — the very dirs we are scanning), this prunes only version-control metadata, so nested package dirs inside node_modules/vendor ARE walked.

func SystemBinaryDirs

func SystemBinaryDirs(sysRoot string) []string

SystemBinaryDirs are the directories a whole-system scan inspects for compiled artefacts. It is not the whole root: /proc, /sys and /dev are not files, and /usr/lib alone holds tens of thousands of shared objects that the OS package database already accounts for. Symlinked dirs (/bin -> usr/bin on merged-/usr distros) are returned once, resolved inside the system root.

func SystemHomes

func SystemHomes(sysRoot string) []string

SystemHomes lists the account home directories under a system root: every directory in /home (and /Users on macOS images), plus /root. Service accounts with homes elsewhere (/var/lib/jenkins) are reached through the system dirs or not at all; reading /etc/passwd would trust a file the scanned system controls to point the walk anywhere.

func SystemRoot

func SystemRoot(root string) string

SystemRoot normalises a --system-root value: blank is the live root.

Types

type Scope

type Scope struct {
	// Home adds the invoking user's caches (~/.npm, ~/go/pkg/mod, …).
	Home bool
	// System adds machine-wide install dirs under SystemRoot and the caches in
	// every account's home there, so the answer is the whole host rather than
	// one person's checkout.
	System bool
	// SystemRoot is the filesystem --include-system describes. Blank means "/";
	// a mounted volume, an unpacked image or /proc/<pid>/root describes that
	// system instead of the one the CLI is running on.
	SystemRoot string
}

Scope says which locations beyond the project a resolution covers.

type Target

type Target struct {
	Ecosystem  string // human ecosystem label, e.g. "javascript", "python"
	EngineSlug string // malscan-engine feed slug: npm|pypi|go|cargo|rubygems|nuget|homebrew|generic
	Path       string // absolute path that exists on disk
	UserScoped bool   // true when sourced from a home/user cache (gated by --include-home)
	// SystemScoped is true when the location came from --include-system: a
	// machine-wide install dir, or a cache in another account's home.
	SystemScoped bool
	Label        string // short human label for output, e.g. "node_modules" or "~/.cargo/registry"
}

Target is one resolved scan location handed to the malscan engine.

func Resolve

func Resolve(root string, scope Scope) []Target

Resolve returns every dependency install/cache location that exists for the given scan root. Project-local dirs are always considered; user-scoped/home caches are added for scope.Home, and machine-wide dirs plus every account's caches for scope.System. Results are de-duplicated by absolute path (first ecosystem to claim a path wins), so a shared "vendor" directory is never scanned twice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL