npm Application Analysis

npm Application Analysis

IQ evaluates JavaScript applications using Advanced Binary Fingerprinting (ABF) enhanced with metadata-assisted hash-based matching. This method analyzes package metadata (package.json and lock files) and the SHA-1 hashes of nearby JavaScript files to precisely identify npm components.

The result is a component inventory based on the actual files present in the application rather than just the declared dependency metadata. This helps reduce false positives and improves accuracy in both security and license reporting.

How IQ Identifies npm Components

IQ’s npm application analysis process is designed to do the following:

1 - Metadata Parsing

During a scan, IQ collects all package.json files present in the application. These files act as anchors for component identification.

For each package.json, IQ extracts the name and version. These coordinates define the package version that the scanner will attempt to match.

2 - Find Official Package Hashes

Using Sonatype’s proprietary data sources, the scanner determines the SHA-1 hashes associated with the package’s published files. This returns the definitive set of expected file hashes for that package version.

3 - Candidate File Discovery

For each dependency, the scanner reviews JavaScript files located near its package.json file. These files are evaluated to determine whether they belong to that dependency’s published package contents.

A note on which package.json files are used
The package.json files inside each dependency’s own directory (not the application’s root package.json) drive most identification. These dependency package.json files are created automatically when npm or yarn builds node_modules, and they provide the metadata that powers matching.

Only files that can be confidently associated with a dependency are included in the inventory.

4 - Hash Comparison

IQ computes the SHA-1 hash for each candidate file and compares it to the official hashes retrieved from Sonatype’s proprietary data in step 2.

If a file hash matches, the following happens:

Files that do not match known hashes are excluded from the component inventory, even if located near a dependency’s metadata. This ensures the analysis reflects only the code that is truly present and reduces noise in security and license reporting.

Advanced Binary Fingerprinting Behavior: JavaScript Files vs. Manifest Files

Scan behavior depends on which files are included in that scan:

When JavaScript files are included:

When only manifest and lock files are included:

Supported Scan Targets

Supported scan targets include the following:

Results include component identity, license data, and security findings.

For the most precise results, you should include a package.json, package-lock.json, and the node_modules folder.

Legacy A-Name Behavior (Sunset)

In earlier IQ versions, JavaScript files that could not be matched to an npm package were sometimes identified as A-name components. This legacy mechanism assigned authoritative names to individual files.

A-name matching has been sunset as of 2025-09-10:

Unknown JavaScript files can be viewed by adding ?unknownjs to the end of the report URL.