Project

stockade

0.0
No commit activity in last 3 years
No release in over 3 years
Stockade is a lexer that reads unstructured text information (from files, logs, databases etc.) and tokenizes pieces that look like personally identifiable information (PII).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0
~> 0.49

Runtime

 Project Readme

Test Coverage Gem

PII Detector

This is a proof-of-concept level software.

Stockade is a Personally Identifiable Information (PII) detector. It scans unstructured text (from files, logs, databases, web etc.) and masks all identified pieces of PII.

Installation

gem install stockade

Usage

require 'stockade'

puts Stockade.mask(<<-EOS

Dossier on Mr. John Smith born 09/02/1995
His email is jsmith@example.com and his phone is 555-123-4567.
He is using Visa card 4111 1111 1111 1111

EOS

#=>
Dossier on Mr. **** ***** born **********
His email is ****************** and his phone is ************.
** is using Visa card *******************

Notice, how word 'He' was incorrectly identified as a name.

Implementation

This is done in three stages.

Scanning

Using a manually curated list of regexes and StringScanner it extracts and labels lexeme candidates.

Evaluation

Lexeme candidates further evaluated (in some cases this is a no-op) to filter out false positives. For example, first and lastnames are checked against a database of known names. Dates are checked to be in the past.

Parsing

Some rudimentary parsing done. Lexemes that are fully covered by other lexemes are eliminated. Ambiguous lexemes are disambiguated using rules of precedence.