DVA Vibe Academy · Class #72 · Free · No Signup
CVE PASS

Security of AI-Generated Code

The vibe coder's hardening guide. Scan, gate, and harden AI-built software before exploitable code reaches production.

By Robert McCullock Reading time ~55 min Level Advanced Published July 25, 2026
  • 2.74x higher vulnerability rate in AI-generated code vs. human-written code (Source: Veracode, CSA 2026).
  • 6 verified tools: Semgrep, CodeQL, Snyk Code, gitleaks, trufflehog, npm audit.
  • Slopsquatting defense: catch hallucinated packages before they enter your dependency tree.
  • CI/CD security gates: three automated checks that block vulnerable merges.
Quick Answer

AI-generated code carries a 2.74x higher vulnerability rate than human-written code (Source: Veracode, Cloud Security Alliance 2026). The standard hardening workflow is: scan every PR with a SAST tool (Semgrep or CodeQL), detect secrets with gitleaks, audit dependencies with npm audit or Snyk, pin all packages to exact versions, and wire all three checks as required CI/CD gates. For AI-specific threats, verify that every AI-suggested package actually exists in the public registry to defend against slopsquatting, and threat-model every AI-built feature that touches authentication, data storage, or user input.

Key Takeaways
  • Approximately 45% of AI-generated code samples contain vulnerabilities mapped to the OWASP Top 10 (Source: Veracode, Cloud Security Alliance 2026).
  • AI-generated code has a 2.74x higher vulnerability density than human-written code (Source: Veracode 2026).
  • Slopsquatting: attackers register malicious packages using names that AI models hallucinate. Term coined by Seth Larson, Python Developer-in-Residence.
  • Three CI/CD gates catch the highest-risk categories: SAST (code), SCA (dependencies), secret scanning (credentials).
  • Semgrep: sub-second PR scanning with custom rules. CodeQL: deep semantic analysis. Snyk Code: AI-powered pattern matching.
  • gitleaks: pre-commit secret detection in milliseconds. trufflehog: deep scanning with live secret verification.
  • Dependency pinning + lockfiles + provenance attestation block both known-vulnerable and hallucinated packages.
  • Prompt injection is the number-one risk in the OWASP Top 10 for LLM Applications 2025. Defense is five layers deep.
Module 01

Why AI-Generated Code Is a Security Risk

Answer Capsule AI models reproduce insecure patterns from their training data at scale. They prioritize functional correctness over security, producing code that works but is exploitable. The velocity gain from AI coding creates a security debt that accumulates faster than teams can remediate.

Vibe coding accelerates development by 3x to 4x. But that velocity has a cost. Developers using AI coding assistants introduce security findings at 10x the rate of their peers because AI-generated code inherits the insecure patterns present in its training data (Source: Cloud Security Alliance, Veracode 2026).

The core problem is that AI models optimize for "does it work," not "is it safe." A model that generates a working Express.js endpoint will skip input validation, omit rate limiting, hardcode an API key, and use HTTP instead of HTTPS. The endpoint works. It also has four exploitable vulnerabilities.

In 2026, investigations of vibe-coded applications uncovered thousands of vulnerabilities including hardcoded secrets and exposed personally identifiable information (Source: Cloud Security Alliance 2026). This is not a theoretical risk. It is the measured reality of shipping AI-generated code without security gates.

The Velocity Trap

AI-generated commits ship at 3-4x the rate of manually written code. Security findings accumulate at 10x the rate. If your security scanning runs slower than your AI-assisted development, you are accumulating exploitable debt faster than you can pay it down (Source: Cloud Security Alliance 2026).

Module 02

The AI Code Risk Surface

Answer Capsule The risk surface of AI-generated code spans three layers: the code itself (injection, broken access control, insecure defaults), the supply chain (hallucinated and vulnerable dependencies), and the AI-specific attack vectors (prompt injection, excessive agency, information disclosure). Each layer requires its own detection and mitigation tooling.
Layer 1

Code Vulnerabilities

Injection flaws, missing input validation, hardcoded secrets, insecure defaults, broken access control. SAST scanners detect these.

Layer 2

Supply Chain

Vulnerable dependencies, outdated packages, hallucinated package names (slopsquatting), missing provenance. SCA and dependency audits detect these.

Layer 3

AI-Specific Threats

Prompt injection, excessive agency, system prompt leakage, sensitive information disclosure. OWASP Top 10 for LLM Applications 2025 maps these.

Treat AI Code as Untrusted Input

The 2026 industry consensus is to treat every block of AI-generated code as untrusted input. It must pass through automated static analysis, dependency scanning, and secret detection before reaching any branch (Source: Kusari.dev, Cloud Security Alliance 2026).

Module 03

The Vulnerability Taxonomy

Answer Capsule AI-generated code vulnerabilities map directly to the OWASP Top 10. The six most prevalent categories are broken access control, injection flaws, security misconfiguration, cryptographic failures, server-side request forgery, and insecure deserialization. AI models reproduce these because they appear frequently in training data without the security context that identifies them as dangerous.
AI Code Vulnerability Map (OWASP-aligned, July 2026)
CategoryOWASP MappingWhat AI Gets WrongDetection
Broken Access ControlA01:2025Missing auth middleware, no row-level security, insecure API endpointsCodeQL, Semgrep
Injection FlawsA05:2025SQL injection, XSS, command injection from missing input validationSemgrep, Snyk Code
Security MisconfigurationA02:2025Debug mode enabled, CORS wildcard, verbose error messages in productionSemgrep custom rules
Cryptographic FailuresA03:2025Hardcoded API keys, weak hashing (MD5/SHA1), HTTP instead of HTTPSgitleaks, trufflehog
SSRFA10:2025Unvalidated URL inputs passed to server-side fetch callsCodeQL data-flow analysis
Insecure DeserializationA08:2021Unvalidated JSON parsing, unsafe eval of serialized dataSemgrep, manual review

Why AI Reproduces These Patterns

AI models learn from public codebases. Public codebases contain millions of examples of insecure patterns: database queries built with string concatenation, API keys stored in configuration files committed to repositories, and endpoints that accept any input without validation. The model does not know these are bad. It knows they are common. Frequency in training data drives generation probability, not security quality.

Source Verification

The vulnerability categories and OWASP mappings above are sourced from the OWASP Top 10 Web Application Security Risks (2025 edition), Veracode's State of Software Security report (2026), and Cloud Security Alliance research on AI-generated code security (2026). The 2.74x vulnerability density figure is from Veracode.

Module 04

Tool Walkthrough: The Security Scanner Ecosystem

Answer Capsule The 2026 security scanner ecosystem splits into SAST tools (Semgrep, CodeQL, Snyk Code) for code analysis, secret scanners (gitleaks, trufflehog) for credential detection, and SCA tools (npm audit, Snyk, Dependabot) for dependency risk. Most teams use a layered approach: a fast scanner on every PR plus a deep analyzer for governance.
Security Tool Comparison (verified July 2026)
ToolCategoryBest ForLicenseKey Strength
SemgrepSASTPR-level speed, custom rulesLGPL 2.1 (OSS)Sub-second scans, policy-as-code
CodeQLSASTDeep semantic analysisFree for OSSData-flow tracking, reachability analysis
Snyk CodeSAST + SCAUnified platformCommercial (free tier)DeepCode AI trained on AI-generated patterns
gitleaksSecret ScannerPre-commit speedMITMillisecond regex matching, pre-commit hooks
trufflehogSecret ScannerDeep scanning + verificationAGPL 3.0Live secret verification via safe API calls
npm auditSCANode.js baselineBuilt-inZero-config, runs with any npm project
DependabotSCAGitHub-native workflowsFree (GitHub)3-day cooldown on new versions (2026)

Semgrep: Quick Start

