Leanpub Header

Skip to main content

Practical AI Security Engineering

Building and Operating Secure AI Systems in Production

This book is 100% completeLast updated on 2026-08-01

AI changes the security game. New attack paths demand new ways of thinking. This practical guide shows you how to build, deploy and defend AI systems with confidence using proven patterns, real code and production-tested techniques. Built for engineers who need security that works in the real world.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
353
Pages
About

About

About the Book

Artificial intelligence introduces attack surfaces that traditional application security was never designed to handle. This book teaches you how to design, build, deploy, and operate secure AI systems from the ground up. You will learn threat modeling for machine learning architectures, defense against prompt injection and adversarial attacks, secure model serving patterns, container and Kubernetes hardening for GPU workloads, supply chain security for ML artifacts, red teaming methodologies, incident response for AI breaches, and governance frameworks that map to real regulatory requirements. Every chapter provides working code examples, architecture diagrams, decision frameworks, and production-tested patterns. This is not a theoretical overview; it is an engineering reference for teams building AI systems that must be secure in production.

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. Throughout his career, he has designed, secured, analyzed and tested complex software and infrastructure, with a particular focus on understanding how systems fail and how they can be made more secure.

Outside of work, Steve enjoys sharing knowledge with the technology community. He collaborates with researchers, industry experts and technology professionals to write practical books covering software development, cybersecurity, cloud computing, networking, DevOps, artificial intelligence and enterprise technologies. His books focus on practical learning through clear explanations, real-world examples and hands-on exercises. With more than two decades of industry experience, his goal is to help IT professionals, students and technology enthusiasts build useful skills and stay current in a rapidly changing industry.

We believe readers deserve to know how our books are created. Most of our authors are not native English speakers, so we use AI to help translate, proofread manuscripts, fix grammar, improve sentence structure and make technical explanations easier to read. AI is used as an editing tool only. It does not replace the research, technical knowledge or hands-on experience behind our books. Some of our authors also prefer to remain anonymous for privacy or professional reasons. In those cases, we publish their work under a different name. The author's name may be different, but the quality of the content and our review process remain the same.

Every book is written, reviewed and maintained by experienced technology professionals, with contributions from our private technical community of more than 400 engineers and researchers from Ukraine, Belarus and Russia. We spend far more time validating technical accuracy and keeping our content up to date than generating text. We are always interested in working with experienced professionals who have deep expertise in a particular technology or domain. If you would like to publish a book with us or help review an existing manuscript, we'd love to hear from you. Send us a message describing your area of expertise. We are especially interested in niche technologies, specialized skills and emerging topics that are underrepresented in existing technical literature.

If you look through the contents of our books, you'll see practical examples, detailed explanations and material that is regularly updated. Our goal is to publish books that professionals can actually rely on, not low-effort AI-generated content. If you ever feel that one of our books does not meet that standard, Leanpub offers a 60-day money-back guarantee. Feel free to request a refund if you are not satisfied with your purchase.

Contents

Table of Contents

Building and Operating Secure AI Systems in Production

Introduction: Why AI Security Is Different

  1. What Makes AI Security Unique
  2. The AI Security Landscape in 2025-2026
  3. How to Use This Book
  4. A Note on Trade-offs and Uncertainty

Chapter 1: Foundations of AI Security Engineering

  1. The Unique Attack Surface of AI Systems
  2. Core Security Principles for AI
  3. Understanding the AI Threat Landscape
  4. Risk Assessment Frameworks for AI Projects
  5. Building a Security-First AI Culture

Chapter 2: Threat Modeling for AI Systems

  1. Adapting STRIDE for AI and ML Systems
  2. Attack Surface Analysis for AI Applications
  3. Data Flow Diagrams for AI Architectures
  4. Practical Threat Modeling Walkthroughs
  5. Prioritizing Risks with Quantitative Scoring

Chapter 3: Secure AI System Architecture

  1. Reference Architectures for Secure AI Deployments
  2. Zero Trust Principles Applied to AI Workloads
  3. Network Security Patterns for AI Systems
  4. Secrets Management Architecture
  5. Identity and Access Management for AI Components

