Module 40 of 52 · Privacy and protection

Data security essentials

30 min 5 outcomes Control stack and access matrix figures 10 references

By the end of this module you will be able to:

  • Apply confidentiality, integrity and availability to a named dataset
  • Explain encryption at rest and in transit, and where key management actually fails
  • Choose between role-based and attribute-based access control, and place row and column level security
  • Distinguish masking from tokenisation and say what each one costs
  • Name the regulatory hooks a data team is held to and the post-quantum horizon

Control layers wrap the data, and one breach shows which layer holds

Walk a stolen analyst session down the stack and encryption is never reached and access control is simply passed, so the layer that holds is masking, the one that reduces what a permitted reader is shown.

Security controls are layers around the data, not a single wall. Walk a real breach down the stack and the layer that stops it is rarely the one people name first: a stolen session decrypts and passes access control, so the control that reduces what is shown is the one that limits the damage.

Control layers wrap the data, and one breach shows which layer holds A stack region and a breach region. Four layer cards run outermost to innermost, each headed by its control question: Audit, can we prove who touched this; Access control, which identity may read which rows; Masking and tokenisation, what does a leaked copy show, tinted with a red top rule; Encryption, is taken media readable. A narrower core card holds the records being protected, reached by an arrow reading encryption sits nearest the bytes. A left rail reads outer layer down to the data core. One arrow descends from a card marked stolen analyst session. Right-hand tags give the verdict: records only, passed, holds, not reached. A red stop bar captioned stopped here marks the masking row. FOUR CONTROL LAYERS AND ONE BREACH PATH OUTER LAYER DOWN TO THE DATA COREAUDITCan we prove afterwards who touched this?RECORDS ONLYACCESS CONTROLWhich identity may read which rows?PASSEDMASKING AND TOKENISATIONIf a copy leaks, what does it show?HOLDSENCRYPTIONIf the media is taken, is it readable?NOT REACHEDTHE CORECustomer records, the thing protectedencryption sits nearest the bytes Stolen analyst sessionValid credential, wrong handsstolen analyst session stopped here Masking is the layer that held, not encryption A valid session decrypts and passes access control. The damage stops where the values shown are reduced.

Access is decided cell by cell, one role against one asset

Access is decided where a role meets an asset, not by rank. Fill every cell of the role-against-asset grid with none, masked, or full, and write the reason beside the answer, because an unfilled cell always defaults to more access than anyone intended.

Access is decided where a role meets an asset, not by rank. Fill every cell of the role-against-asset grid with none, masked, or full, and write the reason beside the answer, because an unfilled cell always defaults to more access than anyone intended.

Access is decided cell by cell, one role against one asset A matrix region and a legend region. Columns are three roles: analyst, support agent, data engineer. Rows are four assets: customer table, payments table, event log, model features. Every cell is filled with none, masked, or full, plus the reason: for example the support agent has full access to the customer table, one record at a time, while the analyst sees it masked with no name and no address. Three fills carry the answers, neutral for none, light red for masked, stronger red for full, and the legend swatches use those same fills. A footer states that access follows the job, not the seniority. ROLES ACROSS THE TOP, ASSETS DOWN THE SIDE ASSETANALYSTSUPPORT AGENTDATA ENGINEERCustomer tablenames and addressesmaskedno name, no addressfullone record at a timemaskedmoves it, cannot readPayments tablecard and bank detailsnoneno business needmaskedlast four digitsmaskedtokens, not numbersEvent logclicks and sessionsfullbehaviour, no identitymaskedthis customer onlyfullowns the pipelineModel featuresengineered inputsfullbuilt for analysisnoneoutside the jobfullbuilds the store None: no route to the dataMasked: reduced before displayFull: values exactly as stored Access follows the job, not the seniority Only the support agent sees a whole person, and only one record at a time.

Security work on a data platform goes wrong in a particular way. A team buys encryption, switches it on everywhere, writes it into the architecture diagram, and then loses a hundred thousand customer records to an analyst account whose password was reused on a forum. Nothing about the encryption failed. It was never the control standing in that attacker's way. The layer that would have limited the damage was the one nobody had bothered to configure, because it is boring and it makes the dashboards slightly less convenient.

Data security holds up better when it is treated as a set of layers with different jobs, and each layer is asked one question: what attack does this actually stop? That question beats a checklist, because it forces a team to name the threat before it names the product. The two figures above are built around it. The first walks a real breach down a stack of controls and marks the layer where the attack ends. The second replaces the question of who is senior with the question of which role is looking at which asset.

Before choosing controls, a team has to say what it is protecting the dataset from. The three security properties give three different answers, and most datasets do not weight them equally.

40.1 Confidentiality, integrity and availability applied to a dataset

Three properties describe what security is trying to preserve. Confidentiality means that only people and systems with a reason to read the data can read it. Integrity means the values are what they were meant to be, that unauthorised change is prevented or detected, and that the record of change is trustworthy. Availability means the data is there when a legitimate process asks for it, within the time that process can tolerate.

The useful move is not to recite the three but to weight them for a specific dataset, because the weighting drives the spend. A payroll table is dominated by confidentiality: a leak is career-damaging for every person in it, while an hour of downtime is an inconvenience. A billing meter archive is dominated by integrity: a silently corrupted reading produces an invoice that is legally wrong and that somebody will eventually have to unwind across thousands of accounts. A public timetable feed is dominated by availability and integrity together, and has almost no confidentiality requirement at all, because the whole point is that anybody can read it.

Getting this wrong in either direction is expensive. Over-weighting confidentiality on open reference data produces an approval process that stops the data being used for the purpose it was published for. Under-weighting integrity on a financial feed produces a system where nobody can say whether last quarter's numbers were right, and where the only honest answer to an auditor is that the pipeline has no checks that would have caught the change.

UK data protection law folds all three into a single principle. The principle is named integrity and confidentiality, but its text covers accidental loss and destruction, which is availability by another name.

processed in a manner that ensures appropriate security of the personal data, including protection against unauthorised or unlawful processing and against accidental loss, destruction or damage, using appropriate technical or organisational measures

UK GDPR, Article 5(1)(f) - Principles relating to processing of personal data, the integrity and confidentiality principle

Two words in this text do most of the work. Appropriate means the measure is judged against the risk, so there is no fixed list of controls that discharges the duty and no control that is mandatory in every case. Organisational sits beside technical, which means an access review, a joiners and leavers process, and a training record count as security measures in the same sense that encryption does. A team that reports only on technical controls is reporting on half the obligation.

Encryption is the control most often named first and least often understood. It defends the stored copy and the wire, and it is silent about the person holding a valid session.

40.2 Encryption at rest, encryption in transit, and where key management fails

protects data while it is sitting on disk, in object storage or in a backup. The threat it answers is physical or accidental exposure of the stored bytes: a laptop left on a train, a decommissioned drive that was never wiped, a storage bucket left open to the internet, a backup tape in a courier van. In each of those cases the attacker gets the file and not the key, so the file is noise.

protects data while it moves, normally with Transport Layer Security. The threat it answers is interception and tampering on the network path. This matters more on a data platform than people expect, because a pipeline is a long chain of hops between services, and each unprotected hop is a place where traffic can be read or altered without either end noticing. Internal traffic counts. The idea that the private network is safe stopped being defensible when the private network became a virtual network shared with everything else the organisation runs.

Now the honest part. Neither control stops the attack in the figure above. A stolen analyst session arrives at the platform holding valid credentials. The storage layer decrypts for that session exactly as it decrypts for a legitimate one, because from the storage layer's point of view there is no difference. Encryption is not a judgement about who is asking. It is a property of the stored and transmitted form. A credential attack walks straight past it, and the control that reduces the damage is the one further up the stack that limits what a permitted reader can see.

Encryption fails in practice through rather than through broken ciphers. The recurring failure modes are worth naming individually. Keys stored beside the data they protect, so that whoever takes the data takes the key. Keys held entirely by the service provider, so that a compulsory access request served on the provider reaches plaintext without the customer ever being told. No rotation, so a key exposed years ago still opens everything written since. No revocation path, so the response to a suspected compromise is a project rather than an operation. And the opposite failure, which is destruction: a key deleted without a tested recovery path takes the data with it, permanently, and no amount of backup of the ciphertext helps.

The practical question to ask a platform team is not whether encryption is enabled. It is who can compel decryption, how quickly a key can be rotated, and what has ever been restored from an encrypted backup in a drill. Those three answers tell you whether the encryption is a control or a diagram.

Common misconception

Our data is encrypted at rest and in transit, so a stolen account is not a data breach risk.

Encryption protects the stored form and the network path. It does not authenticate intent. A session with valid credentials receives plaintext by design, because decryption happens transparently below the application. The controls that reduce the damage from a stolen account are the ones that limit what an authorised reader can see and do: access policy enforced in the engine, masked columns, row scoping, query rate and volume limits, and audit logging that makes the unusual export visible while it is happening rather than three months later.

If encryption cannot tell a stolen session from a legitimate one, something else has to. Access control is where that decision is made, and the choice of model determines what kinds of rule you are able to express at all.

40.3 Access models: RBAC, ABAC, and where to place the filter

attaches permissions to roles and grants roles to people. What someone may do follows from the job they hold, not from a request they once made. Its strength is administrability: there is a finite set of roles, a review can ask what each role can now reach, and a leaver loses everything at once when the role is removed. Its weakness is drift. Roles accumulate permissions because adding one to an existing role is always easier than arguing for a new role, and after three years the analyst role can read things nobody would grant an analyst today.

decides each request by evaluating attributes of the requester, the data, the action and the context against a policy. Clearance level, data classification, purpose of processing, project membership, country of access and time of day can all combine without a role being defined for every permutation. Its strength is expressiveness: rules that would need hundreds of roles collapse into a handful of policies. Its weakness is that a policy set is harder to reason about than a role list, and a question as simple as which people can currently read the payments table may only be answerable by evaluating the policy against every possible requester.

The choice is not ideological. Use roles when the meaningful distinctions line up with jobs and the population of jobs is small and stable. Move to attributes when the decision genuinely depends on something about the data or the context that a job title does not capture, which in a data platform is usually classification, purpose, or which project a request belongs to. Most mature estates run both: roles carry the coarse grant, attributes carry the conditions on top of it.

Placement matters as much as model. attaches policies to the table itself, so the database applies the restriction to ordinary queries whichever tool issued them. The PostgreSQL implementation makes the failure mode clear: tables have no policies by default and are equally readable by anyone with table privileges, but once row security is enabled with no policy present, the default is deny. It is equally clear about who sits outside the mechanism, and that is the part a reviewer has to check. Superusers and roles carrying the BYPASSRLS attribute always bypass row security, and the table owner normally bypasses it too unless the owner opts in with ALTER TABLE ... FORCE ROW LEVEL SECURITY. A policy therefore binds the roles that analysts and services actually connect as, which is an argument for those roles owning nothing and holding no bypass attribute. Column level controls do the equivalent job sideways, refusing or masking a field rather than a record.

The alternative, filtering in the reporting layer, is a convention rather than a control. It holds until somebody connects a notebook, a scheduled extract or a new dashboard directly to the warehouse, at which point the filter that lived in the report is simply absent. A policy held in the engine is the thing that actually binds, and it is also the thing you can show an auditor without a demonstration.

The access matrix figure above is a discipline rather than a diagram. Roles across the top, assets down the side, and every cell filled with none, masked or full plus the reason for the answer. Filling it exposes two things a policy document hides. First, that no row and no column is uniform: the support agent has full access to the customer table one record at a time and no access at all to model features, while the analyst has the opposite shape. Second, that an unfilled cell is not a neutral state. In a real system an undecided pairing defaults to whatever the underlying grant allows, which is almost always more than anyone intended.

Where research or third-party access is involved, the framework gives a broader frame than access control alone. As the UK Data Service sets it out for its own secure lab, it spreads control across safe projects, safe people, safe data, safe settings and safe outputs, which explains why a secure environment can work with data that would be far too disclosive to hand over, and why relaxing any one of the five has to be paid for in the others.

None of this is inspectable after the fact without . A chronological record of sign-ins, reads, changes, exports and administrative actions is what turns access control from something that exists into something that can be shown to have worked. Without it an incident becomes an argument about what probably happened.

Common misconception

Senior people should have broader data access, because they carry more responsibility.

Access follows the job, not the rank. A support agent who resolves complaints needs to see one whole customer record at a time and has no reason to see the model feature store. A director who reviews aggregate performance needs no route to individual payment details at all, and granting it enlarges the blast radius of the single most heavily targeted set of credentials in the organisation. Seniority is an argument for approving access decisions, not for receiving access.

Access control answers whether a request is allowed. The next layer answers a different question: given that the request is allowed, how much of the real value should come back?

40.4 Masking against tokenisation

removes a field or replaces it with a stand-in value, so the original cannot be read. A phone number becomes a run of asterisks, a surname becomes a generated pseudonym, a date of birth becomes a year. The NIST glossary fixes the defining property in the definition itself: the removal or replacement is done in a way that leaves no analytic utility in the value, and the examples it gives are asterisks over a phone number and a randomly generated pseudonym. That is the trade: the protection and the loss are the same act. Masking is most often the only thing standing between a test environment and real customer records, which is precisely the setting where nobody reviews it.

replaces a sensitive value with a surrogate and keeps the mapping back to the original in a separate protected system. The token travels through applications that never need the real value, and reversing it is a controlled operation performed by the token service. The PCI Security Standards Council's guidance sets the security bar plainly: recovering the original value must not be computationally feasible from a token, or from any number of tokens.

The distinction that matters is reversibility, and what follows from it. Masking destroys the value at the point of display or copy, so a masked field cannot be turned back and cannot support the analysis the original supported. Tokenisation preserves the value somewhere and preserves referential behaviour: the same input yields the same token, so joins and counts still work across systems that hold only tokens. What tokenisation does is relocate the secret. The sensitive value now lives in one hardened vault instead of forty applications, which shrinks the audit surface of the estate rather than reducing the risk in any single place. If the vault falls, everything falls.

The non-production case is where the choice bites hardest. A test environment needs data that behaves like production: the same distributions, the same edge cases, the same referential structure across tables. Masking gives you that structure while destroying the values, which is usually the right answer, and the failure mode is partial application, where nine columns are masked and the tenth was added last sprint by someone who did not know the masking rules existed. Tokenisation gives you structure and reversibility, which is more than a test environment should have, so the token service is normally scoped so that non-production systems can hold tokens and cannot de-tokenise. Deciding this per environment, and enforcing it in the provisioning process rather than in a wiki page, is the difference between a control and an intention.

Neither technique is anonymisation. A tokenised customer identifier still singles out an individual and is therefore still , because the organisation holds the means to reverse it. A masked dataset may or may not be personal data depending on what is left and what else can be joined to it. That assessment belongs with anonymisation and the motivated intruder test, not with a product datasheet.

Controls are chosen against risk, and the standard of care is set partly by law and partly by what the field now considers ordinary practice. Both are moving.

40.5 The regulatory hooks and the post-quantum horizon

The UK security duty for personal data sits in two places. Article 5(1)(f) states the principle, and Article 32 turns it into an obligation on both the controller and the processor to implement measures appropriate to the risk. Appropriate is the statutory word, and the article says what it is judged against: the state of the art, the cost of implementation, and the nature, scope, context and purposes of the processing.

Taking into account the state of the art, the costs of implementation and the nature, scope, context and purposes of processing as well as the risk of varying likelihood and severity for the rights and freedoms of natural persons, the controller and the processor shall implement appropriate technical and organisational measures to ensure a level of security appropriate to the risk

UK GDPR, Article 32(1) - Security of processing

The lead-in is the whole balancing test, and it is why no fixed list of controls discharges the duty. Article 32 also binds the processor directly, which is why security clauses in a processing contract are not the whole story: the processor carries its own statutory duty. The lettered points the colon introduces are pseudonymisation and encryption, the ability to ensure ongoing confidentiality, integrity, availability and resilience, the ability to restore access after an incident, and a process for regularly testing the effectiveness of the measures. They are framed as things to include where appropriate rather than as mandates, so the same control can be required for one processing activity and out of proportion for another.

Around that legal core sit the frameworks a data team is measured against in practice. NIST's Cybersecurity Framework 2.0 is the common language for organising and reporting security work, and its 2024 revision added a governance function, which pulled risk ownership and policy out of the technical functions and gave them their own home. ISO/IEC 27001 supplies the certifiable management system, with information deletion sitting among its Annex A controls. ISO/IEC 27701 carries the same evidence discipline into privacy, and its status changed with the 2025 revision published in October of that year: the 2019 edition was written as an extension to ISO/IEC 27001 and 27002, whereas the 2025 edition is a standalone privacy information management system standard, so an organisation can be certified against it without holding an information security management system first. None of these frameworks tells you which controls to buy. They tell you how to decide, record the decision, and show that the decision was reviewed.

The horizon item is cryptographic. Much of the public key cryptography in use today rests on mathematical problems that a sufficiently capable quantum computer could solve. replaces those algorithms with ones built to resist that attack. NIST released the first standards in August 2024: FIPS 203 for key encapsulation, and FIPS 204 and FIPS 205 for digital signatures.

The reason this belongs in a data course rather than only in a cryptography one is the shape of the risk. Encrypted traffic captured today can be stored until a machine exists that can open it, so the exposure is set by how long the data must stay confidential rather than by when the machine arrives. For a session cookie that is irrelevant. For genetic data, adoption records, national security material or thirty-year commercial contracts it is not. The practical first step is not a migration but an inventory: which datasets have a confidentiality requirement that outlives the current algorithms, and where does the cryptography protecting them actually live?

