Skip to content

fix(compliance): stop false redisCache deletion audit + drop full-event PII log - #247

Open
pallakartheekreddy wants to merge 1 commit into
masterfrom
security/honest-deletion-audit-and-pii-log
Open

fix(compliance): stop false redisCache deletion audit + drop full-event PII log#247
pallakartheekreddy wants to merge 1 commit into
masterfrom
security/honest-deletion-audit-and-pii-log

Conversation

@pallakartheekreddy

Copy link
Copy Markdown
Contributor

Summary

Safe, self-contained slice of the D1 (CRITICAL/compliance) and D3 (PII-in-logs) findings in implementation-designs/data-pipeline.md, in UserDeletionCleanupFunction.

The bug (false compliance audit)

The deletion audit map seeded redisCache -> false, then set redisCache -> true unconditionally right after dataCache.del(key). But DataCache.del is a no-op that only logs when redis.enabled=false — and that's the default (BaseJobConfig.scala:28). So the emitted AUDIT telemetry claimed the user's Redis cache was purged when it was not — a false Right-to-Erasure (DPDP/GDPR Art.17) compliance trail.

Separately, logger.info(s"${event}") dumped the entire deletion event (userId + other PII) to logs at INFO.

The fix

  • redisCache -> config.redisEnabled — the flag is true only when Redis is actually enabled (i.e. the del could run), so the audit is truthful.
  • Removed the full-event PII log line.

Two-line behavioral change, no new stores/wiring, fully reversible.

Verification

  • jobs-core + user-deletion-cleanup compile (main + test Scala) under JDK 11 (mvn -pl user-org-jobs/user-deletion-cleanup -am test-compile → BUILD SUCCESS).

Scope / deferred

The full D1 purge — ES user index, user_consent / user_declarations / user_feed / cert-registry deletes, per-store verify-then-flag, ML-PII delegation — plus the jobs-core DataCache.del UnitLong verification are intentionally not here: they need net-new store wiring, DBA delete grants, are irreversible, and per the design must ship behind per-store feature flags with non-prod validation and DB backups. This PR makes the audit honest now; the expanded purge is coordinated L-effort work.

…nt PII log

UserDeletionCleanupFunction seeded the deletion audit with redisCache:false then
unconditionally set redisCache -> true right after dataCache.del(key). DataCache.del
is a no-op that only logs when redis.enabled=false (the default, BaseJobConfig:28),
so the emitted AUDIT telemetry claimed the user's Redis cache was purged when it was
not -- a false Right-to-Erasure compliance trail.

- Set redisCache from config.redisEnabled so the audit reflects whether the cache
  delete could actually run (true only when Redis is enabled).
- Remove `logger.info(s"${event}")` which dumped the entire deletion event
  (userId and other PII) to logs at INFO.

Scoped, safe slice of D1/D3. The full D1 purge (ES user index, user_consent /
user_declarations / user_feed / cert-registry deletes, per-store verify-then-flag,
ML-PII delegation) plus the DataCache.del Unit->Long verification are deferred: they
need new store wiring, DBA delete grants, are irreversible, and per the design must
ship behind per-store feature flags with non-prod validation and DB backups.

Verified: jobs-core + user-deletion-cleanup compile (main + test Scala) under JDK 11.

Implements the safe portion of D1/D3 from implementation-designs/data-pipeline.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant