Decide the controls before the code exists
Threat modelling a web shop
Decide the controls before the code exists
Before you read the lesson
It works. Is it safe?
Palesa's first draft of Table Bay Online's new shop works: pages load, carts fill and test orders go through. Before customers trust it with their addresses and orders, Naledi asks what could go wrong.
What would you need to know to answer her?
What is worth protecting, who might harm it, and where data enters the shop. Written down with a control for each threat, that is a threat model, and it decides what the rest of the course builds.
You will be able to
- Rank assets by the cost of their loss
- Draw data flows and trust boundaries
- Find each entry point's threats with STRIDE
- Write a one-page threat model
Check data where it crosses into trusted code, on the trusted side. A check in the browser proves nothing to the server.
Which one may mark an order paid?
Return address
- Comes through the browser
- Anyone can open it
- Proves nothing
Webhook
- Comes from the provider's server
- Signed with a shared secret
- Trusted once verified
A form sends each price in a hidden field. Where is the trust boundary?
- Browser to server: never trust the price
- Inside the database, once it is stored
- Nowhere: hidden fields cannot change
Show the answer
Everything the browser sends crosses into the server, hidden fields included. That is why the shop takes every price from its own database.
Now watch the video
Watch for why a threat model is made early, and for the six STRIDE categories you will use at each boundary.
Watch the video