Skip to content

fix: anonymize entities nested in submission.entities[] - #3

Merged
anttiviljami merged 1 commit into
mainfrom
fix/submission-nested-entities
Oct 16, 2026
Merged

anttiviljami merged 1 commit into
mainfrom
fix/submission-nested-entities

Conversation

@anttiviljami

@anttiviljami anttiviljami commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Submissions nest the journey's entities (contact, opportunity, …) in entities[]. They have _schema but no _id/_org, so isEntityLike skipped them and only the email/IBAN/phone pattern scrub ran. Names, address, birthdate, salutation, payment holder and opportunity description leaked in plaintext.
  • anonymizeEntity now anonymizes submission.entities[] items schema-aware (new optional nestedSchema resolver, wired in anonymizeResponse). Single pass: pseudonyms equal those of a standalone contact (joinable, no double hashing); the walker no longer re-walks entities.
  • Name-based safety nets in DEFAULT_PII_FIELDS: *:address, *:payment, submission:contact_first_name/contact_last_name.
  • Payment items: fullname/first_name/last_name keys are pseudonymized as person (bank_name stays).

Not covered

  • Unclassified custom fields (e.g. opportunity meter_number) stay as is; classify via data_classification: 'pii' or overrides.
  • Release: bump + publish, then bump in entity-api (the consumer) to fix the live repro (submission 8f4a9a6b-47fa-45e5-aeb7-a43443b00c39, org 20000346).

Test plan

  • vitest run (31 tests, incl. no-schema / with-schema / direct anonymizeEntity / joinability), tsc --noEmit
  • Re-read the repro submission through an anonymized connection after entity-api picks this up

🤖 Generated with Claude Code

https://claude.ai/code/session_01QfZ2jL2NvqeyYkcaYJApir


Generated by Claude Code

Nested entities carry _schema but no _id/_org, so the response walker skipped
them and only the email/IBAN/phone pattern scrub ran: names, address, birthdate,
salutation and payment holder leaked. Anonymize them schema-aware inside the
parent submission (single pass, pseudonyms match standalone entities), add
name-based defaults for address/payment and person-name keys on payment items.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QfZ2jL2NvqeyYkcaYJApir
@anttiviljami
anttiviljami merged commit a670d31 into main Oct 16, 2026
5 checks passed
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