<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: aryan p</title>
    <description>The latest articles on DEV Community by aryan p (@aryan_p_4bf9bcacc75ae7f4f).</description>
    <link>https://dev.to/aryan_p_4bf9bcacc75ae7f4f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4047254%2F21f3ba0c-92fe-4ddb-b401-943b46cbd36f.png</url>
      <title>DEV Community: aryan p</title>
      <link>https://dev.to/aryan_p_4bf9bcacc75ae7f4f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aryan_p_4bf9bcacc75ae7f4f"/>
    <language>en</language>
    <item>
      <title>CacheGuard</title>
      <dc:creator>aryan p</dc:creator>
      <pubDate>Sat, 25 Jul 2026 20:10:46 +0000</pubDate>
      <link>https://dev.to/aryan_p_4bf9bcacc75ae7f4f/cacheguard-4e41</link>
      <guid>https://dev.to/aryan_p_4bf9bcacc75ae7f4f/cacheguard-4e41</guid>
      <description>&lt;h1&gt;
  
  
  How I Built CacheGuard: Securing GenAI Prompt Caches from Timing Side-Channel Attacks with SigNoz
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Prompt caching is one of the most impactful optimizations in modern GenAI infrastructure. Services like vLLM, OpenAI's prompt caching, and Anthropic's cached prefixes can reduce Time-To-First-Token (TTFT) by up to 85% and slash API costs dramatically. But there's a dark side that nobody talks about:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if an attacker could use those speed improvements against you?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the problem I set out to solve with &lt;strong&gt;CacheGuard&lt;/strong&gt; — an observability and active defense middleware that detects and neutralizes timing side-channel attacks on LLM prompt caches, built on top of &lt;strong&gt;SigNoz&lt;/strong&gt; for real-time threat visualization.&lt;/p&gt;

&lt;p&gt;In this blog, I'll walk you through the security vulnerability, how CacheGuard defends against it, and how SigNoz became the backbone of the entire observability pipeline.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Timing Side-Channel Attacks on LLM Caches
&lt;/h2&gt;

&lt;p&gt;When an LLM prompt cache is active, there's a measurable difference in response times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cache HIT&lt;/strong&gt;: ~20ms (the response was already computed and stored)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache MISS&lt;/strong&gt;: ~200ms+ (the LLM has to generate the response from scratch)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This timing gap is the vulnerability. An attacker doesn't need to see the cached data directly. They just need to &lt;strong&gt;measure how fast the server responds&lt;/strong&gt;. If a response comes back suspiciously fast, they know that exact prompt (or a very similar one) was recently asked by another user — potentially leaking sensitive business data, proprietary prompts, or private conversations.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;Timing Side-Channel Attack&lt;/strong&gt;, and it's a well-documented class of vulnerability in computer security (similar to CPU cache attacks like Spectre and Meltdown, but applied to AI infrastructure).&lt;/p&gt;

&lt;h3&gt;
  
  
  Why This Matters for Enterprises
&lt;/h3&gt;

&lt;p&gt;Imagine a multi-tenant AI platform where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Company A asks: &lt;em&gt;"Summarize our Q4 merger strategy with Acme Corp"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;An attacker from Company B sends the same prompt and gets a 20ms response&lt;/li&gt;
&lt;li&gt;The attacker now knows Company A is planning a merger with Acme Corp — &lt;strong&gt;without ever seeing the actual response&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a real, exploitable vulnerability in any shared LLM caching layer.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: CacheGuard
&lt;/h2&gt;

&lt;p&gt;CacheGuard is a Python middleware that sits between your application and the LLM API. It works in two phases:&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 1: Threat Detection &amp;amp; Observability
&lt;/h3&gt;

&lt;p&gt;CacheGuard intercepts every LLM request using a monkey-patched &lt;code&gt;httpx.post&lt;/code&gt; method. For each request, it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Measures TTFT&lt;/strong&gt; (Time-To-First-Token) to determine if it was a cache hit or miss&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculates a Risk Score&lt;/strong&gt; using statistical analysis of the timing distribution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs a Kolmogorov-Smirnov (KS) Test&lt;/strong&gt; to detect bimodal timing distributions (a telltale sign of systematic cache probing)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tracks Prefix Entropy&lt;/strong&gt; using a trie data structure to detect brute-force enumeration attacks (when entropy drops, it means someone is systematically guessing cached prefixes)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All of this data is emitted as &lt;strong&gt;OpenTelemetry spans and metrics&lt;/strong&gt;, which flow directly into SigNoz for visualization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Phase 2: Active Defense
&lt;/h3&gt;

