Software Securityhome
Fix a findingSearch
Phase 1 · Planning

Security requirements

A security requirement states an outcome the software must guarantee, such as "a user can read only invoices in their own tenant", in words that a test or a reviewer can check. Together, a feature's requirements say what it must allow, what it must refuse and how you will prove it.

Scanners and reviewers can only check rules someone wrote down. If no requirement says "a user reads only their own tenant's invoices", nobody tests what happens when another tenant's ID is sent, and the gap ships. Written requirements give developers the rule, testers the case that must fail, and reviewers something better than "looks secure" to check against.

Who
The product owner writes them with the developers; a security champion or AppSec engineer reviews them
When
In planning and refinement, before design starts, and again when the threat model adds a mitigation
How often
For every story that touches authentication, authorization, sensitive data or money; the baseline at least yearly
You end up with
Requirements with an ID, a source and a verification method, kept in the repository and linked from acceptance criteria

Do this

  1. Pick an ASVS level for the application

    Record one OWASP ASVS 5.0.0 level per application. Level 1 holds about 20% of the requirements, meeting level 2 means about 70% of them, and ASVS says most applications should strive for level 2. Revisit the level when the data or the exposure changes; data classification (Data classification) tells you when.

  2. Select the requirements the feature touches

    Map what the feature does to ASVS chapters: records read by ID to V8 Authorization, sign-in to V6 Authentication and V7 Session Management, uploads to V5 File Handling. Keep the requirements at or below your level and cite them with the version, such as v5.0.0-8.2.2, because IDs can change between versions.

  3. Add requirements from abuse cases, threats and obligations

    A checklist misses the feature's own logic. Add a requirement for each abuse case you decide to address (Abuse cases), each threat you mitigate (Threat modeling), and each law, contract or past finding that applies. Record which source produced each requirement, so a reviewer can see why it exists.

  4. Write outcomes, not mechanisms

    Give each requirement a subject, an outcome and a boundary: "the tenant comes from the session", not "use middleware X". OWASP SAMM gives the same advice: a requirement states the objective, such as transferring and storing registration data securely, not a measure such as a TLS version. It also warns that "protect against the OWASP Top 10" is too general to be useful.

  5. Write acceptance criteria with the refused case

    Use the format the team already uses, such as Given/When/Then. Include the case that must be refused and what the caller can observe: a status, a body or a log entry. For example: a request for another tenant's invoice returns the same 404 as a missing invoice, so IDs cannot be probed.

  6. Trace each requirement to a test or evidence

    Keep the requirements in a version-controlled file with the ID, text, source, ASVS IDs and verification method. Automate the tests so that removing the control fails the build; for manual checks, name the evidence. NIST SSDF task PW.1.2 asks you to track and maintain the software's security requirements, risks and design decisions.

  7. Add a short security Definition of Done

    Make every item a yes/no check, such as "each requirement in scope has a passing test or dated evidence" and "no new SAST finding at blocking severity". Say which changes need a security review (Security design review), for example anything that changes authentication, authorization or tenant rules.

Done when

Each requirement names the test or review that proves it, and the Definition of Done says which changes need a security review.

Mark it in the gap check

Common mistakes

  • Copying the whole ASVS into every story. A 300-line checklist gets ticked, not read; select by feature and level instead.
  • Writing mechanisms instead of outcomes. "Use the auth middleware" still passes when a new route forgets it; "every route under /invoices checks the tenant" fails.
  • Testing only the happy path. Most security requirements say what must not happen, so the refused case is the test that matters.
  • Accepting "security reviewed" as evidence. Without a named reviewer, a date and what was checked, nobody can later tell whether the requirement ever held.
  • Keeping requirements in a document away from the code. They drift from what was built; keep them in the repository and review changes to them like code.

Vague requirement or testable one?

A requirement is testable when someone other than its author can decide, from the running system or its records, whether it holds. The thresholds below are examples; set your own.

Vague requirement or testable one?: table
VagueTestable rewriteVerified by
Invoices must be secure.A user can read an invoice only if it belongs to their tenant; any other ID returns the same 404 as a missing invoice.API test with two tenants
Prevent brute force.After 10 failed sign-ins for one account in 15 minutes, further attempts are delayed and the owner is notified.Integration test and log check
Log security events.Every denied invoice read is logged with the user, the invoice ID and the UTC time (v5.0.0-16.3.2 requires failed authorization attempts to be logged).Test that inspects the log
Follow secure coding standards.Not a requirement: move it to the Definition of Done as "no new SAST finding at blocking severity".CI gate

Tools and guides

Standards

NIST SSDF 1.1
PO.1 Define Security Requirements for Software DevelopmentPW.1 Design Software to Meet Security Requirements and Mitigate Security Risks

Sources

  1. OWASP ASVS 5.0.0: What is the ASVS? (levels and requirement identifiers). Version 5.0.0.
  2. OWASP ASVS 5.0.0: V8 Authorization. Version 5.0.0.
  3. OWASP ASVS 5.0.0: V16 Security Logging and Error Handling. Version 5.0.0.
  4. OWASP SAMM: Security Requirements, stream A (Software Requirements)
  5. OWASP SAMM: Requirements-driven Testing
  6. NIST SP 800-218: Secure Software Development Framework (SSDF) Version 1.1. February 2022.

Find your next answer

Type to search. Search runs in your browser.

Searches run in your browser, but the host can infer them from the index files they load. The address shows your search so you can bookmark or share it.