Home / Digital Books / Web Security / Alice And Bob Learn Application Security

Alice And Bob Learn Application Security

The definitive 160-page practical guide to building resilient, threat-modeled, and defensible web applications. Written through engaging real-world software engineering scenarios featuring Alice (The Developer) and Bob (The Security Architect).

★ 4.9 / 5.0
| 180 Verified Engineer Reviews ✓ Watermarked PDF Access
LIFETIME DIGITAL LICENSE
₹99 ₹499 80% OFF
🔒 100% Secure Razorpay Checkout
🧩
Threat Modeling with STRIDE
Deconstruct architectures using Data Flow Diagrams (DFDs) and evaluate Spoofing, Tampering, Repudiation, and Privilege Elevation.
🔑
Modern Cryptography for Devs
Argon2id password hashing, AES-GCM-256 symmetric encryption, RSA/ECC signatures, and key management best practices.
🛡️
Contextual Input & Encoding
Prevent SQL Injection, XSS, SSRF, and Command Injection through contextual encoding, prepared statements, and DOM sanitization.
🚀
DevSecOps & CI/CD Security
Automate SAST, DAST, and Dependency SCA scanning inside GitHub Actions & GitLab CI pipelines without slowing down deployments.

The Story of Alice & Bob: Shifting Security Left

Meet Alice, a brilliant full-stack software engineer whose primary mission is shipping elegant features, scaling REST APIs, and delighting users. Meet Bob, a seasoned AppSec architect who views software through the lens of threat modeling, abuse cases, and defensive boundaries. In traditional software companies, Alice and Bob find themselves at odds: Alice wants to push code fast, while Bob blocks releases right before deployment due to last-minute vulnerability scans.

Alice And Bob Learn Application Security reimagines this dynamic. Rather than treating security as an adversarial gatekeeping exercise, this 160-page handbook walks through real-world development sprints where Alice and Bob collaborate to embed security directly into the software development lifecycle (SDLC). By shifting security left—moving threat modeling into sprint planning, implementing secure coding patterns in code reviews, and automating SAST/SCA checks in CI/CD pipelines—Alice builds software that is fast, scalable, and inherently resilient to cyber attacks.

The Fundamental Principle of Application Security
"Security is not a feature you add at the end of a project; it is an emergent property of well-designed, well-tested, and defensively written software."

Core Application Security Domains & Engineering Patterns

The handbook provides comprehensive coverage across five fundamental domains of application security:

1. Threat Modeling with Data Flow Diagrams & STRIDE

Before writing code, Bob teaches Alice how to draw Data Flow Diagrams (DFDs) to map trust boundaries, processes, data stores, and external entities. They apply Microsoft's STRIDE framework to identify threat vectors:

  • Spoofing Identity: Bypassing authentication or impersonating valid users (Mitigation: OAuth 2.0 PKCE, WebAuthn, FIDO2).
  • Tampering with Data: Modifying payload data in transit or storage (Mitigation: HMAC signatures, TLS 1.3, AES-GCM authenticated encryption).
  • Repudiation: Users denying performing an action (Mitigation: Immutable audit logs, cryptographic signing).
  • Information Disclosure: Leaking sensitive PII or API tokens (Mitigation: Data minimization, field-level encryption).
  • Denial of Service: Exhausting CPU/RAM or API rate limits (Mitigation: Token bucket rate limiting, request size limits).
  • Elevation of Privilege: Unauthorized horizontal or vertical authorization bypass (Mitigation: Attribute-Based Access Control / ABAC).

2. Authentication & Password Hashing Fundamentals

Alice learns why traditional cryptographic hash functions like MD5 or SHA-256 must never be used for password storage. The book explores modern memory-hard password hashing algorithms:

  • Argon2id: Winner of the Password Hashing Competition, combining resistance to side-channel attacks and GPU cracking.
  • bcrypt & PBKDF2: Configuring work factors (`cost = 12`) and iteration counts to keep pace with hardware advancements.
  • OAuth 2.0 with PKCE: Implementing Proof Key for Code Exchange (PKCE) to prevent authorization code interception in single-page and mobile apps.

3. Context-Aware Input Validation & Injection Defense

All untrusted input must be validated and contextually encoded. The handbook demonstrates how to prevent SQL Injection, Cross-Site Scripting (XSS), and Server-Side Request Forgery (SSRF) at the code level.

Field Engineering: Defensive Code Cheatsheets

Chapter 6 of the handbook provides practical, copy-pasteable secure coding patterns across popular programming languages:

Python Secure Password Hashing (Argon2id) PYTHON SECURITY
from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError

# Initialize Argon2id Password Hasher with Recommended Parameters
ph = PasswordHasher(
    time_cost=3,        # Iterations
    memory_cost=65536,  # 64 MB RAM
    parallelism=4,      # 4 Threads
    hash_len=32,
    salt_len=16
)

# Hash Password During User Registration
hashed_password = ph.hash("UserSuperSecretPassword123!")

# Verify Password During Authentication
try:
    ph.verify(hashed_password, "UserSuperSecretPassword123!")
    print("Authentication Successful!")
except VerifyMismatchError:
    print("Invalid Credentials Provided!")
Node.js Express Secure Cookie & HTTP Header Hardening EXPRESS.JS SECURITY
const express = require('express');
const helmet = require('helmet');
const session = require('express-session');

const app = express();

# 1. Apply Helmet HTTP Security Headers (CSP, HSTS, X-Frame-Options)
app.use(helmet({
  contentSecurityPolicy: {
    directives: {
      defaultSrc: ["'self'"],
      scriptSrc: ["'self'", "https://apis.google.com"],
      objectSrc: ["'none'"]
    }
  }
}));

