Guardrails Filter Tackles Complex LLM Streaming and Tool Call Challenges to Protect Sensitive Data
Developers at Cloud.ru have shared the technical challenges encountered while building Guardrails Filter, a dedicated protection layer that prevents personal data from reaching large language models. The filter scans incoming JSON requests, locates phone numbers, email addresses, passport numbers, SNILS and names using regular expressions, and replaces them with stable placeholders such as <PHONE_1> or <PERSON_1>.
A simple substitution approach quickly proved inadequate. When two different phone numbers appear in the same conversation, replacing both with the generic token <PHONE> makes it impossible to restore the correct values after the model replies. The team therefore maintains an internal mapping table that guarantees the same real value always receives the same placeholder throughout the dialogue history.
Because LLMs are stateless between requests, Guardrails Filter must re-process the entire conversation history on every turn, rebuild the mapping table, mask the data, and then restore original values once the response arrives. With ordinary non-streaming JSON responses the task is manageable, yet streaming via SSE introduces far greater complexity.
In streaming mode, responses arrive in small chunks that may split a placeholder across multiple events. The filter therefore buffers several events until enough characters accumulate to determine whether a complete placeholder is present. Once a placeholder is identified, the original value is substituted and a new chunk is emitted to the client. This buffering adds a small latency but prevents broken placeholders from reaching users.
Tool calling adds another layer of difficulty. Model-generated function calls may contain masked values inside JSON arguments that themselves are serialized inside another JSON object. The filter must fully reconstruct each tool-call argument, validate that all braces are closed, and only then perform demasking. Failure to do so can produce invalid JSON that breaks downstream agent pipelines.
Support for the Anthropic Messages API required a completely separate implementation because its event format differs significantly from OpenAI’s Chat Completions streaming. The Messages API uses explicit lifecycle events for tool calls, while Chat Completions delivers deltas inside larger JSON objects. Separate code paths and approximately 1,000 additional lines of tests were written to handle both providers consistently.
In total, the streaming logic alone grew to roughly 1,500 lines of code, backed by more than 3,000 lines of tests. The engineering effort focused on correctly identifying the end of reasoning blocks, the completion of tool-call arguments, and the safe delivery of any remaining buffered data once the model signals the end of a response.
Related articles
CrowdStrike Joins Anthropic Critical Infrastructure Defense Program as Founding Partner
CrowdStrike has become a founding partner in Anthropic's critical infrastructure defense program, which applies artificial intelligence to protect energy, water, manufacturing, and transportation systems. The partnership was announced on October 8 and brings together 11 founding partners, including Nozomi Networks, Rockwell Automation, and Palo Alto Networks. The initiative combines access to Claude models, dedicated engineers, and threat research aimed at security providers and industrial equipment manufacturers. CrowdStrike contributes its Falcon platform, delivering security data, threat intelligence, and attacker behavior history through Falcon for XIoT, which unifies visibility across industrial and IT assets. The program builds on the existing integration of Claude within CrowdStrike's Charlotte AI assistant. Initial focus remains on identifying defensive methods that work safely and effectively in industrial settings without positioning AI as a complete solution.
Small and Medium Businesses Accelerate Cybersecurity Investments as AI-Powered Attacks Rise
Owners of small and medium enterprises have begun treating cybersecurity as a core business priority rather than an afterthought. The rise of artificial intelligence has made it easier to develop and launch web platforms, mobile applications, and digital services without large teams, but this expansion has also triggered a surge in automated AI-driven attacks and data leaks affecting companies of every size. The outdated assumption that smaller operations are too insignificant to target no longer holds, as AI-powered scans probe the internet for any available vulnerability around the clock. When breaches occur, consequences extend beyond technical damage to include LGPD fines, operational downtime, and lasting loss of customer trust built over years. In response, entrepreneurs are focusing investments on three main areas: web application firewalls, recurring AI-assisted pentesting, and autonomous security operations centers. Solutions from Cloudflare, HackerSec, and SentinelOne are frequently adopted because they offer robust protection without requiring dedicated in-house security staff. This shift marks a broader change in mindset, where security is now viewed as an essential component of sustainable growth rather than a cost to be deferred until after an incident.
Locally Downloaded AI Models and LoRA Adapters Can Steal Passwords, Keys and Funds
Security researcher working on distributed multimodal AI systems warns that locally run models and community-shared LoRA adapters cannot be trusted by default. The post highlights concrete risks of credential theft, private key extraction and financial loss that go beyond theoretical concerns. As the number of downloaded models, fine-tuned adapters and compute nodes grows, the attack surface expands significantly. Malicious or compromised components can silently exfiltrate sensitive data without obvious signs during normal operation. The author draws from personal experience and published research to illustrate these threats in practical scenarios involving local AI deployments.
Positive Technologies to Explore AI Attacks and Autonomous SOC Advances at PSD 2026
Positive Technologies will host Positive Security Day 2026 in Moscow on October 15-16, focusing on how artificial intelligence is reshaping cybersecurity. The event will highlight new product developments in MaxPatrol O2 and the company's push toward an autonomous SOC. Attendees will examine Security Lakehouse as a method for handling large volumes of security data to train models. Practical sessions will allow participants to attack AI technologies, investigate incidents, and disassemble products with engineers. The business program will address how organizations can automate security without creating new risks that require manual explanations after incidents. The conference takes place at the Mechta complex in Gorky Park and offers both in-person and online participation.