Introducing a new way to review your PRs.

Read the announcement

affaan-m / agentshield

AI agent security scanner. Detect vulnerabilities in agent configurations, MCP servers, and tool permissions. Available as CLI, GitHub Action, ECC plugin, and GitHub App integration. 🛡️

View on GitHub

20 documents · Updated Sep 11, 2026

docs / supply-chain-security

Supply-chain security

AgentShield checks whether agent integrations and their dependencies can be trusted before they run. It finds package references in agent configuration and package files, checks them against local threat intelligence, adds optional npm registry signals, and exposes a separate report and gate for supply-chain risk.

Security boundary

AgentShield treats an MCP server as both an integration and a software dependency. The security boundary therefore covers the package source, the package identity, the version or revision, and the way the package is installed.

Configuration and dependency inputs

The supply-chain view starts with the files already discovered for a scan. It considers MCP server and settings configuration, plus package manifests and lockfiles when they are available. These inputs become a common set of package records so that one risk model can cover direct commands, npx use, git sources, and declared dependencies.

The regular rule set adds related checks around package-manager behavior. It flags plaintext registry credentials, enabled dependency install scripts, and missing or weak release-age controls. These checks protect the conditions that can turn a package risk into code execution or credential loss.

References: src/…/extract.ts• L11-32 src/…/extract.ts• L35-53 src/…/package-manager.ts• L221-319 src/…/package-manager.ts• L388-528

Integration installation signals

MCP configuration can create risk before an application imports a dependency. Automatic npx -y installation removes an approval step. A git URL can point to content that changes later. AgentShield reports these patterns during the normal MCP scan and can then assess the referenced package in the supply-chain report.

References: src/…/mcp.ts• L336-369 src/…/mcp.ts• L847-879 src/…/extract.ts• L161-217

Threat intelligence

AgentShield enriches structural checks with curated intelligence about vulnerable agent tools and hostile packages. This lets a scan distinguish a general installation concern from a package or version that has a known malicious, compromised, or vulnerable history.

Known-bad package intelligence

The intelligence set includes known malicious packages, compromised package versions, and package names that imitate trusted MCP packages. It also records known vulnerable MCP server packages and their CVE identifiers. The supply-chain verifier uses these entries to create critical or high package risks, while the normal MCP rule set turns matching configuration entries into ordinary scan findings.

The known-good package list supports the typosquat check. A package that is close to a trusted name but is not the trusted name receives a warning unless it is an exact known-good match. This signal supports review; it does not prove that every unfamiliar package is malicious.

References: src/…/cve-database.ts• L17-53 src/…/cve-database.ts• L463-582 src/…/cve-database.ts• L601-663 src/…/verify.ts• L34-63

CVE-backed MCP checks

The CVE database covers security issues in AI coding tools and MCP server packages. The MCP rule set checks server commands and arguments against that data during every normal scan. The supply-chain verifier performs the same known-vulnerability lookup for each extracted package and keeps the vulnerability evidence with the package result.

References: src/…/cve-database.ts• L242-460 src/…/mcp-cve.ts• L8-60 src/…/verify.ts• L45-57

Verification lifecycle

Supply-chain analysis follows the scan because it needs the scan target's discovered files. It produces a package-level report rather than adding package results to the ordinary security finding list.

Package verification flow

The following flow shows how configuration becomes supply-chain evidence and an enforcement decision.

flowchart LR
    A[Discovered config and package files] --> B[Normalized package references]
    B --> C[Offline identity and provenance checks]
    B --> D[Optional npm registry metadata]
    C --> E[Package risks and provenance]
    D --> E
    E --> F[Supply-chain report]
    F --> G[Summary, outputs, and optional gate]

Offline checks cover known malicious names, known vulnerable server packages, typosquatting, and unpinned git revisions. When online mode is enabled, npm metadata adds signals such as deprecation, install-time scripts, very low weekly downloads, a small maintainer set, or recent publication. The report keeps the individual risks and also summarizes npm versus git use, pinned versus unpinned references, known-good packages, and registry-backed results.