&lt;p&gt;When CacheGuard detects an attack, it doesn't just alert — it &lt;strong&gt;fights back&lt;/strong&gt; autonomously:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Adaptive Jitter&lt;/strong&gt;: Injects random delays (50-500ms) into responses to mask the timing difference between cache hits and misses. The attacker can no longer distinguish fast (cached) from slow (uncached) responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache Bypass&lt;/strong&gt;: Forces the LLM to regenerate the response from scratch, even if it's cached. This eliminates the timing signal entirely for suspicious requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tenant Isolation&lt;/strong&gt;: Quarantines the attacker's session completely, assigning them a unique cache salt so they can never access another tenant's cached data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The defense mode escalates progressively: &lt;code&gt;monitor → jitter → bypass → isolate&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  How I Used SigNoz
&lt;/h2&gt;

&lt;p&gt;SigNoz was the perfect choice for this project because CacheGuard generates three types of telemetry — &lt;strong&gt;traces, metrics, and logs&lt;/strong&gt; — and SigNoz handles all three natively through OpenTelemetry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up the Stack
&lt;/h3&gt;

&lt;p&gt;The entire infrastructure runs locally via Docker Compose. SigNoz provides the collector (OTLP endpoint on port 24317/24318), the ClickHouse database for storage, and the web UI for visualization on port 8090.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# From our casting.yaml - Foundry deployment config&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1alpha1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Installation&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cacheguard&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;flavor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;compose&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  OpenTelemetry Instrumentation
&lt;/h3&gt;

&lt;p&gt;CacheGuard uses the OpenTelemetry Python SDK to emit rich, structured telemetry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;opentelemetry&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metrics&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;opentelemetry.sdk.trace.export&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BatchSpanProcessor&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;opentelemetry.exporter.otlp.proto.grpc.trace_exporter&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OTLPSpanExporter&lt;/span&gt;

&lt;span class="c1"&gt;# Every LLM call becomes a span with security metadata
&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;tracer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start_as_current_span&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cacheguard.llm.call&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cacheguard.side_channel.risk_score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;risk_score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cacheguard.defense.mode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defense_action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cacheguard.defense.jitter_ms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defense_action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;jitter_ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_attribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gen_ai.prompt_cache.hit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_cache_hit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each span carries over 15 custom attributes that capture the full security context of every single LLM request. This makes SigNoz's trace explorer incredibly powerful for debugging — you can click on any individual request and see exactly why it was flagged, what defense was applied, and how the risk score was calculated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building the Dashboard
&lt;/h3&gt;

