Course contentsShow
← Security
Lesson 2030 of 3,05241. Secure Development LifecycleFree lesson

Security User Stories

Write security-focused user stories and acceptance criteria that integrate security requirements into agile development workflows.

Security User Stories

What you'll learn: How to write user stories that bake security directly into agile development, ensuring security is a first-class feature rather than an afterthought.

The Core Idea

A security user story translates security requirements into the same agile format your development team already uses for features. Instead of separate security checklists that arrive late in development, security becomes part of the backlog alongside functional stories.

Think of it like planning a house: rather than building everything and then asking where the locks should go, you include "secure entry points" in the original blueprints. Security user stories make protection requirements visible, trackable, and testable from day one.

Structure of a Security User Story

Security user stories follow the classic format but focus on protection:

"As a [role], I want [security capability], so that [threat is mitigated or compliance is met]."

For example:

  • "As a user, I want my session to expire after 15 minutes of inactivity, so that unauthorized access is prevented if I leave my workstation."
  • "As an administrator, I want all API requests to be logged with user context, so that suspicious activity can be investigated."

Writing Security Acceptance Criteria

Your acceptance criteria define "done" for security, just like functional requirements. They should be:

  • Testable: "All password fields must enforce minimum 12 characters, one special character, one number"
  • Specific: "Admin actions must generate audit logs containing timestamp, user ID, action type, and resource"
  • Security-focused: "Authentication must fail after 5 incorrect attempts with 15-minute lockout"

These criteria tie directly back to your abuse cases and misuse cases you identified earlier—they're the defensive controls that prevent those attacks.

Key Takeaway: Security user stories transform abstract security requirements into actionable, testable development tasks that integrate seamlessly with agile workflows, ensuring security is built in rather than bolted on.