Privacy and compliance
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
Privacy is more than keeping data safe: it asks whether personal data should be collected and used at all, and only in the ways people expect. Follow one sign-up as an eight-line Python function keeps only the two fields analytics needs and swaps the email for a keyed HMAC tag, then watch the record get deleted on schedule, a later leak of the analytics table expose almost nothing, and the response that follows. Finish with the five functions of the NIST Privacy Framework and what compliance really means.
Personal data
Personal data is information about a person who can be identified. NIST calls it PII: data that can identify someone alone, like an email, or combined, like a birth date plus a town. Lina signs up to a shop with five fields.
PII information that can be used to distinguish
or trace a person's identity (NIST, OMB A-130)
alone name, email address
combined birth date + country + plan ...
rec["name"] "Lina"
rec["email"] "lina@x.test"
rec["born"] "1990-04-12"
rec["plan"] "pro"
rec["country"] "KW"اقرأ الدرس خطوة بخطوة
Personal data
Personal data is information about a person who can be identified. NIST calls it PII: data that can identify someone alone, like an email, or combined, like a birth date plus a town. Lina signs up to a shop with five fields.
PII information that can be used to distinguish or trace a person's identity (NIST, OMB A-130) alone name, email address combined birth date + country + plan ... rec["name"] "Lina" rec["email"] "lina@x.test" rec["born"] "1990-04-12" rec["plan"] "pro" rec["country"] "KW"Privacy is not only security
Security keeps data safe from attackers. Privacy asks more: should we collect this data at all, and do we use it only in ways the person expects? NIST notes that harm can come from processing that works exactly as designed.
security protect data: confidentiality, integrity, availability privacy collect only what a purpose needs, use it the way people were told, keep it no longer than needed NIST PF problems can arise even when systems work as intended (e.g. smart meters)Start from the purpose
The analytics team only wants to count sign-ups per plan and country. So line 2 lists the fields that purpose needs: plan and country. Name, email and birth date are not needed. This is data minimisation.
purpose count sign-ups per plan and country KEEP = ("plan", "country") needed plan, country not needed name, email, born data minimisation collect and keep only what the purpose needsCopy only what is needed
Line 4 builds a new dictionary from the KEEP fields only. Plan and country are copied across; name, email and birth date never are. Data that is never copied cannot leak from analytics, be misused there, or need deleting later.
out = {f: rec[f] for f in KEEP} # a dict comprehension: one entry per field in KEEP >>> out {'plan': 'pro', 'country': 'KW'}Swap the email for a tag
Analytics still needs to tell sign-ups apart. Lines 5 to 7 replace the email with a pseudonym: an HMAC, a hash mixed with a secret key from the vault. The same email always gives the same tag; without the key, nobody can recompute it.
e = rec["email"].encode() # text -> bytes h = hmac.new(key, e, "sha256") # keyed hash out["uid"] = h.hexdigest()[:12] >>> out["uid"] # key = b"vault-demo-key" '846845aeba59' pseudonym still personal data (GDPR Recital 26) but useless without the keyAnalytics gets the small record
Line 8 returns the small record and it is saved in analytics: plan, country and a tag. The analytics system never holds a name, an email address or a birth date, so there is far less to protect there.
>>> for_stats(rec, key) {'plan': 'pro', 'country': 'KW', 'uid': '846845aeba59'} in analytics plan, country, uid never in it name, email, born stays separate the key, in the vaultDelete it when done
Personal data should be kept only as long as its purpose needs. This shop's rule: when an account closes, a scheduled job deletes the sign-up record and logs that it did. Lina closes her account, and her record is erased.
storage limitation keep no longer than needed the shop's rule account closed -> delete record how a scheduled job, not memory proof log "record deleted" (no PII in the log line itself) OWASP privacy risk P6 Insufficient Deletion of User DataDetect: a table walks out
Months later, an alert fires: the analytics table is being copied out to the internet. This is the Detect part of incident response. The attacker gets plans, countries and tags, but no names, emails or birth dates.
alert large export from analytics to an unknown address taken plan, country, uid not there name, email, born (minimised) the tags cannot be turned back into emails without the key in the vaultRespond: contain, assess, notify
Respond: stop the leak, then check your data map (your list of what data you hold, and where) to see whose data left. Is the vault key safe? Laws may require notice: the EU GDPR wants the regulator told within 72 hours where feasible.
contain block the export, reset the access used assess data map: which fields, whose data key still safe? if not, rotate it notify follow the plan and the law GDPR Art. 33: regulator, without undue delay, within 72 h where feasible (not needed if unlikely to put people at risk) CISA include breach notification in the incident response planCompliance: the Privacy Framework
Compliance means showing you meet the rules that apply to you. NIST's Privacy Framework organises the work in five functions. Identify-P: map what data you hold and why. Govern-P: set policies, roles and legal duties. Control-P: manage data, like minimising and deleting it.
NIST Privacy Framework 1.0 (2020-01-16) ID-P Develop the organizational understanding to manage privacy risk for individuals arising from data processing. GV-P Develop and implement the organizational governance structure to enable an ongoing understanding of the organization's risk management priorities that are informed by privacy risk. CT-P Develop and implement appropriate activities to enable organizations or individuals to manage data with sufficient granularity to manage privacy risks.Communicate and protect
Communicate-P: tell people in plain words how their data is used, and listen. Protect-P: safeguard the data, like the keyed tags and the separate vault. Passing an audit is not the goal; keeping people from harm is.
CM-P Develop and implement appropriate activities to enable organizations and individuals to have a reliable understanding and engage in a dialogue about how data are processed and associated privacy risks. PR-P Develop and implement appropriate data processing safeguards. compliance show the rules are met (records, data map, policies, audits) privacy the people behind the data come to no harm
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01A team wants to count sign-ups per country. Which fields should their copy of the data hold?
Data minimisation: keep only what the purpose needs. Counting by country needs the country, and a pseudonymous tag lets the team tell sign-ups apart without holding emails.
02Why does the function use HMAC with a secret key instead of a plain SHA-256 hash of the email?
Emails are easy to guess, so an unkeyed hash can be matched by guessing. The keyed hash needs the secret from the vault, which is kept apart from the data. Neither one can be reversed directly.
03The analytics table holding plan, country and HMAC tags is stolen. Which statement is true?
Whoever holds the key could link the tags back to emails, so the data is still personal. Responders confirm the key was not taken, record the breach and decide on notice; minimisation kept names, emails and birth dates out of the leak.
04Under the EU GDPR, when should a controller normally tell the supervisory authority about a personal data breach that may put people at risk?
GDPR Article 33(1) sets the 72-hour expectation where feasible. Other places have their own rules, so an incident plan should list the ones that apply.
05Mapping what personal data you hold, where it lives and why you have it belongs to which NIST Privacy Framework function?
Identify-P is about understanding privacy risk from data processing, starting with an inventory of what data is processed and why. Control-P then manages the data (minimising, deleting).
المسرد
- Personal data (PII)
- Information that can be used to distinguish or trace a person's identity, either alone (an email address) or when combined with other information (a birth date plus a town).
- Privacy
- Making sure personal data is collected, used, shared and kept only in ways that are necessary and that people would expect, so they come to no harm. Security, keeping data safe from attackers, is one part of it.
- Data minimisation
- Collecting, copying and keeping only the personal data a specific purpose needs.
- Storage limitation (retention)
- Keeping personal data only as long as its purpose needs, then deleting it, ideally by a scheduled job that also records that it ran.
- Pseudonymisation
- Replacing an identifier, such as an email, with a tag that cannot be linked back without extra information (here, a secret key) kept separately. Pseudonymised data is still personal data.
- HMAC
- A hash-based message authentication code: a hash computed with a secret key. The same input and key always give the same tag; without the key, nobody can compute it.
- Data breach notification
- Telling regulators and, when required, the people affected, that their personal data was exposed. Rules and deadlines depend on the law that applies, such as 72 hours to the regulator under the EU GDPR.
- Compliance
- Showing, with records, policies and audits, that an organisation meets the laws and standards that apply to it. It supports privacy but is not the same thing.
الملاحظات والمصادر
- The demo key is a short readable string so the example can be checked. A real key is random (for example 32 random bytes for HMAC-SHA-256), comes from a key vault and is never written in code.
- The tag is cut to 12 hex digits (48 bits) to fit the figure. That is plenty to tell a few thousand sign-ups apart, but real systems usually keep the full 64 digits.
- A pseudonym is not anonymous. Whoever holds the key can link the tag back to an email, so EU law still treats pseudonymised data as personal data. It lowers the risk; it does not remove it.
- Which laws apply depends on where people live and what data is held. GDPR is one example; many US states, and other countries, have their own breach notification rules. Ask a privacy lawyer, not a course.
- This course is about defence. It explains how attacks work only at the level needed to stop them, and never how to attack a real system.
- NIST Privacy Framework Version 1.0 (NIST CSWP 01162020, January 16, 2020)
- NIST CSRC Glossary: personally identifiable information
- NIST SP 800-122: Guide to Protecting the Confidentiality of Personally Identifiable Information (PII)
- NIST SP 800-53 Rev. 5: Security and Privacy Controls (SI-12, PM-5, PT family)
- NIST SP 800-61 Rev. 3: Incident Response Recommendations and Considerations for Cybersecurity Risk Management
- OWASP Top 10 Privacy Risks (v2.0, 2021)
- OWASP Logging Cheat Sheet
- CISA: Protecting Sensitive and Personal Information from Ransomware-Caused Data Breaches (fact sheet)
- ENISA: Pseudonymisation techniques and best practices (2019)
- Regulation (EU) 2016/679 (GDPR): Articles 4(5), 5(1)(c), 5(1)(e) and 33
- Python documentation: hmac, keyed-hashing for message authentication
اختبار يتاح بعد الخطوة الأخيرة.