The alert hit your logs at 02:14. Sensitive data slipped through, hidden in an API request. Names, emails, maybe worse. Your Keycloak instance didn’t catch it.
PII detection in Keycloak is not built-in. Out of the box, Keycloak handles authentication, authorization, and identity federation. It does not scan requests or tokens for personally identifiable information. If PII ends up in attributes, usernames, or custom fields, it will sit there until someone pulls it out — or until it leaks.
To protect user data, you need a detection layer around Keycloak. This means inspecting data at ingress and egress: when users sign up, when tokens are minted, and when APIs receive protected calls. For access tokens and ID tokens, interceptors can check claims for email addresses, phone numbers, or any string matching PII patterns. Integrating this with Keycloak’s SPI (Service Provider Interface) lets you hook into authentication flows without modifying core code.