
4/1/2025 · Fernando Diaz
What this post added
This post details the technical implementation of custom PII detection rulesets for GitLab Secret Detection. It outlines the steps to configure `.gitlab-ci.yml` to include the Secret Detection template, create a custom TOML file (`rules/pii-data-extension.toml`) with regex patterns for PII (e.g., passport numbers, phone numbers, email addresses) and an allowlist, and extend the default configuration using `.gitlab/secret-detection-ruleset.toml`. It also demonstrates how to test these rules with a sample merge request and highlights the use of GitLab Duo Chat for generating regex patterns, providing specific prompts and expected outputs. Best practices for PII detection and integration with other GitLab security features like Secret Push Protection and Merge Request Approval Policies are also discussed.