Scanning engine
How ShieldX turns "list of installed extensions" into a risk-scored report. Read this before tuning thresholds or filing a "false positive" issue.
Pipeline order
For every installed extension, ShieldX runs the analyzers in this order:
- Package analyzer — reads
package.jsonmetadata (publisher, repository, declared activation events, contributed commands, install scripts). - Code analyzer — scans extension JavaScript/TypeScript for known suspicious patterns.
- Dependency analyzer — collects declared runtime dependencies and checks them against a known-vulnerable set.
- GitHub reputation — looks up repository stats (stars, open issues, last push) for verified or well-known publishers.
- OSV vulnerabilities — queries OSV.dev for known advisories on each runtime dependency (when enabled).
- Risk aggregation — combines signals into a numeric score and a level bucket.
- Recommendation generator — selects a short human-readable message based on the dominant signals.
- Diff vs. previous scan — labels each extension as new, removed, or risk-changed.
Package analyzer
Looks for absent or suspicious metadata: missing repository URL, unknown publisher, unusually broad activation events, install scripts, and requested commands whose titles match sensitive keywords (upload, execute, secret, token, …).
Code analyzer
Matches patterns from src/rules/suspicious-patterns.ts against bundled JS. Examples include dynamic eval of remote content, raw child_process spawns with user input, and obvious obfuscation markers. The analyzer does not execute extension code.
Patterns are intentionally narrow: a plain eval( inside a bundled library, a local development server URL, or reading package.json are not treated as exfiltration.
Dependency analyzer
Resolves declared dependencies and peerDependencies. devDependencies are listed but ignored for vulnerability checks, because they are not shipped with the extension.
With shieldx.scanNodeModules enabled, the code analyzer also walks node_modules inside the extension package.
GitHub reputation
For extensions in the verified repository list, or published under a well-known publisher namespace where the repository owner matches the publisher, ShieldX pulls:
- Star count
- Open issue count
- Last push date
Few open issues, recent pushes, and many stars are recorded as trust signals. Many open issues or a long-abandoned repository are recorded as risk factors.
Verified Repositories & Publishers: To prevent spoofing where a malicious extension specifies a popular repository/npm package in its metadata, reputation lookups are restricted. ShieldX only queries external reputation endpoints if the extension is in a verified repository list or is published under a well-known publisher namespace (e.g., microsoft, github) where the repository owner matches the publisher.
OSV vulnerability lookup
When shieldx.enableOsvScan is true, each runtime dependency is queried against OSV.dev using the batch API. Matching advisories contribute weighted risk based on severity.
Risk aggregation
The aggregator sums weighted signals and maps the total to a level:
| Level | Meaning |
|---|---|
| Low | No notable signals |
| Moderate | One notable signal or weak combined evidence |
| High | Multiple signals or one known vulnerability |
| Critical | Strong combined evidence; manual review required |
Cutoffs live in the scanner module and may shift between versions. Do not hard-code them in external tooling — use the level string.
Diffing
Each completed scan is compared to the previous cached scan. Per extension, ShieldX records whether it is new, removed, or changed risk score/level. The diff is written to the ShieldX output channel and risk-level changes are logged as warnings.
Limitations
- ShieldX cannot prove an extension is safe — only that visible signals are clean
- It cannot detect runtime payloads fetched after install
- It cannot inspect extensions that the editor refuses to enumerate (corrupt installs, partial uninstalls)
- GitHub signals are unavailable for extensions whose publisher is not verified
- OSV coverage is limited to ecosystems OSV indexes