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 ¶
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 ¶
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 ¶
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 ¶
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.