Boundaries · For Security architects, data engineers, privacy leads
Data-flow security: trace sensitive data end to end
Breaches rarely start in the primary database. They start in the copies: logs, exports, backups and vendors. How to classify data, trace one record through a system and put a control on every hop.
Your database is probably the best-protected copy of your customers' data. The question is where the other copies went.
Data leaks along flows, not in stores
Teams pour effort into the primary database: private networking, encryption, careful roles. Then the same records flow into an analytics warehouse with broad access, a log index that keeps everything for a year, nightly snapshots in another account, a support tool, a staging environment refreshed from production and a handful of vendors. Each copy is a new place to lose the data, usually with weaker protection than the original.
Data-flow security treats every movement of data as a boundary crossing. The question at each hop is the same: does the destination need this data, in this form, for this long, and is it protected at least as well as where it came from?
Classify before you draw
You cannot reason about flows without knowing what is flowing. A small classification scheme that people actually use beats a detailed one they ignore. Four levels cover most organisations:
- Public: published content, marketing pages, open documentation.
- Internal: operational data with no customer content: metrics, service names, non-sensitive configuration.
- Confidential: customer and employee personal data, contracts, business records.
- Restricted: credentials, keys, payment card data, health data, and anything whose exposure is a reportable incident on its own.
Attach the class to data where it is defined: schemas, event contracts, API specifications. A flow is then easy to check: restricted data should never reach a destination rated for internal data, and confidential data should reach a vendor only under an agreement that covers it.
Trace one sensitive record end to end
Pick one record that matters, such as a new customer's account details, and follow every copy the system makes, including the ones nobody designed on purpose.
For each hop, answer five questions and write the answers down:
- Which fields move? Not "the user object", but the actual fields.
- Why does the destination need them? If nobody can say, the flow is a candidate for removal.
- In what form? Full, masked, tokenised, pseudonymised, aggregated or encrypted with a key the destination does not hold.
- For how long? Retention at the destination, including its backups.
- Who can read it there? People and systems, including the vendor's staff where relevant.
Read the diagram as text
- Browser: Sign-up form
- Application: Accounts API
- Restricted: Accounts database, Backups
- Internal: Event stream, Analytics
- Observability: Logs and traces
- Third party: Log vendor
- Sign-up form → Accounts API: HTTPS
- Accounts API → Accounts database: full record
- Accounts API → Event stream: IDs only
- Accounts API → Logs and traces: masked
- Accounts database → Backups: snapshot
- Event stream → Analytics: pseudonymised
- Logs and traces → Log vendor: 30-day retention
Minimise, then protect what remains
The cheapest data to protect is data you never collected or no longer keep. Collect the fields a feature needs, drop them when the purpose ends, and prefer derived values (an age band rather than a birth date, a country rather than an address) wherever the destination only needs the derivation.
For the data that remains, match protection to class. Field-level encryption or tokenisation keeps restricted fields unreadable to systems that only store or route them. Pseudonymisation lets analytics join records without seeing who they belong to, though it is not anonymisation: if the mapping can be reversed or the data re-identified, it is still personal data. Encrypt backups with keys held separately from the production data's keys, so one stolen credential does not unlock both.
The quiet flows
Most unplanned copies come from a few places. Check each one explicitly:
- Logs, traces and error reports. Request bodies, headers and exception messages carry tokens and personal data unless fields are masked before they are written.
- Analytics and machine learning. Wide tables are convenient and dangerous; build them from classified, minimised sources.
- Backups and snapshots. They inherit the data's sensitivity but often not its access controls or deletion.
- Non-production environments. Copying production data into staging or test moves it to the least-protected place you have.
- Support and admin tools. Search across all customers is a feature for staff and a gift to anyone who takes over a staff account.
- Front-end scripts and SDKs. Analytics, chat and monitoring scripts in the browser can read what users type.
Controls at each crossing
Turn the answers into enforceable controls. Event and API contracts should declare the class of each field, so a review can reject a restricted field on an internal topic. Egress from data stores and workloads should be allow-listed, so a misconfiguration cannot send data to an arbitrary destination. Retention should be configured at each destination, not assumed. Access to confidential and restricted data should be logged, and the logs reviewed.
Where data leaves your control, to processors and vendors, the contract is a control too. Know which vendors receive which classes, under which agreement, and in which region.
Keep a living data-flow inventory
Data flows change with every feature, integration and vendor. Keep the inventory next to the architecture rather than in a spreadsheet nobody opens, and make a new flow of confidential or restricted data a trigger for review. Privacy threat modelling methods such as LINDDUN give structure to that review, and many regulations require a record of processing activities anyway. The same trust boundary questions apply: the destination is a new place where your assumptions about the data may no longer hold.
Sources
- Guide to Data-Centric System Threat Modeling (SP 800-154, draft)
NIST
- Privacy Framework
NIST
- LINDDUN privacy threat modeling
DistriNet, KU Leuven
- Logging Cheat Sheet
OWASP
- Cryptographic Storage Cheat Sheet
OWASP
- General Data Protection Regulation, Article 25: data protection by design and by default
European Union
- Data protection, AWS Well-Architected security pillar
Amazon Web Services