40.6 Check your understanding

An attacker obtains a data analyst's password from an unrelated breach and signs in to the analytics platform. The platform encrypts all storage volumes and enforces TLS on every connection. Which control, if it had been configured, would have most reduced the volume of personal data the attacker could read?

A retailer needs its fraud analytics team to join transactions across four systems without any of those systems holding card numbers, while the payments team must still be able to retrieve the real number to process a chargeback. Which technique fits, and why?

A team enforces access rules by filtering rows inside its BI tool. An analyst then connects a Python notebook straight to the warehouse, using a database role that owns no tables and carries no bypass attribute. What is the security consequence, and what fixes it?

Core distinctions

  • Weight confidentiality, integrity and availability per dataset rather than reciting all three. Payroll is confidentiality-dominated, a billing meter archive is integrity-dominated, and a public timetable feed is availability-dominated with no confidentiality requirement at all.
  • Encryption at rest defends stolen media and exposed storage; encryption in transit defends the network path. Neither is a judgement about who is asking, so a session with valid credentials receives plaintext by design.
  • Encryption fails through key management, not broken ciphers: keys stored beside the data, keys the provider alone controls, no rotation, no revocation path, or destruction without a tested recovery route.
  • Roles suit stable job-shaped distinctions and drift by accumulating permissions; attributes express conditions roles cannot and are correspondingly harder to prove correct. Most estates need both.
  • Put the restriction in the engine. A row level policy binds every query from a role that is subject to it, whichever client connects, while a filter in the reporting layer disappears the moment somebody points a notebook at the warehouse. Check the exemptions: PostgreSQL lets superusers and BYPASSRLS roles through, and the table owner unless FORCE ROW LEVEL SECURITY is set.
  • Masking destroys the value and the analysis it supported. Tokenisation preserves joins and relocates the secret into one vault, which shrinks the audit surface rather than reducing risk in any single place. Neither is anonymisation.
  • UK GDPR Article 5(1)(f) sets the security principle and Article 32 binds both controller and processor to measures appropriate to the risk. NIST released the first post-quantum standards, FIPS 203, 204 and 205, in August 2024, and the datasets that need them first are the ones with the longest confidentiality life.

Standards and sources cited in this module

  1. UK GDPR, Article 5 (Principles relating to processing of personal data)

    Article 5(1)(f), integrity and confidentiality

    Primary text of the security principle, including the words appropriate and organisational that set the standard of care.

  2. UK GDPR, Article 32 (Security of processing)

    Article 32(1)

    The operative security obligation, binding controller and processor, and the list of measures to consider where appropriate.

  3. NIST SP 800-57 Part 1 Rev. 5, Recommendation for Key Management

    Cryptographic key lifecycle

    The authority for treating key generation, distribution, storage, rotation, revocation and destruction as the thing encryption depends on.

  4. NIST SP 800-52 Rev. 2, Guidelines for the Selection, Configuration, and Use of TLS Implementations

    Protocol versions and cipher suite selection

    Practical guidance for encryption in transit, including which versions and suites to allow on server and client.

  5. NIST Computer Security Resource Center glossary: attribute based access control

    Four definitions, sourced to NIST SP 800-95, CNSSI 4009-2015, NIST SP 800-192 and NIST SP 800-162

    Definitional source for the attribute model, useful when a vendor uses the term loosely.

  6. NIST Computer Security Resource Center glossary: masking

    Definition sourced to NIST SP 800-188 and NISTIR 8053

    Definitional source for masking, including the point that the removal or replacement leaves no analytic utility in the value.

  7. UK Data Service: what is the Five Safes framework?

    Safe projects, safe people, safe data, safe settings and safe outputs

    Source for the five dimensions and for how a secure research environment trades them against each other.

  8. PostgreSQL documentation: Row Security Policies

    Enabling row security, the default-deny behaviour, and who bypasses it

    Concrete implementation showing why a policy in the engine binds clients rather than tools, what happens when row security is enabled with no policy present, and which roles are exempt.

  9. PCI Security Standards Council, PCI DSS Tokenization Guidelines, version 2.0

    Tokens, de-tokenisation, and the infeasibility requirement

    Source for what a token is, what de-tokenisation means, and the bar that recovering the original must not be computationally feasible.

  10. NIST Post-Quantum Cryptography project

    FIPS 203, FIPS 204 and FIPS 205, released August 2024

    Official source for the first post-quantum standards and for the argument that data captured now can be stored until it can be opened.

Module 40 of 52 · Privacy and protection