# 2. Configure Hardened Session Cookies
app.use(session({
  name: '__Host-mmn_session', // Host prefix enforces HTTPS and root path
  secret: process.env.SESSION_SECRET,
  resave: false,
  saveUninitialized: false,
  cookie: {
    httpOnly: true, // Prevents XSS cookie theft
    secure: true,   // Transmitted over HTTPS only
    sameSite: 'lax', // CSRF protection
    maxAge: 3600000 // 1 Hour Expiration
  }
}));
Java Secure Database Access (Preventing SQL Injection) JAVA JDBC
// DO NOT Concatenate SQL Strings! Use Prepared Statements with Parameter Binding
String userEmail = request.getParameter("email");
String query = "SELECT user_id, password_hash, role FROM users WHERE email = ?";

try (Connection conn = dataSource.getConnection();
     PreparedStatement pstmt = conn.prepareStatement(query)) {
    
    // Bind Parameter Explicitly
    pstmt.setString(1, userEmail);
    
    try (ResultSet rs = pstmt.executeQuery()) {
        if (rs.next()) {
            String role = rs.getString("role");
            // Process authenticated record securely
        }
    }
}

Complete Table of Contents & Module Syllabus

  • Module 01 Foundations of Secure Software Design & The Alice & Bob Story
    Pages 1–20
    Introduction to AppSec principles, CIA Triad, Defense-in-Depth, Shift-Left philosophy, and bridging the communication gap between software developers and security engineers.
  • Module 02 Threat Modeling: Data Flow Diagrams & STRIDE Framework
    Pages 21–40
    Mapping trust boundaries, drawing architectural DFDs, applying STRIDE threat analysis, constructing attack trees, and calculating risk ratings using CVSS v3.1.
  • Module 03 Authentication Engineering & Modern Password Hashing
    Pages 41–60
    Implementing Argon2id, bcrypt, and PBKDF2, Multi-Factor Authentication (TOTP/WebAuthn), OAuth 2.0 Authorization Code Flow with PKCE, and JWT security pitfalls.
  • Module 04 Input Validation, Contextual Output Encoding & Injection Defense
    Pages 61–80
    Preventing SQLi via Prepared Statements, Context-Aware HTML/JS/URL encoding against XSS, DOMPurify sanitization, and Server-Side Request Forgery (SSRF) mitigations.
  • Module 05 Cryptography for Software Engineers
    Pages 81–100
    Symmetric encryption (AES-256-GCM), asymmetric key exchange (RSA, ECC), TLS 1.3 configuration, HMAC data integrity, key rotation, and secret management tools (Vault).
  • Module 06 Session Management, Cookies & CSRF Defense
    Pages 101–120
    Session identifier generation, Cookie hardening (`HttpOnly`, `Secure`, `SameSite=Strict`, `__Host-` prefix), Anti-CSRF Synchronizer Tokens, and CORS policy configuration.
  • Module 07 DevSecOps & CI/CD Security Automation
    Pages 121–140
    Integrating SAST (Semgrep, SonarQube), DAST (OWASP ZAP), and SCA dependency scanners (`npm audit`, Trivy) into GitHub Actions and GitLab CI without breaking builds.
  • Module 08 API Security (OWASP API Top 10) & Secure Architecture Review
    Pages 141–160
    Securing REST and GraphQL APIs, Broken Object Level Authorization (BOLA/IDOR) defense, rate limiting, secure code review checklists, and capstone architectural audit.

Who Should Read This Handbook?

This handbook is written for developers and security professionals seeking practical secure coding expertise:

💻 Software Engineers & Developers
Learn to write code that is secure by default, understand security code reviews, and eliminate common vulnerabilities before release.
🛡️ AppSec Engineers & Security Champions
Master threat modeling methodologies (STRIDE), facilitate collaborative architectural reviews, and implement DevSecOps automation pipelines.
🚀 DevOps & Cloud Engineers
Integrate automated static analysis (SAST), dynamic testing (DAST), and container/dependency scanning into CI/CD workflows.
🎓 CS Students & Bootcamp Graduates
Gain high-demand industry skills in application security, cryptographic implementations, and OWASP Top 10 defensive practices.

Verified Engineer Reviews

Rohan Mehta
Senior Full-Stack Engineer
★★★★★
"The Alice and Bob storyline makes complex security concepts remarkably easy to digest. The section on Argon2id hashing and PKCE authentication flows is mandatory reading for all our backend devs."
Sneha Kulkarni
AppSec Lead • SaaS Enterprise
★★★★★
"We used Module 2 (STRIDE Threat Modeling) as the template for our team's security champion training. Exceptional technical depth at an unbeatable ₹99 price point!"
Alex Turner
DevSecOps Specialist
★★★★★
"The CI/CD pipeline integration scripts for Semgrep and OWASP ZAP in Chapter 7 saved our team weeks of trial and error. Brilliant handbook."
Deepak Rao
Engineering Lead
★★★★★
"Comprehensive, well-illustrated, and practical. It bridges the gap between theoretical security standards and actual production code."

Frequently Asked Questions

Which programming languages are used in the code examples?

The handbook includes practical defensive code snippets across Python, Node.js (JavaScript/TypeScript), Java, and Go, focusing on language-agnostic security principles.

How do I open my digital book after buying?

Once your ₹99 payment is completed via Razorpay, your digital license is linked to your account. You can open your My Books library anytime to read the secure PDF.

Is this handbook suitable for junior developers?

Yes! The narrative structure following Alice and Bob starts with fundamental principles before gradually building up to advanced threat modeling and cryptography.

Are there bundle discounts when buying multiple handbooks?

Yes! Adding 2 books to your cart unlocks a 10% Duo Bundle Discount, while adding 3 or more books unlocks an automatic 20% Mega Bundle Discount.