Semgrep is a SAST tool that uses pattern-based rules to find vulnerabilities. It scans in sub-second time on typical PRs, supports 30+ languages, and lets you write custom rules to enforce organization-specific security policies (Source: semgrep.dev). Its "Semgrep Assistant" uses AI to help iterate on rule authorship.

Terminal
# Install and run Semgrep with security-focused rules
pip install semgrep
semgrep --config=p/security-audit ./src

# Run the OWASP Top 10 ruleset
semgrep --config=p/owasp-top-ten ./src

# Scan only the files changed in a PR
semgrep --config=p/security-audit --diff-aware

gitleaks: Secret Detection

gitleaks detects hardcoded secrets using regex-based pattern matching. It runs in milliseconds and is designed to be a pre-commit hook, catching credentials before they enter the repository (Source: github.com/gitleaks/gitleaks).

Terminal
# Install gitleaks
brew install gitleaks    # macOS
# or download from GitHub releases

# Scan the current repository
gitleaks detect --source=. --verbose

# Install as a pre-commit hook
# In .pre-commit-config.yaml:
repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.21.0
    hooks:
      - id: gitleaks

trufflehog: Deep Scanning with Verification

trufflehog scans Git history, S3 buckets, Docker images, and more. Its key advantage is verifier modules that make safe, read-only API calls to confirm whether a detected secret is actually live, reducing alert fatigue (Source: github.com/trufflesecurity/trufflehog).

Terminal
# Scan entire Git history with live verification
trufflehog git file://. --only-verified

# Scan a GitHub repository
trufflehog github --repo=https://github.com/your-org/your-repo --only-verified
Source Verification

All tool descriptions above are verified against primary documentation (semgrep.dev, github.com/gitleaks, github.com/trufflesecurity, snyk.io, docs.github.com/codeql) as of July 2026. Feature sets, pricing, and licensing can change. Always verify against the tool's official docs before adopting.

Module 05

Hands-On: The Hardening Build

Answer Capsule The hardening build is a three-step process: scan your AI-generated code with Semgrep, detect secrets with gitleaks, and audit dependencies with npm audit. Each step produces actionable findings. Fix the high-severity findings first, then wire all three into your CI/CD pipeline as required checks.

Step 1: SAST Scan with Semgrep

Run Semgrep against your project. Focus on high and critical severity findings. A typical AI-generated Node.js project will surface injection flaws, missing input validation, and insecure crypto usage.

Terminal / Semgrep Output
$ semgrep --config=p/security-audit ./src --json | jq '.results | length'
12

$ semgrep --config=p/security-audit ./src
src/api/users.js
  severity: ERROR
  rule: javascript.express.security.audit.xss.mustache-escape
  12: res.send(`

${req.query.name}

`) fix: Sanitize user input before rendering in HTML responses. src/db/queries.js severity: ERROR rule: javascript.lang.security.audit.sqli.node-postgres 8: const result = await pool.query(`SELECT * FROM users WHERE id = '${userId}'`) fix: Use parameterized queries: pool.query('SELECT * FROM users WHERE id = $1', [userId])

Step 2: Fix the Injection

The SQL injection finding above is a textbook AI-generated vulnerability. The model built a working query using string interpolation. The fix is a parameterized query.

JavaScript / Fix
// BEFORE (AI-generated — vulnerable to SQL injection)
const result = await pool.query(
  `SELECT * FROM users WHERE id = '${userId}'`
);

// AFTER (hardened — parameterized query)
const result = await pool.query(
  'SELECT * FROM users WHERE id = $1',
  [userId]
);

Step 3: Secret Scan with gitleaks

Terminal / gitleaks Output
$ gitleaks detect --source=. --verbose

Finding:     AKIAIOSFODNN7EXAMPLE
Secret:      AKIAIOSFODNN7EXAMPLE
RuleID:      aws-access-key-id
Entropy:     3.52
File:        src/config/aws.js
Line:        4
Commit:      a1b2c3d

# Fix: move the key to an environment variable
# Delete the line from source, rotate the AWS key immediately
# Add src/config/aws.js patterns to .gitignore if needed

Step 4: Dependency Audit

Terminal / npm audit
$ npm audit

# high    Prototype Pollution in lodash < 4.17.21
# fix:    npm audit fix
# or:     npm install lodash@4.17.21

# Always use npm ci in CI/CD (respects lockfile exactly)
$ npm ci
Practical Starting Point

Run these three commands on your current project right now: semgrep --config=p/security-audit ./src, gitleaks detect --source=., npm audit. The three outputs give you an immediate picture of your AI-generated code's security posture. Fix the critical findings first. Then read Module 07 to make these checks permanent in your CI/CD pipeline.

Module 06

Slopsquatting Defense: Catching Hallucinated Dependencies

Answer Capsule Slopsquatting is a supply-chain attack where attackers register malicious packages using names that AI models hallucinate. The term was coined by Seth Larson, Python Developer-in-Residence. Because AI hallucinations are repeatable, attackers can predict and pre-register targeted package names. Defense requires verifying every AI-suggested package, pinning all dependencies to exact versions, and enforcing lockfile integrity in CI/CD.

How the Attack Works

  1. AI hallucinates a package name: your AI assistant suggests pip install fastapi-middleware or npm install react-auth-helper. The package does not exist.
  2. Attacker registers the name: attackers monitor AI models for frequently hallucinated names and pre-register them on npm or PyPI (Source: Seth Larson, Snyk, Palo Alto Networks 2025-2026).
  3. Developer runs the install: the malicious package enters the project, potentially stealing credentials, installing backdoors, or executing arbitrary code.
Agentic Risk

With autonomous coding agents, the install can happen without human review. The AI both generates the hallucinated dependency name and executes the installation command. This creates an infection path with zero human oversight. Never allow AI agents to run package installation commands without an explicit human approval step or a pre-approved dependency allowlist (Source: Cloud Security Alliance 2026, Mallory.ai).

Defense Checklist

  • Verify before installing: check that every AI-suggested package exists on the official registry (npmjs.com, pypi.org). Check the publisher identity, download count, and registration date. A package registered last week with 12 downloads is suspicious.
  • Pin dependencies: lock every dependency to an exact version in your lockfile. Avoid semver ranges (^ or ~) that auto-update to potentially compromised patches.
  • Use npm ci in CI/CD: unlike npm install, npm ci respects the lockfile exactly and fails if the lockfile does not match package.json.
  • Verify provenance: where available, verify package provenance attestations that confirm build integrity (Source: GitHub Blog, npm documentation).
  • Generate an SBOM: use CycloneDX or SPDX to generate a Software Bill of Materials on every build. This creates an auditable inventory of every dependency, making it possible to trace hallucinated packages after the fact (Source: CISA AI-BOM guidance, May 2026).

Catching a Hallucinated Package

Terminal / Verification
# AI suggested: npm install express-secure-session
# Step 1: Check if it exists
npm view express-secure-session
# If the response is "npm ERR! 404 Not Found" — the package does not exist.
# The AI hallucinated it. Do NOT install.

# Step 2: If it exists, check metadata
npm view express-secure-session time created
npm view express-secure-session maintainers
# Red flags: created recently, single anonymous maintainer, very low downloads

# Step 3: Check for known alternatives
npm search secure session
# Use the established, well-maintained package instead
Evolving Threat

By 2026, slopsquatting has evolved into more advanced variants. HalluSquatting combines hallucinated resources with prompt injection to force agents to execute unauthorized code. Phantom Squatting extends the concept from packages to hallucinated web domains and API endpoints (Source: Palo Alto Networks 2026). The defense remains the same: verify before you trust.

Module 07

CI/CD Security Gates: Automated Protection

Answer Capsule Wire three security gates into your CI/CD pipeline as required checks: SAST scanning (Semgrep), secret detection (gitleaks), and dependency auditing (npm audit). Configure each to fail the build on high-severity findings. No pull request merges until all three pass. This catches the three highest-risk categories in AI-generated code before they reach production.

