Answer a privacy request
Export everything that LumoAuth holds about one person, erase a person, and keep the records that GDPR asks for.
What it shows
- A person downloads a copy of their data from the account pages, and asks for the deletion of their account.
- The request waits on the portal page Subject requests, with the identity check already on record.
- You execute the erasure. LumoAuth anonymizes the account, ends its sessions and tokens, and removes the name and the address from the audit log.
- The records that GDPR asks you to keep stay: the completed request, the audit log entries, the consent record and your record of processing activities.
- A script reads the account and the audit log through the Admin API, before and after, to show what is left.
The request itself has no API: the person files it in the account pages, and you answer it in the portal.
Before you start
- The permission
gdpr.managein the portal. The Tenant Admin role holds it. - An API key with the scopes
admin:users:readandadmin:audit:read, for the script. Create it in the portal under Applications & developer tools, API keys. The setup script also needsadmin:users:write. - A test person. Never try this on a real account: an erasure cannot be undone. The setup script creates
privacy-user@example.com, "Sam Taylor", with the password that you put inPRIVACY_USER_PASSWORD.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_API_KEY | An API key with the scopes admin:users:read and admin:audit:read. The setup script also needs admin:users:write. |
PRIVACY_USER_PASSWORD | For the setup script only: the password that you choose for the test person. |
PRIVACY_USER_ID | The ID of the test person. The setup script prints it. |
PRIVACY_USER_EMAIL | Optional. The email address to look for. Default: privacy-user@example.com. |
PRIVACY_USER_NAME | Optional. The name to look for. Default: Sam Taylor. |
The setup script creates the test person privacy-user@example.com with the password in PRIVACY_USER_PASSWORD. The recipe erases this person, so run the script again for each new try.
node operations/privacy-requests/setup.mjs
setup.mjs
// Creates the test person of the recipe, Sam Taylor, with a password that
// you choose. The recipe erases this person at the end, so run the script
// again for each new try.
//
// PRIVACY_USER_PASSWORD='…' node operations/privacy-requests/setup.mjs
//
// The API key needs the scope admin:users:write.
import { ensure, org, printEnv, url } from '../../_lib/admin.mjs';
const password = process.env.PRIVACY_USER_PASSWORD;
if (!password) {
console.error('Set PRIVACY_USER_PASSWORD to the password that the test person signs in with.');
process.exit(1);
}
const user = await ensure('/admin/users', (u) => u.email === 'privacy-user@example.com', {
email: 'privacy-user@example.com',
name: 'Sam Taylor',
password,
emailVerified: true,
});
console.log(`User ${user.email} is ready.`);
console.log(`Sign in as this person at ${url}/orgs/${org}/login`);
printEnv({ PRIVACY_USER_ID: user.id });
The person makes the request
Use a private browser window, so that the portal session of your own account stays separate.
- Open
https://app.lumoauth.dev/account/privacy(or the same path onhttps://eu.app.lumoauth.dev). Sign in asprivacy-user@example.com. The page Privacy & data opens. - Under Communication & data use, turn on Product updates and click Save preferences. This gives the person a consent record.
- Click Download your data, then Download JSON. The file holds the profile, the sign-in methods and sessions, the consent choices, the roles and groups, and the recent activity of the account. The download needs a sign-in in the last 10 minutes, or a fresh second factor.
- Go back to Privacy & data. Under Restrict or delete, click Request deletion. The page Privacy requests opens with Delete my data (Art. 17) chosen.
- Enter a note under Details (optional) and click Send request. The request is under Your requests with the status Received.
You answer it in the portal
- Run the script of this recipe once. It prints the address of the account, and every audit log entry holds the address or the name.
- Open Subject requests in the portal. The request of
privacy-user@example.comhas the type Right to Erasure (Art. 17) and the status Pending. Click the address. - Under Identity verification, the line Signed-in account: Verified shows that the person filed the request while signed in. Without such a line, use Send email challenge or Record manual verification first.
- Under Execute erasure (Art. 17), click Execute erasure, then Confirm. The portal shows "User data has been erased". The request is now Completed, and the list shows
[erased]in place of the address. - Open the tab Consents. The consent of step 2 is still listed, with the user ID only.
- Open the tab Records of processing and click Export RoPA (JSON). The file is your record of processing activities under Art. 30, with the activities that you registered.
These steps were followed on a LumoAuth organization. The output is the run after the erasure, with the default erasure type, Anonymize.
Code
The script reads the account, and the audit log entries in which the person is the actor or the target. Run it before and after the erasure.
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization. The output is the run after the erasure, with the default erasure type, Anonymize.
- curl
#!/bin/sh
# Check what LumoAuth still holds about a person: the account, and the audit
# log entries by and about the person. Run it before and after the erasure.
#
# sh operations/privacy-requests/http/check.sh
#
# The script needs curl and jq.
set -eu
API="$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/api/v1"
EMAIL="${PRIVACY_USER_EMAIL:-privacy-user@example.com}"
NAME="${PRIVACY_USER_NAME:-Sam Taylor}"
# 1. The account. An erasure that anonymizes keeps the record under a new
# address and name. A hard delete removes it, and the API answers 404.
ACCOUNT=$(curl --silent --write-out '\n%{http_code}' \
"$API/admin/users/$PRIVACY_USER_ID" --header "X-API-Key: $LUMOAUTH_API_KEY")
if [ "$(printf '%s\n' "$ACCOUNT" | tail -n 1)" = 200 ]; then
printf '%s\n' "$ACCOUNT" | sed '$d' | jq -r '.data | "account: \(.email) (\(.name)), active: \(.isActive)"'
else
echo "account: HTTP $(printf '%s\n' "$ACCOUNT" | tail -n 1)"
fi
# 2. The audit log entries in which the person is the actor or the target.
# The erasure keeps them, and removes the email address and the name.
logs() {
curl --silent --show-error --fail "$API/admin/audit-logs?$1=$PRIVACY_USER_ID&limit=100" \
--header "X-API-Key: $LUMOAUTH_API_KEY"
}
ENTRIES=$( (logs actorId; logs targetId) | jq -s '[.[].data[]] | unique_by(.id)')
echo "audit log entries of the person: $(printf '%s\n' "$ENTRIES" | jq 'length')"
printf '%s\n' "$ENTRIES" | jq -r '.[] | " \(.eventType) actor=\(.actorName // "-") target=\(.targetName // "-")"'
echo "entries that hold the email address or the name: $(printf '%s\n' "$ENTRIES" | jq --arg email "$EMAIL" --arg name "$NAME" \
'[.[] | tostring | select(contains($email) or contains($name))] | length')"
sh operations/privacy-requests/http/check.sh
Check the result
account: anonymized_47aa790734cf61d2@deleted.invalid (Deleted User), active: false
audit log entries of the person: 11
user.created actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
user.login actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
user.updated actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
gdpr.consent.granted actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=-
data.exported actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
gdpr.dsr.created actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=-
gdpr.dsr.identity_verified actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=-
user.updated actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
session.revoked_all actor=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030 target=-
user.access_revoked actor=Offboarding target=erased:4bbbc3bea917f89f95eab9303b773bcbf59eb030
gdpr.erasure.completed actor=Avery Stone target=-
entries that hold the email address or the name: 0
- Before the erasure, the script printed
account: privacy-user@example.com (Sam Taylor), active: true, and every entry held the address or the name. - After it, the account record has a new address at
deleted.invalidand the name "Deleted User", and it is not active. The person can no longer sign in. - The audit log keeps every entry. The names of the person are replaced by
erased:and a hash, and the last entry,gdpr.erasure.completed, names the administrator who executed it. - To remove the account record as well, set Default erasure type to Hard delete under Settings, Self-service. The script then prints
account: HTTP 404.
Limits
- No API creates, answers or exports a privacy request. The person uses the account pages, and you use the portal.
- An administrator cannot download the copy for the person. With Self-service data export on (the default), the person downloads it. With it off, the person makes the request Get a copy of my data (Art. 15), and you answer it with Mark completed.
- When a person asks by email or by phone, open the request yourself: open the person under Users, then Start erasure request under Privacy & data. Nothing is erased until you execute the request.
- A completed request is final. You can still add notes to it.
- Registering and editing processing activities, impact assessments and breach records needs the full GDPR suite. Check that your plan includes it in the plans matrix. Subject requests and consent records are on every plan.