Chapter 4: Model Supply Chain Security

  1. Mapping the AI Model Supply Chain
  2. Software Bill of Materials for ML Systems
  3. Model Provenance and Lineage Tracking
  4. Dependency Management for AI Frameworks
  5. Model Integrity Verification with Digital Signatures

Chapter 5: Secure Data Handling for AI

  1. Securing Data Collection Pipelines
  2. Encryption Patterns for ML Workloads
  3. Privacy-Preserving Machine Learning Techniques
  4. Defending Against Data Poisoning Attacks
  5. Data Leakage Prevention in AI Systems

Chapter 6: Adversarial Machine Learning Defenses

  1. Understanding Adversarial Attack Categories
  2. Evasion Attacks and Defensive Strategies
  3. Model Extraction and Theft Prevention
  4. Membership Inference Defense Mechanisms
  5. Robust Training and Defense-in-Depth Approaches

Chapter 7: Secure LLM Application Development

  1. Prompt Injection Attack Vectors and Defenses
  2. Securing Retrieval-Augmented Generation Pipelines
  3. Tool and Function Calling Security Patterns
  4. Implementing Guardrails and Policy Enforcement
  5. Jailbreak Mitigation Strategies
  6. Secure Context Management and Memory Handling

Chapter 8: AI Agent Security

  1. Threat Modeling Autonomous Agents
  2. Sandboxing and Execution Isolation for Agents
  3. Secure Tool Use and Environment Access
  4. Multi-Agent System Security Patterns
  5. Agent Memory and State Security
  6. Rate Limiting and Abuse Prevention for Agents

Chapter 9: Secure Model Serving and Inference

  1. API Security Patterns for ML Endpoints
  2. Authentication and Authorization for AI Services
  3. Input Validation and Output Filtering at Scale
  4. Rate Limiting and Abuse Prevention
  5. Confidential Computing and Trusted Execution Environments
  6. Hardware Accelerator Security Considerations

Chapter 10: Container and Kubernetes Security for AI

  1. Securing AI Container Images
  2. Kubernetes Hardening for ML Workloads
  3. GPU and Accelerator Security in Containers
  4. Runtime Security Monitoring for AI
  5. Network Policies and Service Mesh for AI
  6. Cloud-Native Deployment Patterns

Chapter 11: Secure MLOps and CI/CD Pipelines

  1. Designing Secure ML Pipelines
  2. Automating Security Testing in CI/CD
  3. Infrastructure as Code Security for AI
  4. Secure Model Promotion Workflows
  5. Continuous Compliance Automation

Chapter 12: Monitoring, Observability, and Incident Response

  1. Security Monitoring Architecture for AI Systems
  2. Anomaly Detection for AI Workloads
  3. Logging and Audit Trail Best Practices
  4. Alerting Strategies and Noise Reduction
  5. Incident Response Playbooks for AI Incidents
  6. Forensic Analysis of AI Security Events

Chapter 13: Red Teaming, Penetration Testing, and Evaluation

  1. AI-Specific Attack Techniques for Red Teams
  2. Automated Red Teaming Tools and Frameworks
  3. Building Comprehensive Evaluation Suites
  4. Vulnerability Management for AI Systems
  5. Penetration Testing Methodologies for AI
  6. Continuous Security Assessment Programs

Chapter 14: Governance, Risk Management, and Compliance

  1. Navigating the AI Regulatory Landscape
  2. Building Internal AI Governance Frameworks
  3. Risk Registers and Control Mapping
  4. Audit Preparation and Evidence Collection
  5. Policy Enforcement at Scale
  6. Third-Party and Vendor Risk Management

Chapter 15: Production Operations, Reliability, and Resilience

  1. Resilience Engineering for AI Systems
  2. Disaster Recovery Planning for AI Workloads
  3. Capacity Planning and Performance Security Trade-offs
  4. Cost Optimization Without Compromising Security
  5. Long-Term Maintenance and Model Lifecycle Management
  6. Operational Playbooks for Common Scenarios

Conclusion: The Path Forward

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub