Writing Security Requirements That Can Be Tested
"The system must be secure" cannot be tested, so it cannot be built or accepted.
"The system must be secure" is the most common security requirement ever written, and the least useful. Nobody can build it, because it does not say what to build. Nobody can test it, because it does not say what to check. And nobody can say when it has been met, which means it can never be formally accepted and never truly closed. If you are joining us on day three, here is where we are. This week is five tools for business analysts who write requirements for systems that hold sensitive information. Day one covered confidentiality, integrity and availability as the three ideas behind most security requirements. Day two showed how to classify data into four levels and have the business owner confirm each one. Today we turn those ideas and levels into requirements that can be built, tested and accepted.
Why vague security requirements fail
A good requirement of any kind passes a simple test: could a tester read it and decide, yes or no, whether the finished system meets it? Vague security wishes fail that test in three ways. The developer has to guess what is meant, so each developer guesses differently. The tester has nothing to check, so security passes by default. And the gap only shows up later, in a review or an audit or an incident, when the cost of fixing it is highest.
The remedy is not to learn security engineering. It is to apply the habits you already use for other requirements: be specific, name the roles, state the condition and say how you will know. The words may be unfamiliar at first, but the discipline is the same one that turns "the system should be fast" into a figure someone can measure. Security requirements are ordinary requirements about protection.
From vague to testable
The table below shows five vague statements and a testable rewrite of each. The rewrites are illustrative, and the exact figures belong to your organisation's policy and your security team, but the shape is what matters: a named role, a clear condition and something a tester can check.
FIVE VAGUE REQUIREMENTS, REWRITTEN TO BE TESTABLE
| Vague | Testable |
|---|---|
| The system must be secure. | Replace it with specific requirements for sign-in, roles, recording, protection and retention. Each is testable on its own. |
| Only authorised people can see salary data. | Only users in the HR Manager role can view salary fields. All other roles see them hidden. Test: sign in as each role and confirm. |
| Passwords must be strong. | Users sign in through the organisation's single sign-on with a second step. Test: confirm a sign-in without the second step is refused. |
| We need an audit trail. | Every change to a customer's bank details records who made it, when, the old value and the new value. Test: change a record and check the log. |
| Sessions must time out. | A session ends after 15 minutes of inactivity, and the user must sign in again. Test: leave a session idle and confirm it ends. |
Illustrative. Figures such as the timeout belong to your organisation's policy.
Behind those examples sit six building blocks that cover most of what a security requirement needs to say. Use them as a prompt list when you write or review requirements for any system.
- Who signs in, and how. Name the users and the method, such as single sign-on and a second step, and say what happens to accounts for people who are not employees.
- What each role may do. List the roles and, for each, what it may view, create, change, approve and delete. A small table of roles against actions is the clearest form.
- What gets recorded. Say which actions are written to a log, what each entry holds, who may read the log, and that it cannot be edited by the people it records.
- How data is protected. For each classification level, say how data is protected when stored and when sent between systems. If the answer comes from a vendor, ask for it in writing.
- What happens when things go wrong. Cover repeated failed sign-ins, suspected misuse, who is told, how fast, and who decides what to do next.
- How long data is kept, and how it is removed. Say how long each kind of data is retained, who approves deletion and how you will know it has happened.
A short word on wording. Avoid the vague verbs that let a requirement be read two ways, such as handle, support, manage or ensure. Prefer verbs that describe something visible, such as view, approve, record, refuse and end. When a sentence uses one of the vaguer verbs, ask what a tester would actually do to check it, and use the answer as the new sentence.
A pattern you can reuse, and how to test it
Most good security requirements follow one pattern: a named role, an action, a condition and a check. "Only users in the HR Manager role can view salary fields" has all four. When you draft a requirement and it lacks one, the missing part is usually the thing nobody has decided yet. That makes the pattern a useful way of finding open questions as well as writing requirements.
Testing deserves its own thought. Test plans naturally check that things work for the people who should have access. Security needs the opposite as well: tests that confirm the wrong people are refused. For every requirement of the form "only X can do Y", add a matching test as someone who is not X. Ask the testers to include these early, and ask the security team or the vendor how they will prove the protections are in place, not only that they exist.
Who writes these requirements? The analyst drafts them, and the security team, the vendor and the technical lead review them. That division works well, because you bring knowledge of the business and the data, and they bring knowledge of the controls that exist and the policies that apply. Share a draft early and ask a specific question, such as whether the session limit matches the organisation's policy or whether the logging fits what the system can record. Specific drafts get specific answers.
Link each security requirement to the data classification it protects and to the test that proves it. A simple traceability column in your requirements list is enough. When someone later asks why a field is hidden or why a session ends so quickly, the answer is on the page, and when the classification of a field changes, you can see which requirements and tests need to change with it.
Finally, keep each requirement small and separate. A requirement that bundles sign-in, roles and logging into one paragraph is hard to test and hard to trace. Short, single-purpose requirements can be accepted one by one, and a gap in one does not hide a gap in another. Tomorrow we look at the questions to ask before sign-off, a checklist for catching what the requirements missed.
Go out and be successful.
Oluwatosin Ogunkoya · Flotog BA Insights · 1:1 mentoring and coaching for BAs at every career stage · www.flotogbainsights.com
TOMORROW
Eight Security Questions to Ask Before Sign-off - A checklist for catching the gaps, and what to do when the answers are weak.