GitHub Actions: Three-Gate Security Pipeline

YAML / GitHub Actions
# .github/workflows/security-gates.yml
name: AI Code Security Gates
on: [pull_request]

jobs:
  sast-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Semgrep SAST
        uses: returntocorp/semgrep-action@v1
        with:
          config: p/security-audit p/owasp-top-ten
      # Semgrep action exits non-zero on findings by default

  secret-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full history for git scanning
      - name: Run gitleaks
        uses: gitleaks/gitleaks-action@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  dependency-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
      - run: npm ci
      - name: Audit dependencies
        run: npm audit --audit-level=high
        # Exits non-zero if high/critical vulns found

Making Gates Required

After the workflow runs, configure the three jobs as required status checks in your repository settings. Navigate to Settings, then Branches, then Branch protection rules. Add sast-scan, secret-scan, and dependency-audit as required checks. With this configuration, no pull request can merge until all three gates pass.

Cost: Zero

All three gates use open-source tools. Semgrep OSS, gitleaks, and npm audit are free. GitHub Actions provides 2,000 free minutes per month for public repositories and a generous free tier for private repositories. The entire security pipeline costs nothing to run.

Module 08

Prompt Injection Defense for AI-Built Applications

Answer Capsule If you are building an application that accepts user input and passes it to an LLM, prompt injection is your primary threat. It is ranked number one in the OWASP Top 10 for LLM Applications (2025 edition). The defense is five layers deep: input separation, strict validation, output monitoring, human-in-the-loop for high-stakes actions, and least-privilege architecture.

The OWASP Top 10 for LLM Applications (2025)

RankRiskRelevance to Vibe Coders
LLM01Prompt InjectionAny app that passes user text to a model
LLM05Improper Output HandlingRendering AI output without sanitization
LLM03Supply Chain VulnerabilitiesThird-party models, datasets, plugins
LLM06Excessive AgencyAI agents with too many permissions
LLM02Sensitive Information DisclosurePII leakage through model outputs
LLM07System Prompt LeakageUsers extracting your system instructions

Five-Layer Defense

  1. Input separation: use distinct API message roles (system vs user) to keep developer instructions separate from user input. Never concatenate them into a single string.
  2. Strict input validation: validate all user input against allowlists and schema constraints before it reaches the model. Reject inputs that contain instruction-like patterns.
  3. Output monitoring: scan model outputs for forbidden patterns, system prompt fragments, or sensitive data before relaying them to the user.
  4. Human-in-the-loop: for high-stakes actions (deleting data, sending emails, executing code), require explicit human authorization before the AI's suggested action is executed (Source: OWASP GenAI Security Project).
  5. Least privilege: design systems under the assumption that injection will succeed. Give the LLM only the minimum permissions needed. An injected model with read-only database access causes less damage than one with admin privileges.
Assume Compromise

No input filter is 100% effective against prompt injection. Researchers continue to find novel bypass techniques. The correct architecture assumes that injection will eventually succeed and limits the blast radius through least-privilege permissions, action logging, and human approval gates for irreversible operations (Source: OWASP Top 10 for LLM Applications 2025).

Module 09

Threat Modeling AI-Built Features

Answer Capsule Threat modeling is the practice of identifying what can go wrong before you ship. For AI-built features, add three AI-specific questions to your standard threat model: did the AI hallucinate a dependency, did it store a secret in source code, and did it validate user input on every path that accepts it. Run this analysis on every feature that touches authentication, data storage, or external APIs.

AI-Specific Threat Model Questions

Question 1

Hallucinated Dependencies

Did the AI suggest any packages that do not exist in the public registry? Verify every import and install command against npmjs.com or pypi.org before accepting the code.

Question 2

Exposed Secrets

Did the AI store API keys, database passwords, or tokens in source code instead of environment variables? Run gitleaks on every commit to catch this automatically.

Question 3

Input Validation

Does every endpoint, form handler, and database query validate its input? AI-generated code routinely skips validation because it is not needed for the "happy path" the model was trained on.

Question 4

Access Control

Does the feature enforce authentication and authorization on every route? AI often generates routes without middleware. Check that no endpoint is accessible without proper credentials.

The Review-Before-Merge Protocol

The most effective security practice for AI-generated code is the simplest: review before you merge. Not every line. Focus your human review on four areas:

  • Authentication logic: login flows, session handling, token validation.
  • Database queries: any code that reads from or writes to a database.
  • API endpoints: routes that accept user input or return sensitive data.
  • Dependency additions: any new package added to package.json or requirements.txt.

Automated tools catch the patterns. Human review catches the logic flaws that require business context to identify. The combination is what makes the system effective.

Pair with Evals

This security masterclass pairs with the Evals and Testing AI Output masterclass. Together they form the quality gate for AI-built software. Evals catch correctness failures (the AI output is wrong). Security scanning catches safety failures (the AI output is exploitable). Ship neither without both gates passing.

Module 10

Frequently Asked Questions

AI models reproduce insecure patterns from their training data. Research from Veracode and the Cloud Security Alliance shows that approximately 45% of AI-generated code samples contain vulnerabilities mapped to the OWASP Top 10. AI-generated code carries a 2.74x higher vulnerability density than human-written code because models prioritize functional correctness over security, producing code with missing input validation, hardcoded secrets, and insecure default configurations.

Slopsquatting is a supply-chain attack where attackers register malicious packages using names that AI models hallucinate. The term was coined by developer-in-residence Seth Larson. When an AI coding assistant suggests a non-existent package, attackers pre-register that name on npm or PyPI. If a developer runs the install command, the malicious package enters their project. Hallucinations are repeatable across sessions, making them predictable targets for attackers. Defense requires verifying every AI-suggested package against the registry before installing.

Three tools cover the primary SAST needs for AI-generated code. Semgrep provides sub-second PR-level scanning with custom rules and is widely used for enforcing organization security policies. CodeQL offers deep semantic analysis with data-flow tracking for complex logic flaws. Snyk Code uses DeepCode AI trained on vulnerability patterns in AI-generated code and provides a unified platform combining SAST, SCA, and container security. Most teams use a layered approach: a fast scanner like Semgrep on every PR plus a deeper engine for governance.

Use gitleaks as a pre-commit hook to catch secrets before they enter the repository. It uses regex-based pattern matching and runs in milliseconds. For deeper scanning across Git history, S3 buckets, and Docker images, use trufflehog, which includes verifier modules that make safe read-only API calls to confirm whether a detected secret is actually live. The 2026 best practice is to combine both: gitleaks at the pre-commit stage and trufflehog as a CI/CD pipeline gate.

The most common vulnerabilities mapped to OWASP categories are: Broken Access Control (missing authentication middleware, absent row-level security), Injection Flaws (SQL injection, XSS, command injection from missing input validation), Security Misconfiguration (insecure default settings, debug mode enabled), Cryptographic Failures (hardcoded API keys, weak hashing algorithms), and Server-Side Request Forgery through unvalidated URL inputs. AI models reproduce these patterns because they appear frequently in training data without the security context that tells a human developer they are dangerous.

Add three gates to your CI/CD pipeline: a SAST scan (Semgrep or CodeQL) that fails the build on high-severity findings, a dependency scan (npm audit, Snyk, or Dependabot) that blocks merges with known vulnerable packages, and a secret scan (gitleaks) that rejects any commit containing detected credentials. Configure each gate as a required check in your GitHub Actions workflow so pull requests cannot merge until all three pass. This catches the three highest-risk categories in AI-generated code: code vulnerabilities, supply chain risks, and secrets exposure.

Dependency pinning means locking every dependency to an exact version in your lockfile rather than using semver ranges. It matters for AI-generated code because AI models frequently suggest packages without specifying versions, defaulting to the latest available. If a package is later compromised, unpinned dependencies automatically pull the malicious version. Always use lockfiles, run npm ci instead of npm install in CI/CD, and verify package provenance attestations where available.

A Software Bill of Materials is a complete inventory of every component, library, and dependency in your project. For AI-generated code, SBOMs are critical because the developer often does not know what dependencies the AI introduced. CISA and G7 partners released joint AI-BOM guidance in May 2026 recommending documentation of models, datasets, and dependencies. CycloneDX and SPDX are the two primary standards. Generate your SBOM automatically in CI/CD so it stays current with every build.

Prompt injection is ranked the number-one risk in the OWASP Top 10 for LLM Applications 2025. Defend with five layers: separate system instructions from user input using distinct API message roles, validate all user input against allowlists before it reaches the model, scan model outputs for forbidden patterns before relaying them to users, require human authorization for high-stakes actions like deleting data or sending emails, and design systems under the assumption that injection will succeed by applying least-privilege permissions to all LLM tool access.

The OWASP Top 10 for LLM Applications (2025 edition) is the industry-standard framework for AI security risks. The ten risks are: Prompt Injection, Sensitive Information Disclosure, Supply Chain Vulnerabilities, Data and Model Poisoning, Improper Output Handling, Excessive Agency, System Prompt Leakage, Vector and Embedding Weaknesses, Misinformation, and Unbounded Consumption. For vibe coders building with AI, the three most relevant are Prompt Injection, Improper Output Handling, and Supply Chain Vulnerabilities.

The two classes form a quality gate pair. The Evals and Testing masterclass covers output correctness: measuring whether AI-generated content is accurate, faithful, and relevant. This Security masterclass covers output safety: ensuring AI-generated code does not introduce exploitable vulnerabilities. Together they address the two failure modes of AI-built software: it can be wrong (evals) and it can be dangerous (security). Complete both for full coverage.

Yes for security-critical paths. No for every line in every file. The practical approach is to treat AI-generated code as untrusted input: run automated SAST, SCA, and secret scanning on everything, then focus manual review on authentication logic, database queries, API endpoints, and any code that handles user input or sensitive data. Automated tools catch the systematic patterns. Human review catches the logic flaws that require business context to identify.

Threat modeling is the practice of systematically identifying what can go wrong with a feature before you build it. For AI-built features, add three AI-specific questions to your threat model: what happens if the AI hallucinated a dependency that does not exist, what happens if a user injects malicious instructions through an input field the AI built, and what happens if the AI stored a secret in the source code instead of an environment variable. Run this analysis on every feature that touches authentication, data storage, or external APIs.

Nothing. This masterclass is 100% free. No signup, no email, no paywall, no certificate requirement. It is part of the DDS Vibe Academy, a free AI coding curriculum built by Robert McCullock at Design Delight Studio.

Start with Module 03 of this masterclass: The Vulnerability Taxonomy. Read through the six categories to understand what to look for. Then jump to Module 05: the hands-on build where you install Semgrep and gitleaks, scan a project, and set up your first CI/CD security gate. The setup takes under 30 minutes. After that, read Module 06 on slopsquatting defense to protect your dependency tree. The entire hardening workflow can be operational in a single afternoon.

Bottom Line

If you ship AI-built software, you need security gates. AI-generated code carries a 2.74x higher vulnerability rate than human-written code (Source: Veracode 2026). The fix is three automated checks in your CI/CD pipeline: SAST scanning with Semgrep, secret detection with gitleaks, and dependency auditing with npm audit. All three are free and open-source. Wire them as required GitHub Actions checks so no pull request merges without passing all three. For AI-specific threats, verify every AI-suggested package against the public registry to block slopsquatting, and threat-model every feature that touches authentication or user input. This masterclass pairs with the Evals and Testing AI Output class. Evals catch correctness failures. Security gates catch safety failures. Ship neither without both.