Objectives and prerequisites
By the end of this course, you will be able to apply GDPR principles in a web project: identify roles, choose a legal basis, minimise data, answer rights requests, keep a register, secure data and handle a breach. The common thread is the Mdjad site and its contact form.
Prerequisites: know web development and security basics (courses F04 and F05). Examples use PHP, SQL, YAML and HTTP. The content is educational and does not replace legal advice suited to your situation.
Path: chapters 1 to 3 establish principles, roles and legal bases; chapters 4 and 5 cover minimisation and rights; chapters 6 to 8 cover register, security and retention; chapters 9 and 10 assemble consent and the compliance plan.
Convention: every processing operation must answer four questions: why, which data, for how long, who accesses it. If an answer is missing, the processing is not controlled. Compliance is demonstrated by evidence, not intentions.
1. Principles and vocabulary
The GDPR governs the processing of personal data: any information that can identify a person, directly or indirectly. A name, email, IP address or cookie identifier may be personal data.
Personal data : information relating to an identified person
Processing : collection, storage, use, disclosure, erasure
Purpose : precise and legitimate reason for processing
Legal basis : legal ground authorising the processing
Retention : time necessary for the purpose
Processor : provider processing for the controller
The principles structure everything else: lawfulness, fairness and transparency; purpose limitation; minimisation; accuracy; storage limitation; integrity and confidentiality; accountability. The last principle requires being able to demonstrate compliance.
Purpose is the key. Data collected to answer a message cannot be reused for marketing without a compatible legal basis. Changing purpose requires a new analysis, not a simple mention in the terms.
Minimisation means collecting only what is necessary. A contact form does not need a birth date, social security number or bank card number. Every superfluous field increases risk and compliance cost.
Finally, transparency translates into clear information at collection time: purpose, legal basis, recipients, retention, rights. A long, unreadable privacy policy does not satisfy the information requirement.
2. Roles: controller, processor, DPO
The controller decides purposes and means. The processor processes data on the controller’s behalf, on instruction, without deciding purposes. A hosting provider or an emailing tool is often a processor.
Controller : Mdjad — decides why and how data is processed
Processor : host, email service, analytics tool
DPO : advises, monitors, is a contact point (if appointed)
Data subjects : visitors, prospects, customers, candidates
Qualification is not a commercial label: it depends on the actual role. A provider that uses data for its own purposes becomes a controller or joint controller. The contract must precisely describe instructions and obligations.
A data protection officer (DPO) is mandatory in some cases, notably large-scale processing of sensitive data or systematic monitoring. Even without an obligation, a reference person helps maintain procedures and evidence.
Data subjects must be able to exercise their rights with the controller. A generic contact form is not enough: provide an identified channel, a procedure and a one-month response time, extendable in the cases provided for.
Finally, document who does what: who validates a form, who answers an access request, who deletes an account, who contacts the provider. An unclear organisation makes deadlines and evidence impossible to meet.
3. Legal bases and purposes
Every processing operation must rely on a legal basis: consent, contract, legal obligation, vital interest, public interest task or legitimate interest. The choice must be documented and suited to the context, not copied from a template.
Contact form : legitimate interest or consent depending on use
Order : performance of the contract
Invoicing : legal obligation
Newsletter : consent, with proof and easy withdrawal
Analytics cookies : consent, except a limited exemption
Consent must be freely given, specific, informed and unambiguous. A pre-ticked box is not consent. It must be as easy to withdraw as to give, and proof of the agreement must be kept with its date and version.
Legitimate interest requires a balancing test: the controller’s interest, data subjects’ rights and expectations, safeguards. It does not allow everything. For direct marketing it is weaker than clear consent, and national rules may restrict its use.
The same data may serve several purposes if each has a legal basis. A contact email may be used to reply, then for a newsletter only with consent. Compatibility of purposes is analysed, not presumed.
Finally, sensitive data — health, origin, opinions, etc. — is subject to strengthened conditions. A form must not collect it without necessity and a specific legal basis. Silence or implied consent is not enough.
4. Minimisation and privacy by design
Privacy by design and by default means compliance is built into the product, not added afterwards. By default, the application collects the minimum, keeps the minimum and exposes the minimum.
<?php
declare(strict_types=1);
namespace App\Contact;
final readonly class ContactRequest
{
public function __construct(
public string $name,
public string $email,
public string $message,
public string $locale,
) {
}
public static function fromForm(array $input): self
{
return new self(
trim((string) ($input['name'] ?? '')),
trim((string) ($input['email'] ?? '')),
trim((string) ($input['message'] ?? '')),
in_array($input['locale'] ?? 'fr', ['fr', 'en', 'sw'], true) ? $input['locale'] : 'fr',
);
}
}
The object above carries only the necessary fields. It does not accept a birth date, phone number or attachment by default. An explicit object is better than a free array that accumulates fields over requests.
Minimisation also concerns logs, exports and copies. A log keeping the full IP address for a year, a CSV export left on a desktop or a database copy on a personal computer are uncontrolled processing operations.
Pseudonymisation reduces risk: replacing a direct identifier with a value that cannot be reversed without a key. Anonymisation must make re-identification impossible; it is more demanding than a simple email hash.
Finally, privacy by default applies to settings: sharing disabled, limited visibility, short retention, restricted access. Users should not have to look for an option to protect their data.
5. Data subject rights
People have rights: information, access, rectification, erasure, restriction, objection and portability. These rights are not absolute; they interact with legal obligations and the rights of others.
GET /fr/mon-compte/mes-donnees HTTP/1.1
Host: mdjad.net
Cookie: session=<authenticated-session>
HTTP/1.1 200 OK
Content-Type: application/json
Content-Disposition: attachment; filename="my-data.json"
{"account":{"email":"client@example.test"},"messages":[],"consents":[]}
Access must be secure: data is not handed to anyone who knows an email. An authenticated session or proportionate identity verification is required. The export must be readable and include the data actually processed.
Erasure is not always possible: an invoice must be kept for an accounting obligation. The answer must explain what is deleted, what is kept and why. An undocumented partial deletion creates confusion.
Portability concerns data provided by the person, processed under contract or consent, in a structured, machine-readable format. It does not cover derived data or trade secrets.
Finally, the response time is one month in principle. A complex request may be extended with information. Requests must be traced: date, channel, verified identity, response, decision. Without a trace, compliance cannot be demonstrated.
6. Register, contracts and processors
The record of processing activities describes each processing operation: purpose, legal basis, data categories, data subjects, recipients, transfers, retention, security measures. It is kept up to date and proportionate to the organisation’s size.
processing: contact-form
purpose: answer requests sent from the site
legal_basis: legitimate interest
data: [name, email address, message, language]
recipients: [Mdjad team, hosting provider]
retention: 12 months after the last exchange
security: [restricted access, TLS, logging]
non_eu_transfers: none
The register is not a decorative document: it helps answer requests, prepare an impact assessment and identify risks. Processing without a register is processing the organisation does not know about.
Processors must offer sufficient guarantees. The contract specifies the object, duration, nature of processing, data categories, instructions, confidentiality, security, further subcontracting, assistance and return or deletion.
Transfers outside the European Union require a ground: adequacy decision, standard contractual clauses, binding corporate rules or a derogation. The fact that a provider is “European” is not enough if its servers or support are elsewhere.
Finally, keep a list of tools that receive data: host, email, payment, analytics, support. For each, note the role, contract, country and duration. This list is the map of subcontracting risks.
7. Security and data breaches
Security is a strengthened obligation of means: technical and organisational measures suited to the risk. Encryption in transit, access control, backups, logging, updates and awareness are part of it.
#!/usr/bin/env bash
set -euo pipefail
# Check that logs do not contain obvious sensitive data.
grep -RInE '(password|passwd|token|secret)=' /var/log/mdjad/ \
| grep -v 'password_hash' \
&& { echo "sensitive data detected"; exit 1; } || true
echo "log check complete"
A data breach is a security incident leading to destruction, loss, alteration, unauthorised disclosure of, or access to, personal data. It must be documented, even if it is not notifiable.
Notification to the supervisory authority is required within 72 hours when a breach presents a risk to rights and freedoms. If the risk is high, data subjects must also be informed, with clear advice.
The breach register records the nature, categories and volumes, consequences, measures taken and the decision to notify or not. An undocumented breach cannot be defended as controlled.
Finally, prepare the response before the incident: who decides, who notifies, how to inform people, how to fix. A crisis team without training discovers its gaps at the worst moment.
8. Retention, anonymisation and deletion
Data must not be kept indefinitely. Retention follows from the purpose and legal obligations. It must be documented and applied automatically, not left to team memory.
-- Anonymise contact messages closed for more than 12 months.
UPDATE contact_message
SET name = 'anonymous',
email = CONCAT('anonymous-', id, '@invalid.local'),
message = '[deleted]',
anonymized_at = UTC_TIMESTAMP()
WHERE closed_at < UTC_TIMESTAMP() - INTERVAL 12 MONTH
AND anonymized_at IS NULL;
Deletion must propagate: main database, copies, caches, exports, backups according to policy. A backup may keep data longer if it is isolated and restored with deletions applied.
Anonymisation must be irreversible under reasonable conditions. Deleting a name but keeping an identifying email is not enough. Check that remaining data cannot re-identify the person through cross-referencing.
Retention periods must be consistent between the register, the privacy policy and the code. A gap between the promise and actual behaviour is non-compliance, even without an incident.
Finally, automate the purge and monitor its execution. A silent cron that no longer runs lets data accumulate. Scheduled deletion is part of operations, with a log and an alert on failure.
9. Cookies, trackers and consent
Non-essential cookies and trackers require prior, free, specific and informed consent. Cookies strictly necessary for the requested service may be exempt under conditions. Refusal must be as simple as acceptance.
POST /api/consent HTTP/1.1
Content-Type: application/json
{"consent_id":"c_01J9...","policy_version":"2026-10","categories":{"analytics":false,"marketing":false}}
HTTP/1.1 201 Created
{"consent_id":"c_01J9...","recorded_at":"2026-10-23T10:00:00+03:00"}
Consent must be proven: identifier, date, policy version, accepted or refused categories. A banner that does not allow refusal as easily is not compliant. Pre-ticked boxes and silence are not agreement.
Analytics trackers may benefit from a limited exemption if they are strictly necessary for audience measurement, configured not to track users and not to transmit data to third parties. Conditions are precise; when in doubt, ask for consent.
Withdrawal must be accessible at any time. Choices must be stored and respected by the code: do not load an analytics script before agreement, and do not reload it after refusal. A compliant banner is not enough if technical behaviour contradicts it.
Finally, session and security cookies must be configured correctly: Secure, HttpOnly, SameSite, limited duration. A session cookie without protection is a security risk, not only a compliance topic.
10. Summary: Mdjad’s compliance plan
The plan gathers processing operations, legal bases, retention, processors, security measures, rights procedures and breach procedures. It fits in a register, a privacy policy and operational procedures.
1. Processing inventory and register
2. Legal bases and information to data subjects
3. Minimisation and retention periods
4. Processors, contracts and transfers
5. Security, logs and backups
6. Rights procedure and deadlines
7. Breach procedure and notification
8. Cookies and consent
9. Evidence, reviews and training
10. Contact and continuous improvement
For Mdjad, the main processing operations are the contact form, accounts, orders, newsletter, analytics and support. Each has a purpose, a legal basis, a retention period and an owner. Processors are the host, the email service and the analytics tool.
The main risks are excessive collection, overly long retention, logs containing sensitive data, cookies loaded before consent and untracked rights requests. Each has a measure, an owner and a deadline.
Compliance is demonstrated by evidence: up-to-date register, signed contracts, consent logs, tested procedures, deletion traces. A statement of intent is not enough. Annual review and team training keep the system alive.
Finally, the GDPR is not only a constraint: it requires clarity about data, which improves security, quality and trust. An organisation that knows why it collects data also knows when to delete it.
Exercise 1 — Qualify a processing operation
The contact form collects name, email, message and IP address. What is the purpose, legal basis and proposed retention?
Solution
Purpose: answer requests. Legal basis: legitimate interest or consent depending on use, to be documented. Retention: for example 12 months after the last exchange, with automatic purge. The IP address must be justified (security, anti-spam) and its retention limited.
Exercise 2 — Minimise a form
A quote form asks for birth date, social security number and salary. What should you do?
Solution
Remove fields not necessary for the quote. Birth date, social security number and salary are not required to produce a quote. Every field must have a documented purpose and a legal basis. Minimisation reduces risk and cost.
Exercise 3 — Answer an erasure request
A customer asks for all their data to be deleted, but an invoice must be kept. What do you answer?
Solution
Explain what is deleted and what is kept under a legal obligation, with the duration. Delete or anonymise data that is not necessary. Trace the request, identity verification, decision and date. The invoice remains accessible only to authorised people.
Exercise 4 — Register
Write a register entry for the newsletter. Which fields are essential?
Solution
Purpose, legal basis (consent), data categories (email, optional name, date and proof of consent), data subjects, recipients (email service), retention, security measures, transfers. Proof of consent and the withdrawal mechanism must be described.
Exercise 5 — Data breach
A backup containing emails is exposed by mistake for two hours. What do you do?
Solution
Contain the exposure, revoke access, assess the data and the risk, document the incident in the breach register. If there is a risk to rights and freedoms, notify the authority within 72 hours and, if the risk is high, inform the people. Fix the cause and hold a retrospective.
Exercise 6 — Cookies
A banner offers “Accept all” but refusal requires three clicks. Is that compliant? How do you fix it?
Solution
No: refusal must be as simple as acceptance. Add a “Reject all” button at the same level, allow per-category choice, load no non-essential tracker before agreement and honour withdrawal. Keep proof of the choice and its version.
Final project — Compliance plan
Produce a compliance plan for the Mdjad site: processing register, legal bases, retention, processors, security measures, rights procedure and breach procedure. Attach a readable privacy policy and a verification checklist.
Criteria: processing operations inventoried; purposes and legal bases documented; minimisation; consistent retention; subcontracting contracts; security measures; rights procedure with deadlines; breach register; compliant cookies; evidence retained; no invented sensitive data.
Common mistakes and diagnosis method
Common mistakes: collecting “just in case”; keeping indefinitely; copying a generic policy; forgetting processors; loading cookies before consent; promising deletion that is not applied; ignoring rights requests; failing to document a breach.
Method: for each form, list the fields and justify each one. For each data item, state the retention and purge mechanism. For each tool, check the role and contract. For each right, test the journey and measure the delay. For each incident, document and fix.
Self-assessment
You must be able to explain the principles, distinguish controller and processor, choose a legal basis, minimise a form, answer a right, keep a register and react to a breach.
Self-assessment: I can justify every field of a form; I can explain the difference between consent and legitimate interest; I can describe the breach notification deadline; I can explain why an analytics cookie waits for consent. To go further, read the CNIL and EDPB guidelines.
References
- CNIL — GDPR, accessed 23 October 2026.
- EDPB — Guidelines and recommendations, accessed 23 October 2026.
- Regulation (EU) 2016/679, accessed 23 October 2026.
- CNIL — Cookies and trackers, accessed 23 October 2026.