# Data Subject Requests (DSR/DSAR) Policy

**Document Version**: 1.0  
**Last Updated**: 2025-10-03  
**Owners**: Privacy Office & Identity Engineering

This policy formalises the workflows that fulfil GDPR/CCPA data-subject rights
across the Auth service.

## Supported Rights

- **Access (DSAR)** – export profile, consent history, sessions, and
  personalization artifacts in JSON or CSV.
- **Deletion (Right to be forgotten)** – schedule, cancel, and execute account
  erasure with audit tracking.
- **Portability** – exports provide machine-readable formats suitable for
  portability requests.
- **Rectification/Preference Updates** – handled via profile & consent endpoints
  (see `docs/security/PERSONALIZATION_PRIVACY.md`).

## Export Workflow

1. `POST /v1/users/:id/data-export` triggers immediate export (JSON default, CSV
   optional) with category filters.
2. Audit entries capture requester, categories, and format.
3. `GET /v1/users/:id/data-export-history` exposes immutable export trail.

Export payload guarantees:

- Pseudonymised identifiers (`email_hash`).
- Consent history (type, version, granted).
- Session metadata without bearer tokens.

## Deletion Workflow

1. User submits `POST /v1/users/:id/data-deletion` with `confirmation_token`
   (`I_CONFIRM_DELETION`).
2. Requests default to a 30-day grace period unless `immediate: true` is
   supplied.
3. `GET /v1/users/:id/data-deletion-history` serves an auditable log.
4. Deletions can be `cancelled` prior to execution.
5. `POST /v1/users/:id/data-deletion/:deletionId/execute` performs erasure:
   profile, sessions, refresh tokens, consents, personalization vectors, and
   budgets.

## Data Mapping & Discovery

- `GET /v1/users/:id/data-map` enumerates data categories, locations, retention,
  legal bases, and processing purposes.
- Optional `include_processing=true` lists current processing activities.

## Compliance Endpoints

- `GET /v1/privacy/compliance-status` summarises GDPR/CCPA status, supported
  rights, and next audit windows.
- `GET /v1/privacy/retention-policies` returns category-specific retention
  periods, deletion methods, and legal bases.

## Audit & Monitoring

All DSR operations append to the auth audit log (`user.data_export.*`,
`user.data_deletion.*`). Metrics feed the privacy reporting dashboard and can be
consumed programmatically from `/metrics`.

## References

- Implementation: `services/auth/src/dsr.ts`
- Automated coverage: `tests/auth.dsr-dsar.spec.ts`
- Personalization privacy controls: `docs/security/PERSONALIZATION_PRIVACY.md`
