Mask Signer Emails and Phone Numbers in Log Lines
Last updated: November 29, 2026
Quick Overview
Write a function that takes a log line and masks email addresses (keep the first character of the local part and the domain) and phone numbers with at least 10 digits (keep the last 4 digits and the original formatting).
DocuSign
November 29, 20260
0
0 solved
Write a function that takes a log line and masks email addresses (keep the first character of the local part and the domain) and phone numbers with at least 10 digits (keep the last 4 digits and the original formatting).
DocuSign handles personal data for signers in regulated industries, so keeping PII out of application logs is a real engineering concern. This screen checks practical string handling, regex judgment, and whether you avoid masking things that only look like phone numbers, such as envelope ids.
What the Interviewer Expects
- Define precisely what counts as an email and a phone number before coding
- Preserve formatting characters so masked logs remain readable
- Avoid false positives on short numeric ids
- Keep the function pure and easy to unit test
- Discuss where masking should live (logger formatter, not every call site)
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you handle names and street addresses, which regex cannot reliably find?
- What is the performance cost if this runs on every log line at high volume?
- Should masking be reversible for support staff? What are the risks?
- How would you prevent new PII fields from reaching logs in the first place?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Emails: [email protected] becomes j***@acme.com. Phones: sequences of digits with optional +, spaces, dots, dashes and parentheses, containing at least 10 digits; replace every digit except the ...
High-Level Design
Two compiled regexes, applied emails first so the phone pass never sees digits inside an email. The email regex captures the first local-part character and the domain. The phone regex is deliberately ...