&lt;p&gt;I built 3 core dashboard panels in SigNoz using raw ClickHouse SQL queries against the trace data:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Security SLO (Compliance %)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This panel shows what percentage of traffic is "safe" (risk score below 0.75). During normal operations, this sits at 95-100%. When an attacker starts probing, you can watch it drop in real-time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;countIf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attributes_number&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cacheguard.side_channel.risk_score'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="k"&gt;count&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;signoz_traces&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;distributed_signoz_index_v3&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;serviceName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'demo-runner-client'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Prompt Cache Hit Rate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This time-series chart visualizes the cache performance over time, proving the value of caching while simultaneously showing when the defense middleware forces cache bypasses during an attack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;toStartOfInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;MINUTE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;countIf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attributes_bool&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'gen_ai.prompt_cache.hit'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="k"&gt;count&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;signoz_traces&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;distributed_signoz_index_v3&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;serviceName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'demo-runner-client'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Active Defense Actions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most visually dramatic panel — it shows the exact moments when CacheGuard autonomously detected an attacker and deployed countermeasures. You can see the jitter injections spike during an attack and tenant isolations activate when the threat is severe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;toStartOfInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;MINUTE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;countIf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attributes_string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'cacheguard.defense.mode'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'jitter'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;signoz_traces&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;distributed_signoz_index_v3&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;serviceName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'demo-runner-client'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why SigNoz Was the Right Choice
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Native OpenTelemetry Support&lt;/strong&gt;: SigNoz speaks OTLP natively. I didn't need any adapters, translators, or proprietary SDKs. The standard OpenTelemetry Python SDK sends data directly to SigNoz's collector.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ClickHouse Backend&lt;/strong&gt;: The ability to write raw ClickHouse SQL queries against the trace data was a game-changer. Instead of being limited to pre-built metric types, I could calculate complex security analytics (like the KS test anomaly count) directly from span attributes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unified Traces + Metrics + Logs&lt;/strong&gt;: Security observability requires correlating across all three signals. When a log says "Timing Side-Channel Risk Detected", I need to click through to the exact trace that triggered it and see the associated metrics. SigNoz handles this correlation natively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Self-Hosted &amp;amp; Open Source&lt;/strong&gt;: For a security-focused project, sending sensitive telemetry data to a third-party SaaS platform would be ironic. SigNoz runs entirely within our Docker Compose stack, keeping all data local.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Demo: Watching an Attack in Real-Time
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;demo_runner.py&lt;/code&gt; script simulates a complete attack scenario in 4 acts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Act 1 - Normal Traffic&lt;/strong&gt;: Legitimate users make a mix of cached and uncached requests. The Security SLO stays at ~95%.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Act 2 - Heavy Cache Usage&lt;/strong&gt;: A performance-focused user hammers the cache, demonstrating the cost savings and hit rate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Act 3 - Attacker Probing&lt;/strong&gt;: An attacker begins systematically probing the cache. CacheGuard detects the bimodal timing distribution via the KS test and begins injecting jitter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Act 4 - Full Defense&lt;/strong&gt;: The attacker continues, but now every response is jittered, bypassed, or isolated. The attacker sees only noise — the side-channel is completely neutralized.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On the SigNoz dashboard, you can watch this story unfold in real-time: the Security SLO dips, the Active Defense counters spike, and the system autonomously recovers — all without human intervention.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LLM prompt caching introduces real security vulnerabilities&lt;/strong&gt; that the industry hasn't fully addressed yet. Timing side-channels are not theoretical — they're exploitable today.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observability is the foundation of security.&lt;/strong&gt; You can't defend against what you can't see. By instrumenting every LLM call with OpenTelemetry and visualizing it in SigNoz, CacheGuard turns invisible timing patterns into actionable threat intelligence.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Active defense beats passive alerting.&lt;/strong&gt; Instead of just sending a Slack notification when an attack is detected, CacheGuard autonomously injects noise, bypasses the cache, and isolates the attacker — all in milliseconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SigNoz + OpenTelemetry is a powerful combination&lt;/strong&gt; for building custom observability solutions. The ability to query raw trace data with ClickHouse SQL gives you unlimited flexibility to build domain-specific dashboards.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try It Yourself
&lt;/h2&gt;

&lt;p&gt;The entire project is open source and can be deployed locally in minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/aryanpenny/CacheGuard.git
&lt;span class="nb"&gt;cd &lt;/span&gt;CacheGuard
docker compose &lt;span class="nt"&gt;-f&lt;/span&gt; pours/deployment/compose.yaml up &lt;span class="nt"&gt;-d&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
python mock_llm.py &amp;amp;
python demo_runner.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open &lt;code&gt;http://localhost:8090&lt;/code&gt; to see SigNoz in action. Follow the &lt;code&gt;DASHBOARD_SETUP.md&lt;/code&gt; guide to create the 3 core dashboard panels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/aryanpenny/CacheGuard" rel="noopener noreferrer"&gt;https://github.com/aryanpenny/CacheGuard&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built for the SigNoz Hackathon. CacheGuard demonstrates how OpenTelemetry and SigNoz can be used beyond traditional APM — as the foundation for real-time AI security observability and autonomous threat mitigation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>llm</category>
      <category>monitoring</category>
      <category>security</category>
    </item>
  </channel>
</rss>
