Polski

Article · Solution Architect – role and craft · Microservices

Security and operations in the design: STRIDE, OAuth2, SLOs and runbooks

How a Solution Architect designs security and operability before any code exists: STRIDE threat modeling on a data flow diagram, OIDC and OAuth2, encryption and secrets, golden signals, SLI/SLO and error budgets, alerts, logs, DR with RTO/RPO, and a runbook with a Prometheus alert rule – using a marketplace order system as the example.

By · · 17 min read

An HLD review of OrderFlow – the new order system at Bazario, a marketplace where several thousand sellers list their offers. The team presents a polished component diagram, and the security representative asks a single question: "Where are the trust boundaries on this diagram?". A minute later the SRE engineer adds another: "How will we know order placement is misbehaving before a customer calls?". Reviewers read the Security and Deployment and operations chapters first – and authors usually write them last, in a hurry.

In this step of the path, Ola, Bazario's Solution Architect, designs both parts for the system from the previous articles: 10,000 orders a day (several times more on Black Friday), order confirmation in under 2 seconds, a full audit trail of status changes, plus GDPR and PCI DSS requirements at the boundary with the payment operator.

6
STRIDE categories – Microsoft's threat model (1999, Loren Kohnfelder and Praerit Garg)
43.2 min
monthly error budget – for a 99.9% SLO over a 30-day window
4
golden signals – latency, traffic, errors and saturation – from Google's SRE book

Who reads these chapters and what they look for

Security and operations have four audiences in an HLD, and each looks for something different:

  • The security office – data classification, the threat model, how authentication and encryption work.
  • Infrastructure and SRE – SLOs, alerts, the disaster recovery (DR) plan and who is on call.
  • Legal and compliance – regulatory compliance. At Bazario that means GDPR (including notifying the supervisory authority of a personal data breach within 72 hours) and PCI DSS – the card data security standard. From the start, Ola designs things so that card data never reaches Bazario's systems at all: the payment form is provided by the payment operator, and only a token and the result come back to the shop.
  • Development teams – concrete backlog items: what to implement, which metrics to expose, which libraries to use.

A good chapter answers these people's questions before anyone asks them in a meeting.

Threat modeling in an hour

Threat modeling sounds heavyweight, but in practice it's a 60–90-minute workshop for one key flow. The architect, the tech lead, someone from security (or a security champion from the team) and someone from operations take part. Adam Shostack boils the whole method down to four questions:

  1. What are we working on? – we draw a Data Flow Diagram (DFD).
  2. What can go wrong? – we walk the diagram's elements through the STRIDE categories.
  3. What are we going to do about it? – a control, risk acceptance or a design change.
  4. Did we do a good job? – verification: tests, review, a pentest.

The most important elements of the diagram are the trust boundaries: places where data moves between zones with different levels of trust. Every arrow that crosses a boundary is a candidate for analysis.

Diagram: OrderFlow DFD with trust boundaries – every arrow crossing a zone boundary is a candidate for STRIDE analysis

STRIDE is an acronym for six threat categories. Each one violates a single security property, which makes it easy to pick the type of control:

CategoryProperty violatedBazario exampleControl
Spoofingauthenticationtaking over a customer account with passwords from other breaches (credential stuffing); a fake "payment succeeded" webhookOIDC with MFA, login attempt limits, webhook signatures verified server-side
Tamperingintegritychanging the price in a cart request or the amount in a Kafka messageprices always calculated server-side, ACLs on Kafka topics, checksums on critical events
Repudiationnon-repudiationa support agent claims they never issued a refund, and the logs show nothinga "who, what, when, from where" audit log in WORM storage, time synchronisation
Information disclosureconfidentialityaddresses in logs; GET /orders/1043 returns someone else's order (IDOR)log masking, encryption, object-level authorization
Denial of serviceavailabilitybots buy up a Black Friday promotion and clog the checkoutWAF and bot protection, per-client limits, a queue in front of reservations, timeouts
Elevation of privilegeauthorizationa seller sees another seller's orders; an agent approves a refund they created themselvesseller (tenant) data isolation, RBAC/ABAC, the four-eyes principle

The workshop produces a list of threats with a risk rating (likelihood × impact), an owner and a decision. Controls go into the backlog as stories with acceptance criteria, and accepted risks are signed off by the business owner – ideally in an ADR. Also check the OWASP API Security Top 10: since its first edition in 2019, number one has been Broken Object Level Authorization (BOLA) – exactly the GET /orders/1043 case.

Who is who and who may do what: OIDC and OAuth2

Two standards that are often confused:

  • OAuth 2.0 (RFC 6749, 2012) is about authorization. The application receives an access token with a scope of permissions, e.g. orders:write.
  • OpenID Connect (2014) is an identity layer built on OAuth 2.0. It adds an ID token that says who signed in.

The rest of this article is for members

Create a free account or sign in to read it all. Still ahead:

  • Encryption and secrets
  • Operational design: how do we know the system works
  • Golden signals
  • SLI, SLO, SLA and the error budget
  • Alerts, logs and traces
  • DR: RTO and RPO
  • The runbook and the alert rule
  • Trade-offs
  • Check yourself
  • Related topics

Create a free account · Sign in