References: src/…/verify.ts• L21-107 src/…/types.ts• L27-81 src/…/render.ts• L13-67

Provenance decisions

Provenance describes where a package comes from and how stable its reference is. Exact npm versions and git commit hashes count as pinned. A git URL without a commit hash is high risk because later installs can receive new repository content. Registry metadata is marked separately from offline evidence so that a report shows how much external data supported the decision.

References: src/…/verify.ts• L65-82 src/…/verify.ts• L136-187 src/…/types.ts• L37-43

Enforcement and outputs

The CLI and GitHub Action expose supply-chain analysis as a distinct scan phase. This separation lets teams review package risk even when the main configuration score is unchanged, and lets CI enforce a clear package-risk policy.

Scan and action decisions

The CLI enables supply-chain checks with --supply-chain and can add npm registry data with --supply-chain-online. The GitHub Action enables the check by default and keeps online registry access off by default. Both paths reuse the same extraction, verification, and rendering flow.

For the GitHub Action, the supply-chain status is clean when no package has a risk and risky when at least one package has a risk. The dedicated gate fails only for critical or high package risk when enabled. If the dedicated setting is empty, it follows fail-on-findings; otherwise it uses its own value.

References: src/index.ts• L270-296 src/index.ts• L467-491 src/action.ts• L150-155 src/action.ts• L402-449 src/action-supply-chain.ts• L13-24

Review evidence

Terminal and JSON renderers show the package counts, risk details, provenance, and optional registry details. The GitHub Action adds a job summary and exposes package-risk counts as outputs. Risky package entries include the package name, integration name, severity, risk types, and available evidence so a reviewer can choose to pin, replace, remove, or approve the dependency.

References: src/…/render.ts• L7-112 src/action-supply-chain.ts• L26-60 action.yml• L114-121

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the package reference forms recognized by extractPackages aligned with the MCP and package-manager file types discovered by the scanner.
  • Keep the severity and risk-count rules aligned between SupplyChainReport, the GitHub Action outputs, and the supply-chain gate.
  • When threat-intelligence entries change, review both the normal MCP findings and the package verification results because they consume the same lookups through different report paths.
  • When registry metadata fields or risk thresholds change, update the online-mode explanation and the provenance summary so offline and online evidence remain distinct.
  • When action inputs or outputs change, keep the CLI flags, job summary labels, and action.yml contracts consistent.

Important failure modes

TriggerConsequenceGuard
A package is referenced in a config form that extraction does not recognizeThe package is absent from the supply-chain report and receives no package-level verificationUse supported MCP, manifest, and lockfile reference forms, then confirm the analyzed package count
A git dependency has no commit hashA later install can receive changed repository content and the package receives high unpinned-git riskReplace it with a pinned package version or a git commit reference
Online registry access is disabled or unavailableRegistry-only signals are not added; offline identity and provenance checks still form the reportTreat offline mode as a narrower evidence set and enable online mode when registry context is needed
The supply-chain gate is enabled with only medium or low risksThe report is risky but the action does not fail because the gate only blocks critical or high riskSet the broader findings gate or add a separate policy for lower-severity review
A known-bad package or CVE entry is staleA new campaign or fixed-version boundary may not be reflected in scan resultsUpdate the curated threat-intelligence data and review its consumers

Key files

FileWhy to read it
src/…/extract.tsShows the input boundary for MCP, manifest, lockfile, npm, and git package references.
src/…/verify.tsShows how package identity, provenance, known-bad data, and optional registry data become risk results.
src/…/types.tsDefines the shared package risk, provenance, and report concepts used across the feature.
src/…/cve-database.tsContains the curated CVE, vulnerable-server, malicious-package, and known-good package intelligence.
src/…/mcp-cve.tsShows how known vulnerability intelligence also enriches the normal MCP scan.
src/…/package-manager.tsShows the package-manager hardening checks that protect dependency installation and registry access.
src/action.tsShows where the GitHub Action runs supply-chain analysis and applies its gate.
src/action-supply-chain.tsDefines the action status, gate, and job-summary behavior.
action.ymlDefines the public supply-chain inputs and outputs for GitHub workflows.