Free sample · no email · 2,597 of 16,807 words
The App Security Playbook
The opening of the playbook as your AI agent reads it. The full volume adds the step-by-step playbook, the prompts, the checklist and the sources.
1. The problem
Application security means keeping your product’s promises when someone is actively trying to break them. A product promises that only team members can read a document, that a former employee loses access, that an integration can read invoices but cannot change bank details. Each promise depends on several components agreeing about identity, permissions, data and state.
A successful login proves little about the next request. A valid payment webhook does not prove the app linked it to the right customer. An encrypted database does not stop an authorized app process from returning another tenant’s rows. In practice the failure is usually a missing boundary: permissions checked in the interface but not in the API, the main database locked down but exports left public, human accounts restricted while an automation account can touch everything.
Why this matters now. Three trends have come together.
First, attackers increasingly get in through software flaws. Verizon’s 2026 Data Breach Investigations Report, published in May 2026, found that 31% of breaches started with vulnerability exploitation. Verizon says this is the first time in the report’s 19 years that exploitation has overtaken stolen credentials as the main way in [42]. Stolen credentials still matter a great deal once attackers are inside, so authentication still matters.
Second, the software supply chain is now a main target. In September 2025 a self-replicating worm known as “Shai-Hulud” compromised hundreds of npm packages and stole developer tokens and cloud keys. CISA told developers to rotate credentials and require phishing-resistant MFA [37]. A second wave followed in November 2025. npm then revoked all classic tokens and pushed publishers toward OIDC trusted publishing [33][34]. OWASP’s Top 10:2025 now lists Software Supply Chain Failures as A03 [1].
Third, AI writes a large share of new code, and it repeats insecure patterns with confidence. Veracode tested more than 100 language models on 80 coding tasks that each had a secure and an insecure solution. The models chose the insecure option in 45% of cases, and newer or larger models did not do better on security [40]. That is a benchmark choice rate, not a flaw rate for your repository, but the direction is clear. GitGuardian’s 2026 report counted about 28.65 million new hardcoded secrets in public GitHub commits during 2025, up 34% on the year before. It found that commits assisted by one AI coding tool leaked secrets at about 3.2%, against a 1.5% baseline. GitGuardian does not show that the tool caused the difference [41]. Models also invent package names. A USENIX Security 2025 study found that about 19.7% of the packages that tested code models recommended did not exist. Many of the invented names came back when the same prompt was repeated, which lets attackers register them in advance (“slopsquatting”) [39].
What usually goes wrong.
- Authorization is missing at the data layer. The interface hides other users’ records, but the API or database returns them to anyone who asks. Broken Access Control is OWASP’s top risk again in 2025, and it now includes server-side request forgery [1]. CVE-2025-48757 records this exact pattern: missing Row Level Security in projects built with one AI app builder allowed unauthenticated reads and writes [43].
- Secrets sit in code, chat and config. Keys end up in front-end bundles, committed
.envfiles, MCP config files and chat threads. GitGuardian counted 24,008 unique secrets in MCP configuration files on public GitHub, and found that 64% of secrets confirmed valid in 2022 were still valid in early 2026 [41]. - Authentication is hand-rolled or follows old rules. Teams still force 90-day password changes and complexity rules, which NIST now prohibits, while skipping blocklist checks and phishing-resistant options [3].
- Dependencies are installed blindly. A coding agent runs
npm installon a name it produced, install scripts run with full access, and the CI token can publish packages. - AI features have too much power. An assistant that can read email, call tools and send messages can be steered by text hidden in the content it reads. OWASP ranks prompt injection first for LLM applications and agent goal hijack first for agentic applications [21][22].
- Nobody would notice. There are no alerts on admin actions, failed logins or unusual exports, so a customer or a journalist finds the breach.
What changed in 2025–2026. Several older recommendations need revising.
| Development | What to do about it |
|---|---|
| OWASP ASVS 5.0.0 released 30 May 2025 [2] | Pin requirement IDs to a version; recheck mappings copied from ASVS 4.x |
| OWASP Top 10:2025 replaced the 2021 edition [1] | Update training material; note the new A03 supply chain and A10 exceptional-conditions categories |
| NIST SP 800-63B-4 final in July 2025 [3] | Revisit password length, composition, rotation and phishing resistance |
| RFC 9700 (OAuth security BCP) published January 2025 [4] | Review older OAuth setups against it |
| npm trusted publishing generally available July 2025; classic tokens revoked December 2025 [33][34] | Move publishing to OIDC |
| OWASP Top 10 for Agentic Applications released December 2025 [22] | Add it to reviews of AI features |
| MCP specification revision 2026-07-28 [24] | Pin the protocol revision; recheck authorization on upgrade |
| EU Cyber Resilience Act reporting duties apply from 11 September 2026 [50] | Decide whether you are in scope and who reports |
The Top 10 is an awareness document. ASVS is a set of verification requirements. Use the first to explain risk and the second to pick testable controls. Working through ten headings does not mean the app has passed an ASVS assessment [1][2].
What good looks like. For a small team, “good” is not a certificate. It is a short list of properties you can show:
- Every request that touches user data is checked for identity and permission on the server, and tests prove that one user cannot reach another’s data.
- Admin and developer accounts use passkeys or hardware keys. Customers can use passkeys, and password rules follow NIST SP 800-63B-4.
- No secret lives in the repository or the client. Every secret has an owner, a scope and a tested rotation path.
- Dependencies are locked, new versions wait out a cooldown, and publishing uses short-lived OIDC credentials.
- AI agents work under written rules, cannot push to main, cannot reach production secrets, and their changes pass automated and human security review. AI features act with the user’s permissions and need approval for high-impact actions.
- Security events are logged, the important ones raise alerts that reach a person, and a one-page incident runbook exists and has been rehearsed.
Write your own promises as behaviors that can become tests: “A member of workspace A cannot download workspace B’s export.” “A recovered account does not keep an attacker’s active session.” “A preview build cannot obtain production deploy credentials.” “An AI assistant cannot turn document text into permission to delete records.” “A failed permission lookup never becomes permission to continue.”
2. Before you start
Pick a scope narrow enough to finish. “Secure the company” is not a scope. “Review the customer portal, its API, storage, auth provider and deploy workflow for release R17” is.
Owners. Name a decision owner who accepts remaining risk and can stop a release, and a technical owner who can explain the implementation. In a two-person company, one person may hold both roles, but write both down. Name a backup.
Decisions to make up front.
- Scope. List the apps, APIs, mobile builds, admin tools, scheduled jobs and internal scripts in scope. Do not leave anything out because it is “only internal”. Internal tools often have the weakest auth.
- Data classes. Decide which data is sensitive: credentials, payment data, health data, children’s data, precise location, private messages, uploaded documents.
- Legal footprint. Note where your users are (EU, UK, US states, others), whether you touch card data directly or only through a hosted payment page, and whether you are a financial institution under the FTC Safeguards Rule. This shapes Section 4.8.
- Fix-time targets. Decide in writing how fast you will fix issues, for example “critical within 7 days, high within 30”. These are your own targets, not an industry standard.
Data table. Separate what the business needs from what is merely convenient:
| Data | Purpose | Locations | Who may read it | Retention decision | Deletion owner |
|---|---|---|---|---|---|
| Account email | Sign-in and notices | Auth provider, app database | User, limited support | Account lifecycle policy | Product ops |
| Uploaded document | Collaboration | Private object storage | Authorized workspace members | Workspace policy | App owner |
| Security event | Investigation | Restricted log service | Incident responders | Security policy | Security owner |
Do not invent a universal retention period. Decide what is necessary, what contracts require and what the law allows. The FTC advises businesses to think about what they collect, how long they keep it and who can access it [58].
Intake checklist.
- Named decision owner, technical owner and backup
- Application name and release identifier recorded
- Every environment (local, preview, staging, production) listed with URLs
- Repositories and the deployed commit or artifact identified
- Admin access confirmed for code host, CI, hosting, database, auth, payments, email and DNS
- Inventory of third-party APIs and where each key is stored
- Runtime, framework, package manager and dependency versions recorded
- Staging with seeded fake data (no real customer data)
- Test accounts: User A and User B in Tenant A, a user in Tenant B, a removed member, an admin
- Data classification written down
- User regions and card-data handling noted
- AI coding agents, their permission modes and connected MCP servers listed
- AI features inside the product listed (chat, summarization, agents, RAG)
- Fix-time targets agreed
- A private place to store findings (not a public issue tracker)
- Backup of database and config taken before any change
Testing boundary. Write a short authorization record before any active testing:
Authorized target:
Environment:
Permitted accounts:
Permitted techniques:
Maximum request rate:
Excluded systems:
Data handling:
Stop conditions:
Emergency contact:
Authorization expiry:
Exclude customer systems, unrelated third-party services and destructive load testing unless they are separately authorized. Using a provider does not authorize you to penetration-test it. Use read-only access for discovery, and grant write access only when a specific fix needs it. Do not export production data to make an agent’s review easier.
3. The method
The method has eight steps. Each ends in a state you can check. Do them in order on the first pass. After that, repeat Steps 4 to 8 on a schedule, and go back to earlier steps whenever a later one exposes a missing assumption.
Step 1. Map the app, the data and the trust boundaries.
- What to do: List every entry point (pages, API routes, server actions, webhooks, jobs, admin tools, MCP tools), every data store and every external service. Mark where untrusted input enters and where sensitive data lives. Write abuse cases.
- Why: You cannot protect a route you do not know exists. AI-built apps in particular pile up forgotten endpoints, debug routes and duplicate APIs.
- Done when: Every route in the code appears in the inventory, marked public, authenticated or admin, and every important asset has an owner and at least one threat or a written reason for leaving it out.
Step 2. Make authentication strong and boring.
- What to do: Use a maintained auth provider or framework library. Turn on passkeys. Require phishing-resistant MFA for admins and developers. Follow NIST SP 800-63B-4 for passwords. Design recovery and sessions together.
- Why: Credentials are still the main way to move around inside a system after a break-in, and recovery and session rules decide what happens after a credential is lost or stolen.
- Done when: Privileged accounts use passkeys or security keys, password policy matches 800-63B-4, session cookies are hardened, recovery cannot bypass MFA, and the normal, expired, revoked and recovery flows have tests.
Step 3. Enforce authorization on the server and in the data layer.
- What to do: Deny by default. Check actor, action, object and context on every request. Enable Row Level Security, or its equivalent, wherever clients reach the database. Write cross-user and cross-tenant tests.
- Why: Identity alone does not grant permission. Broken access control is the top OWASP risk [1].
- Done when: For every route that takes an object ID, a test shows a forbidden user gets a 403 or 404 with no side effects. Every client-reachable table has tested policies.
Step 4. Get secrets out of code and make them easy to rotate.
- What to do: Inventory secrets, move them to a proper store, scan the full git history, revoke anything that ever leaked, turn on push protection, and rehearse rotation.
- Why: A leaked secret works for an attacker until you revoke it, and many are never revoked [41].
- Done when: A full-history scan finds no live secrets, push protection is on, and every production credential has an owner, a scope, an approved location and a tested rotation path.
Step 5. Close the OWASP basics.
- What to do: Parameterized queries, safe output encoding, CSRF protection, security headers, outbound-fetch limits, safe uploads, verified webhooks, resource limits and fail-closed error handling.
- Why: Valid-looking requests can still cause unauthorized effects, runaway cost or unsafe execution. Security Misconfiguration is A02 and Mishandling of Exceptional Conditions is the new A10 [1].
- Done when: Each control has a test tied to a concrete failure. A forced error in an auth check denies access.
Step 6. Secure the supply chain, the build and the release.
- What to do: Lock dependencies, add a release-age cooldown, restrict install scripts, run CI with least privilege, publish via OIDC, triage vulnerabilities in context, and gate each release on evidence.
- Why: Attackers now go through packages and CI. Separate evidence sources answer separate questions.
- Done when: CI installs only from the lockfile, workflows have minimal
permissions, no long-lived publish token exists, and a reviewer can trace every release claim to evidence for the exact artifact.
Step 7. Put AI-written code and AI features under control.
- What to do: Write security rules into agent instructions, restrict agent permissions, review every AI change, verify every new dependency. For AI features, treat model input and output as untrusted, scope tools narrowly and tie approvals to exact actions.
- Why: Model output must pass the same permission and evidence checks as any other untrusted input.
- Done when: Agents cannot push to protected branches or read production secrets, security-sensitive changes get independent review, and every AI feature has a tool permission table whose limits are enforced in code outside the model.
Step 8. Detect, respond and recover.
- What to do: Log security events, alert on a short list, write a one-page incident runbook with your notification deadlines, rehearse it, test a restore and set a routine.
- Why: Logs nobody watches do not help, and notification deadlines can be 24 or 72 hours [47][50].
- Done when: A test alert reaches a person within minutes, the runbook has been rehearsed, a restore has been verified, and the routine is on a calendar with an owner.
Keep going: the full playbook
- Playbook steps
- Security rules (non-negotiable)
- Prompts
- Checklist
- Measuring results
- Common mistakes
Book + Claude skill + MCP access. Black Friday 2026 price. Back to the book page
Or start free
4 complete playbooks, the 7-day Claude Code course and a key your AI can use right now. No card.
Free. We email you about new lessons and volumes now and then. Unsubscribe any time.
Your free key
Install (Claude Code, Codex, Gemini CLI)
Other apps: add the MCP server https://playbookmcp.com/mcp with header Authorization: Bearer + your key. Keep this key; it is shown once.