ismycodesafe.com

GDPR for Developers: Consent, Rights Endpoints, Breach Clock

This practical guide covers everything a developer is directly responsible for under GDPR: lawful basis for processing, consent implementation, data subject rights endpoints (Articles 15-22), encryption at rest and in transit, and the 72-hour breach notification window.

··12 min read·By ismycodesafe.com Security Team
EU flag with GDPR key concepts: Consent, Data Minimization, 72-hour Breach Notice, Encryption

Key Takeaway

GDPR practical guide for developers: implement lawful consent (no pre-checked boxes), build data subject rights endpoints (access, erasure, portability), encrypt sensitive fields at rest, and have a tested breach response plan that can hit the 72-hour notification window.

GDPR: What Developers Are Actually Responsible For

Most GDPR guides are written for legal teams. This is a practical guide for developers - the people who build the forms, APIs, databases, and pipelines that actually process personal data. As a developer, GDPR puts specific obligations on the code you write: how you collect consent, which endpoints you expose, how you store passwords, and what happens when a breach occurs.

The five areas where developer decisions directly affect GDPR compliance:

  1. Lawful basis and consent: no tracking script loads before the consent event fires; no pre-checked boxes; separate toggles per purpose category
  2. Data subject rights: Articles 15-22 require specific endpoints - access export, rectification, erasure, portability, restriction
  3. Encryption: TLS 1.2+ in transit; application-level encryption for sensitive fields at rest; Argon2/bcrypt for passwords
  4. Data minimization: collect only what you need; enforce retention limits in queries, not just policy documents
  5. Breach response: 72-hour notification window from discovery; you cannot hit it without logging, alerting, and a documented incident response plan already in place

The rest of this practical guide covers each area with code-level specifics. Start with consent and data subject rights - regulators scrutinize those first.

You need a lawful basis to collect input data. For analytics and marketing cookies that basis is consent under Article 6(1)(a). Requirements for valid consent:

  • Freely given - no "accept all or leave" dark patterns
  • Specific - separate toggles for analytics, marketing, functional cookies
  • Informed - explain what data you collect, how long you keep it, and who processes it
  • Pre-checked boxes are illegal - opt-in only, never opt-out
  • No tracking scripts load before consent fires

Withdrawing consent must be as easy as giving it. Store consent timestamps and the exact version of the consent text shown. You will need this in a regulator investigation.

Your site sets cookies before the banner exists

Run this against your own homepage, no browser involved:

curl -sI https://example.com | grep -i '^set-cookie'

Every line it prints is a cookie your server set on the very first response. No banner has rendered, so nobody has clicked anything. That is fine for a session or load-balancer cookie, which the ePrivacy Directive's Article 5(3) treats as strictly necessary. It is not fine for anything that tracks or profiles a visitor.

How often does it happen? When we scanned 2,211 sites in May 2026, 933 gave back a readable response that our filter didn't flag as a bot wall or an error page, and 338 of those set at least one cookie before any banner could appear (internal ismycodesafe data, method). Among cookies the scanner flagged for missing security attributes, the names that came up most were PHPSESSID, XSRF-TOKEN, localization and cuid, with Shopify's analytics pair _shopify_y and _shopify_s close behind. Sessions and CSRF tokens are the easy part. The analytics pair is where the consent question gets serious.

The curl test has a blind spot. Google Analytics, Meta Pixel and most ad tags write their cookies from JavaScript after the page loads, so they never show up in a response header. To catch those:

  1. Open a private window and go to your site.
  2. Before touching the banner, open DevTools, go to Application, then Cookies.
  3. Anything named _ga, _fbp or _gcl_au sitting there already means a tag fired before consent.
  4. Switch to the Network tab, reload, and filter for google-analytics, facebook and doubleclick. Requests there tell the same story even when the cookie is blocked.

It takes a couple of minutes and catches the consent bug developers ship most often: the tag manager loads in <head> and the consent check runs later.

Data Subject Rights: Building the Endpoints

Articles 15-22 of GDPR give individuals eight rights over their personal data. As a developer, you are the person who builds the endpoints that make those rights real. Regulators check these first because they are observable - a user can click a button and see if the system works.

