Skip to content

Write your own pattern

Purpose: no built-in pattern knows your staff numbers or your clients' project codes. A pattern of your own is a regular expression in a category; try it on sample text, then use it in a policy, and it's checked on every call like the 232 built in.

In the demo world, Grachtwerk's staff numbers look like GWS-12345. The pattern \bGWS-[0-9]{5}\b finds them, in the organisation's own category people_data, and the organisation watches for a month before blocking.

Before you start

  • You're an organisation admin.

Steps

  1. Open Policies › Guardrails and the Patterns tab.
  2. Choose New pattern.
  3. Give it a name ("Grachtwerk staff number"), a category, its Severity (Low, Medium, High or Critical) and the expression.
  4. Optionally:
  5. What it finds, in VidaiGuard's words (for example email or iban), so VidaiGuard for the same thing works beside it;
  6. a Check digit (Luhn for card numbers, mod 97 for IBANs, ABA for US routing numbers, Verhoeff for Aadhaar): a match whose check digit is wrong isn't a match.
  7. Try it on a sample. It decides with the check digit, as the gateway would.
  8. Save. Use … in a policy opens for it:
  9. choose the level and the Action (watch, mask, pseudonymise or block);
  10. optionally choose Part of a policy, or None: a rule of its own;
  11. Turn it on.

A new pattern tried on sample text before saving: what it matched, with its category and severity

Check it worked

On Patterns, your pattern says where it's on: its own rule, at which level, and Reach (how many keys carry it). On Rules at that level it has its own row, decided by a single-pattern rule, with its action. When it finds something, the call's findings in Request logs name your pattern.

Guardrails › Patterns: built-in and your own patterns, what each finds, how exact it is and where it's on

Your own categories

Under Categories, add your own (lower-case letters, digits and underscores). Rename… on one of yours changes its name everywhere it's used, and says what it rewrote ("Rewritten in 3 patterns, 2 rules and 1 packs"); past findings keep the old name.

Good to know

  • The gateway can't run look-arounds, back-references or atomic groups; write the expression without them.
  • A pattern too large to try is refused on the field: "This pattern is too large to try here (a repeat count over 1000, for example). Simplify it."
  • Built-in patterns are read-only, and say whether they're exact, broad (catch more than they should) or noisy (often match harmless text).
  • Built-in categories can't be renamed.
  • If adding a pattern to a policy fails, the rule is on as a rule of its own: Try adding it again, or Leave it on its own and add it later with Adopt existing parts… on the policy.