Spring AI Privacy Guardrails adds PII tokenization and tool authorization
·2026.10.27 09:45
Key point
The library tokenizes PII before model calls and restores it only for authorized tools, supporting Spring AI 2.0.0 and Spring Boot 4.0.0.
Details
- Open-source library
spring-ai-privacy-guardrailsprovides privacy, tool authorization, and content inspection for Spring AI applications. - PII is tokenized before reaching the LLM and restored only for tools explicitly authorized for the user's role.
- Content inspection uses rules, local ONNX, or HTTP guard models to block prompt injection and toxic language.
- Requires Java 17, Spring AI 2.0.0, Spring Boot 4.0.0, and Spring Security 7.0.0.
Integration and Configuration
- Available on Maven Central as
io.github.ultramancode:spring-ai-privacy-guardrails-chat-client-spring-boot-starter(version 0.4.0). - Features are enabled via
GuardrailsPolicywith options for.privacy(),.toolAuthorization(true), and.inspection(). - Supports custom PII rules and analyzers like Presidio and OpenNLP.
Security and Inspection
ToolDisclosurePolicymaps specific tools to allowed PII types, whileAuthorizationManagerchecks user roles like ADMIN.- Non-ADMIN users have restricted tools removed from the model's list, preventing execution and PII restoration.
- Tool results are re-tokenized and re-inspected before returning to the model, with
BLOCKdecisions stopping further calls.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.