AI-generated code introduces new software supply chain risks by recommending packages and dependencies that developers may accept without adequate review. Coding assistants can suggest libraries faster than traditional security processes can evaluate them, and some recommendations point to components that are outdated, malicious, or nonexistent. These risks become particularly dangerous during the build, when dependencies are retrieved and code executes with access to sensitive credentials and network resources.
How AI Coding Assistants Changed the Software Supply Chain
AI coding assistants are changing the software supply chain by making dependency selection faster and less visible to developers. A developer asks for a feature, and the assistant may generate code that imports third-party libraries the developer never specifically selected. When those suggestions are accepted and the required packages are added to the project, new dependencies can enter the build without adequate review.
More Code, More Dependencies, Less Human Review
A single AI-generated suggestion can introduce more than one dependency. One package may pull in dozens of transitive dependencies, so a few lines of generated code can expand your attack surface in ways the developer may not realize. As AI-assisted development accelerates, more dependencies can enter the codebase across more pull requests, making it increasingly difficult for teams to review every component.
The Supply Chain Risks AI-Generated Code Introduces
AI-generated code introduces three supply chain risks worth separating. It can recommend nonexistent packages, suggest insecure or outdated dependencies, and produce changes faster than teams can adequately review them.
Hallucinated and Unverified Package Suggestions
AI models sometimes recommend packages that were never published. A large-scale study first published in 2024 analyzed 576,000 AI-generated code samples and found that an average of 5.2% of packages recommended by commercial models and 21.7% of those recommended by open-source models were hallucinated, under the study’s test conditions. Attackers turn that predictability into an attack called slopsquatting, registering hallucinated names in public registries with malicious payloads. A developer who trusts the suggestion and runs an install hands execution straight to the attacker.
Insecure or Outdated Dependency Recommendations
AI assistants lean toward patterns common in their training data, which skews recommendations toward library versions that were current when that data was collected. Some of those versions carry vulnerabilities that have since been disclosed and patched upstream. Because the model reaches for what it learned rather than what is current, a single generated file can introduce known-vulnerable dependencies, and the same suggestion can repeat across many repositories.
Volume and Velocity Outpacing Security Review
The speed of AI-assisted development is the risk multiplier. Generated code arrives faster than analysts can read it, and gates that assume human-paced change fall behind. When AI-generated code grows faster than a team’s ability to review it, manual security checks become increasingly difficult to sustain, especially under deadline pressure.
Why Traditional Tools Struggle with AI-Introduced Risk
Traditional security scanners primarily examine code, dependencies, and artifacts rather than monitoring live build-time network activity. Even when these scanners run within CI/CD pipelines, they generally cannot detect and block a build reaching an unauthorized server or attempting to exfiltrate secrets in real time.
Why Newly Published Packages Can Evade Security Scanners
Traditional SCA tools are effective at identifying known vulnerabilities and malicious packages, but newly published slopsquatting packages may not yet appear in vulnerability databases or threat intelligence feeds. More advanced scanners can identify suspicious package characteristics, but malicious behavior that emerges during installation remains difficult to predict from static analysis alone.
The danger isn’t limited to AI-generated dependencies. In the March 2026 Axios npm compromise, attackers introduced a malicious dependency into legitimate package releases. During installation, that dependency downloaded additional payloads from attacker-controlled infrastructure. The incident illustrates why examining dependency names and known vulnerabilities alone may not be enough to prevent malicious build-time behavior.
Review Cannot Keep Pace with AI Output
When review cannot keep pace, dependencies are the first thing to slip. Reviewers spend their attention on whether the logic works and wave the package list through, trusting that the model chose well. OpenSSF guidance warns against that reflex, telling teams to treat AI-written code as potentially insecure and to vet the packages it suggests rather than assume the model’s choices are safe. Across dozens of services and daily commits, the dependency no one examined is the one most likely to carry the risk.
How Build-Time Enforcement Catches What AI Pulls In
Build-time enforcement catches AI-introduced risk by watching the build as it runs and acting on what actually happens. Rather than trusting a manifest or a scan result, it observes the real network traffic of the pipeline and measures it against policy. That placement reveals components and connections that pre-build and post-build tools cannot.
See the Dependencies Your Build Actually Downloads
Build-time inspection provides visibility into dependencies retrieved through the monitored build network, including transitive packages and additional resources downloaded by install scripts. This helps teams identify what their builds actually retrieved, rather than relying solely on declared dependencies in a manifest.
Block Unverified Packages and Sources in Real Time
Build-time policy enforcement can help prevent risky dependencies from entering a build by restricting package sources, blocking disallowed packages, and applying controls to newly published dependencies. If a malicious package executes, the BAF can also detect and block unauthorized network activity, such as attempts to contact attacker-controlled servers or exfiltrate credentials.
Secure AI-Assisted Development With InvisiRisk
AI-assisted development is accelerating the introduction of new code and dependencies, making build-time visibility and enforcement increasingly important. InvisiRisk’s Build Application Firewall sits inline with your CI/CD pipeline, inspecting network traffic and enforcing security policies as builds run. It helps control dependency downloads, block unauthorized connections, and prevent attempts to exfiltrate credentials and secrets. Combined with the SCA capabilities available in InvisiRisk Pro, teams can address both known dependency vulnerabilities and suspicious behavior during the build, without sacrificing the speed of AI-assisted development.
FAQs
What is slopsquatting in AI-generated code?
Slopsquatting is a software supply chain attack in which an attacker publishes a malicious package under a name that an AI coding assistant is likely to invent. If a developer or automated agent subsequently installs that package, the attacker’s code can execute during installation or use.
Can traditional SCA tools detect malicious AI-generated dependencies?
SCA tools can identify known vulnerabilities and, depending on their capabilities, suspicious or malicious packages. However, newly published dependencies may not yet have known vulnerability records or malware signatures. Build-time enforcement provides an additional layer of protection by monitoring dependency retrieval and blocking unauthorized activity while builds execute.
Book a demo today and get a clear picture of what moves through your CI/CD pipeline.
Resources:
best.openssf.org/Security-Focused-Guide-for-AI-Code-Assistant-Instructions.html


