Sub topic 12
Security and Compliance Requirements
This chapter assumes you can tell functional requirements from non-functional ones. It also assumes you know how SLIs and SLOs make a quality target measurable. Security and compliance are non-functional requirements, so they need the same treatment as latency or availability. A requirement such as "the system must be secure" cannot be tested. A requirement such as "all data in transit uses TLS 1.2 or later" can.
Security requirements
Security requirements describe which protections the system must provide and against whom. A useful way to sort them is by the property they protect.
| Property | Question it answers | Example requirement |
|---|---|---|
| Confidentiality | Who may read the data? | Passwords are stored only as salted hashes. |
| Integrity | Who may change the data? | Only the creator of a short URL can delete it. |
| Availability | Can legitimate users still reach it? | Each client is limited to 100 requests per minute. |
| Authentication | Who is the caller? | API calls carry a valid token. |
| Authorization | What may this caller do? | A user can delete only their own records. |
| Auditability | Who did what, and when? | Every delete is logged with user ID and timestamp. |
Some of these need functional behavior as well. The delete rule in the URL shortener (FR-3) is functional. The rule that only the creator may delete is a security requirement attached to it.
Compliance requirements
Compliance requirements come from outside the team: laws, regulations, contracts, or industry standards. Examples are GDPR for personal data of people in the EU, PCI DSS for card payments, and HIPAA for US health data. You usually cannot trade them away, so record them as constraints and note their source.
A compliance statement should name the rule and the concrete behavior it forces on the system.
security_compliance:
- id: SEC-1
property: confidentiality
text: All traffic between clients and the service uses TLS 1.2 or later.
- id: SEC-2
property: authorization
text: A short URL can be deleted only by the account that created it.
- id: SEC-3
property: auditability
text: Every create and delete action is logged for 90 days.
- id: COMP-1
source: GDPR
text: Personal data for an EU user is erased within 30 days of an account deletion request.
region: EUEach line names a property or a source, and each can be checked. SEC-1 can be verified with a scan, and COMP-1 with a test that deletes an account and then inspects storage and backups.
Effects on design
Security and compliance requirements shape architecture early, because they are costly to add later.
- Data residency rules may force separate storage per region.
- Erasure deadlines affect backups and replicas, which also hold copies.
- Audit logs need their own durable, append-only storage.
- Encryption adds some CPU cost per request, which touches the latency target.
- Rate limiting protects availability but rejects some legitimate bursts.
Common errors
- Writing "the system must be secure" with no property, actor, or check.
- Treating compliance as a final review step instead of an input to design.
- Forgetting copies of data in caches, logs, and backups when writing erasure rules.
- Listing a regulation by name without stating what behavior it requires.
Exercise
A team writes "User data must be protected and comply with privacy law." Rewrite it as two testable requirements, one security and one compliance, for a service with EU users.
Show answer
Security: "Personal data at rest is encrypted with AES-256, and all traffic uses TLS 1.2 or later." Compliance (GDPR): "Personal data for an EU user is erased from primary storage and backups within 30 days of a deletion request." Each names a concrete behavior and can be checked by a scan or a test.