ArticleRightWhat to buildDeadline
15Right of accessGET /api/user/data-export - returns all personal data held about the user in JSON or CSVOne month (extendable)
16Right to rectificationPATCH /api/user/profile - authenticated update for any personal fieldOne month (extendable)
17Right to erasureDELETE /api/user/account - hard delete of personal data across all tables; cascade to logsOne month (extendable)
18Right to restrictionFlag on the user record: processing_restricted = true; check flag before any non-essential processingOne month (extendable)
20Right to portabilitySame export as Article 15 but machine-readable (JSON preferred, CSV acceptable)One month (extendable)
21Right to objectOpt-out endpoint for each processing purpose; answer within one month (Art. 12(3))Immediate acknowledgment

The deadline in the rights table is a month, not 30 days

Article 12(3) GDPR gives you one month from receipt to answer a request under Articles 15 to 22. It can be extended by two further months for complex or numerous requests, as long as you tell the person within the first month. Build your queue around the calendar month, and log every extension with the date you told the requester. Source: Regulation (EU) 2016/679, Article 12.

Pre-ticked consent boxes have been settled law since 2019. In Planet49 (case C-673/17) the Court of Justice held that a checkbox ticked by default is not valid consent for storing cookies. Source: CJEU, C-673/17.

Implementation notes that regulators commonly flag:

  • Cascade deletes: Article 17 erasure must cover backups, logs, derived data, and third-party processors you have data-sharing agreements with. Deleting the user row is not enough.
  • Identity verification: before executing erasure or export, verify the requesting user is authenticated. Article 12(6) permits requesting confirmation of identity before acting.
  • Logging the request: keep an audit record that a request was received and fulfilled (timestamp, request type, outcome) - without retaining the personal data itself.
  • Third-party processors: your data subject rights apply to data held by processors on your behalf (email providers, analytics platforms, CRMs). Your contracts must require processors to respond to your erasure and export requests within your own one-month window.

Encryption and Breach Notification

GDPR Article 32 requires "appropriate technical measures." In practice:

  • In transit: TLS 1.2 minimum on all pages. HSTS header. No HTTP fallback for any path that touches personal data.
  • At rest: encrypt personal data fields in the database. Application-level encryption for sensitive categories (health, financial, biometric). Argon2 or bcrypt for password hashing - never MD5 or SHA-1.
  • Key management: encryption keys stored separately from the data they protect. AWS KMS, GCP KMS, or HashiCorp Vault. Rotate annually at minimum.

Breach notification: 72 hours to notify your supervisory authority after discovering a breach involving personal data. If the breach poses high risk to individuals, you must also notify affected users without undue delay. You cannot meet the 72-hour window without logging, alerting, and a tested incident response plan in place before the breach happens. The ICO breach reporting guidance has the most practical template.

Published statistics and differential privacy

If you publish aggregate numbers drawn from personal data, stripping the names out is not enough. Small groups can be re-identified by combining two tables. Differential privacy adds calibrated noise so that any one person's presence changes the output by a bounded amount, controlled by a parameter called epsilon. Public dashboards and research exports are where it earns its keep. A SaaS app that shows each customer only their own data rarely needs it, and should sort out consent, the rights endpoints and the 72-hour breach clock first.

Differential privacy adds Laplace noise scaled by epsilon to a true count before publishing, so individual records cannot be reconstructed from the output
Epsilon is the dial: lower means more noise and a stronger guarantee against re-identification.

Developer Checklist

  1. HTTPS everywhere with HSTS enabled
  2. Cookie consent with genuine opt-in - no tracking before consent event fires. The cookie analyzer checks security flags on the cookies your server sets. It doesn't classify them for consent.
  3. Consent timestamps and text version stored for audit purposes
  4. Privacy policy linked from every page, updated when data practices change
  5. Data export endpoint (JSON/CSV) for Article 15 access requests
  6. Account deletion endpoint that removes all personal data for Article 17
  7. Passwords hashed with Argon2 or bcrypt
  8. Encryption at rest for sensitive fields; keys in a dedicated KMS
  9. Security logging with breach detection alerts and documented incident response

Check your website right now

200+ security checks in 60 seconds. Free, no signup required.

Scan My Website (Free)

Claude AI helped me with phrasing and proofreading in this article.

Roy Morken

I build ismycodesafe.com, the scanner these guides are written around. I'm an indie security practitioner based in Norway, and I write about the checks the scanner runs and how to fix what they find. Questions or corrections: help@ismycodesafe.com.