Imagine you are tasked to use GLASS Studio to create a custom
GLASS data type that searches for 16-digit Mastercard
payment card numbers. But you are only interested in payment card numbers with
specific bank identification number (BIN) ranges that are issued by the
company EZ-Link Pte Ltd.
In this tutorial, you will go through the steps to build and test the payment
card number data type in Visual Builder mode. The
resulting GLASS expression can then be deployed as a
Custom Data Type in
Enterprise Recon.
Prerequisites
This tutorial assumes that you have:
A valid set of Ground Labs customer portal credentials to log in to
GLASS Studio.
Note: Please Submit A Ticket if you require
assistance regarding access to GLASS Studio.
In the start screen, select New Visual Builder
Project +.
Click on the Map icon in the GLASS Studio playground
to open the MAPS dialog and click on
.
In the New Map dialog:
Key in EZLINK_BIN_RANGES in the Map
Name field.
Tip: This label is the value that will be used when you
reference the MAP namespace in your
GLASS expressions.
In the field below, key in the following BIN ranges. Remember to press the
Enter key after typing each BIN range to add the keys to the namespace.
27145600-27145601
53497220
Click Save Map and then Close the MAPS dialog.
Part 2 - First Eight Digits of Payment Card Number
Next, we will build the first eight digits of the payment card number, which
should fall within the BIN ranges defined in Part 1.
Select Start with RANGE.
In the Select a keyword dropdown, select
Digit.
Check the Repeat Character/Octet option.
Select the first radio button and key in
8 in the Times field.
In the Add Pattern Rules pane, click on Require.
Select the checkbox next to
EZLINK_BIN_RANGES.
Click Close.
Part 3 - Last Eight Digits of Payment Card Number
In Part 3, you will add the second component that defines the last eight digits
of the straight 16-digit payment card number.
Hover over and click on the + button at the top right corner of the
first RANGE component.
Select RANGE.
In the Select a keyword dropdown, select
Digit.
Check the Repeat Character/Octet option.
Select the first radio button and key in
8 in the Times field.
Click Close.
Part 4 - Luhn Checksum Algorithm
In Part 4, you will add the Luhn checksum algorithm to validate the payment
card number so that only 16-digit strings that pass the checksum will be
reported as a match.
Left click anywhere in the GROUP component.
(Optional) In the Group Name field, key in
EZLINK_PAYMENT_CARD_STRAIGHT.
In the Add Pattern Rules pane of the group form, click on Check.
Select the LUHNCHKSUM algorithm from the
list of built-in check modules.
Part 5 - Boundary Rules
In Part 5, you will be adding boundary rules for the whole expression.
Using the BOUND operator, you can reduce the
number of potential false positive matches by only reporting payment card number
matches if they are only preceded by non-digits, and followed immediately by
non-alphanumberic characters.
In the Add Pattern Rules pane of the group form, click on Bound.
For the Left option, in the Select a keyword dropdown, select
Non-Digit.
For the Right option, in the Select a keyword dropdown, select
Non-Alnum.
Click Close.
Part 6 - Defining Context Keywords and Rules
Now that we have built out the base pattern and rules for the payment card
numbers, we will add context rules so that the GLASS
engine only returns matches if specific keywords are found within the vicinity
of these numbers.
Click on the Context icon in the GLASS Studio
playground to open the CONTEXT dialog.
(Optional) In the CONTEXT dialog, hover over the Name field and click
on the Edit icon.
Key in EZLINK_PAYMENT_CARD_CONTEXT and
click Save.
Click on to add a
context rule.
In the Rule Details page, select Require and Before.
Click on Next to continue.
In the Add Map 1 of 2 page:
Key in
EZLINK_PAYMENT_CARD_CONTEXT_KEYWORDS in the
Map Name field.
In the field below, key in the following context keywords. Remember to press
the Enter key after typing each value to add the keys to the namespace.
'EZ Link'
'EZ-Link'
'card number'
Check the No Case option.
Click Save Map.
In the Add Map 2 of 2 page, check that the radio button next to
EZLINK_PAYMENT_CARD_CONTEXT_KEYWORDS is
selected.
Click on Next to continue.
(Optional) In the Advanced page, key in
32 in the Search distance field.
Click on Next to continue.
In the Confirm page, review the configured context rule. Click on
Confirm to save the context rules.
Click Close.
🎉 Congratulations! You have now fulfilled all the data type requirements and
built a working data type that will match 16-digit straight numbers that start
with specific BIN ranges and are validated as payment card numbers using the
Luhn checksum algorithm.
Part 7 - Testing the Pattern for 16-digit Payment Card Numbers
1
2
3
4
5
EZ Link:2714560022446682 <random filler text to add ~32 bytes gap>
card number is 2714560133557799 <random filler text to add ~32 bytes gap>
5349722063748592
Copy the sample data provided above and paste it in the Enter test data:
pane.
Click Test.
You should expect to see the results indicating 2 MATCHES FOUND for the
payment card number 2714560022446682 and 2714560133557799.
5349722063748592 on line 5 will not match as no required context keywords (as
defined in Part 6) are found within 32 bytes before the payment card number.
Part 8 - Using the Custom Pattern in Enterprise Recon
Now that you have tested the data type, click on the
Copy to clipboard
button to copy the (generated) GLASS code, which can now
be deployed as a Custom Data Type in
Enterprise Recon.