opyeb sqlmask

Six PII patterns — what is found and where it goes wrong

2026-11-29 · 2 min read

Detection starts with six value shapes and finishes with validation and column names.

The short answer

Find by shape first, filter with Luhn and checksums, then fill the gaps with column names. Changing that order increases false positives.

The six shapes

The types sqlmask looks for by default, and the point people most often get wrong about each.

Default detection types
TypeExampleCheckCommon false positive
Emailuser01@example.invaliddot in the domainpart of a file name
Phone010-0000-0001, +82 10-0000-00019–11 digits domestic, 8–15 internationaldates, version numbers
Card4111-1111-1111-1111Luhn (optional)order numbers, 16-digit IDs
Resident no.000000-300000013-digit checksum (optional)part of an account number
IPv4192.168.0.1octets 0–255version string 1.2.3.4
IPv62001:db8::1group count and shapetime 12:34:56

When to keep validation on

Luhn for cards and the checksum for Korean resident numbers remove most false positives. They also drop genuine values that fail the check.

If a column really holds customer cards, turning validation off and relying on a column-name rule is safer. Both rules work together: when the shape is not recognised, a column named card_no is still masked as a card.

How column names fill the gaps

Names such as email, phone, rrn, card_no, ip_addr, full_name and address declare the type. A short or malformed value is still handled as that type.

An email column containing only ‘unknown’ is masked to its first and last character rather than an email shape. The basis column in the comparison table shows which rule fired.

Shapes that are easy to miss

Detection is weakest here. If your data uses these forms, add a custom regex.

Try it

Paste this statement into the workbench to see the types split apart.

INSERT INTO members (id, email, phone, rrn, last_ip)
VALUES (1, 'user01@example.invalid', '010-0000-0001', '000000-3000000', '192.168.0.9');

Questions

What changes if I turn card validation off?

Every 13–19 digit number is treated as a card, so long order numbers are masked too.

Are column-name rules enough on their own?

They are strong when the name is exact, but not when it is user_ref or data1. Combine them with patterns.

Can IPv6 be confused with a time?

A time such as 12:34:56 has only two colons and is rejected. An IPv6 candidate needs at least two colons with a valid group count and shape.

Sources

Every example here can be pasted into the workbench as it is.

Open the workbench