Skip to content

feat: mask personal data in staff views and audit every reveal - #319

Merged
Yousefa7medmaher merged 1 commit into
devfrom
feat/pii-masking
Nov 27, 2026
Merged

Yousefa7medmaher merged 1 commit into
devfrom
feat/pii-masking

Conversation

@Yousefa7medmaher

Copy link
Copy Markdown
Member

Closes #317

What changes

Owner decision on Delivery-Plus0/delivery-plus-admin-app#3: staff see personal data masked by default, and every reveal is audited.

  • Masking: maskPhone and maskEmail in shared are the one format.
    • Phone: +201012345123 → +20 10•• ••• 123.
    • Email: mona.ali@example.com → m•••@example.com.
  • People directory (/api/admin/users): list, search and detail are masked. The address is withheld (hasAddress instead).
  • Restaurants (/api/admin/restaurants): rows and the staff application view mask the contact phone. The owner's own view keeps it.
  • Reveal routes (support.read), each recording one pii.reveal audit event (who saw which field of whom, never the value) before answering:
    • POST /api/admin/users/:id/reveal {field: phone|email|address, reason};
    • POST /api/admin/restaurants/:id/reveal {reason}.
  • Search: exact search still matches the full value; its results come back masked.
  • Docs: the roadmap records both decisions (this one and feat: undo a review decision within 10 seconds, as an audited action #318's Undo).

Acceptance criteria

  • No staff list or page returns an unmasked phone, email or address. Unit tests check the detail and search JSON for the raw values.
  • Each reveal writes exactly one audit event, and needs support.read. Tested, with a check that the staged event doesn't contain the value. The contract lists both routes under pii.reveal.

Checks

npm run verify passes; OpenAPI generate and validate pass (29 admin paths).


Generated by Claude Code

- Staff views mask phones (+20 10•• ••• 123) and emails (m•••@example.com) and withhold addresses (owner decision on admin#3).
- POST /admin/users/:id/reveal {field, reason} and POST /admin/restaurants/:id/reveal {reason} (support.read) return one value and record pii.reveal: who saw which field of whom, never the value.
- The owner's own restaurant view keeps its phone; exact search still matches the full value.

Co-authored-by: Yousef Ahmed Maher <ya1770620@gmail.com>
@Yousefa7medmaher
Yousefa7medmaher requested a review from a team as a code owner November 27, 2026 14:33
@Yousefa7medmaher
Yousefa7medmaher merged commit e07f2a4 into dev Nov 27, 2026
24 checks passed
@Yousefa7medmaher
Yousefa7medmaher deleted the feat/pii-masking branch November 27, 2026 14:40
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.

feat: audited reveal of masked personal data for staff

1 participant