<?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: sahil19891989</title>
    <description>The latest articles on DEV Community by sahil19891989 (@sahil19891989).</description>
    <link>https://dev.to/sahil19891989</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%2F4101122%2F1287dbb9-3ad3-4ab9-a981-cfad37228c10.png</url>
      <title>DEV Community: sahil19891989</title>
      <link>https://dev.to/sahil19891989</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sahil19891989"/>
    <language>en</language>
    <item>
      <title>Fortifying Multi-Agent Systems: Zero-Trust Scope Attenuation &amp; Cryptographic HMAC Provenance</title>
      <dc:creator>sahil19891989</dc:creator>
      <pubDate>Sun, 30 Aug 2026 08:09:46 +0000</pubDate>
      <link>https://dev.to/sahil19891989/fortifying-multi-agent-systems-zero-trust-scope-attenuation-cryptographic-hmac-provenance-5154</link>
      <guid>https://dev.to/sahil19891989/fortifying-multi-agent-systems-zero-trust-scope-attenuation-cryptographic-hmac-provenance-5154</guid>
      <description>&lt;p&gt;&lt;em&gt;I wrote this post for the purposes of entering Google's **All Things Agentic Hackathon&lt;/em&gt;* (Track: Fortified Enterprise Fleet).*&lt;/p&gt;




&lt;h2&gt;
  
  
  The Silent Threat in Multi-Agent AI Architectures
&lt;/h2&gt;

&lt;p&gt;Autonomous AI agents are rapidly evolving from simple conversational interfaces into distributed, multi-tier agent fleets. In these architectures, an &lt;strong&gt;Orchestrator Agent&lt;/strong&gt; decomposes complex enterprise tasks and delegates subtasks to specialized worker agents—such as database query bots, reporting engines, and alert dispatchers.&lt;/p&gt;

&lt;p&gt;However, as permissions flow through delegation chains, standard multi-agent systems suffer from a severe architectural vulnerability: &lt;strong&gt;Implicit Privilege Escalation &amp;amp; Compounding Ambient Risk&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When an agent delegates a task, how do we guarantee that a sub-agent only receives the minimum necessary permissions? What prevents a compromised analytics agent from requesting destructive &lt;code&gt;WRITE&lt;/code&gt; or &lt;code&gt;ADMIN&lt;/code&gt; access? And if an adversary alters the delegation logs, how can compliance auditors mathematically prove non-repudiation?&lt;/p&gt;

&lt;p&gt;To solve this, we built the &lt;strong&gt;Fortified Enterprise Agent Fleet&lt;/strong&gt;—a zero-trust governance control plane powered by &lt;strong&gt;Gemini 3.5 Flash&lt;/strong&gt;, &lt;strong&gt;Google ADK&lt;/strong&gt;, and &lt;strong&gt;Google Cloud Run&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Zero-Trust Scope Attenuation
&lt;/h2&gt;

&lt;p&gt;In traditional RBAC, roles are static. In our zero-trust agent fleet, permissions are dynamic and strictly &lt;strong&gt;attenuated&lt;/strong&gt; across hops.&lt;/p&gt;

&lt;p&gt;A scope is defined as a granular &lt;code&gt;(resource, action)&lt;/code&gt; pair (e.g., &lt;code&gt;cloudsql:orders:read&lt;/code&gt; or &lt;code&gt;firestore:reports:write&lt;/code&gt;). We enforce the mathematical law of Scope Attenuation:&lt;/p&gt;

&lt;p&gt;$$\text{Granted Scope} = \text{Requested Scope} \cap \text{Caller Scope} \cap \text{Target Ceiling}$$&lt;/p&gt;

&lt;p&gt;Scope can &lt;strong&gt;only narrow&lt;/strong&gt; as it travels down a delegation chain—it can &lt;strong&gt;never widen&lt;/strong&gt;.&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="c1"&gt;# firewall/scopes.py
&lt;/span&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frozen&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ScopeSet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;scopes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;frozenset&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Scope&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default_factory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;frozenset&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_subset_of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ScopeSet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scopes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;issubset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scopes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;intersect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ScopeSet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ScopeSet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Child scope = requested ∩ caller&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s granted scope.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;ScopeSet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scopes&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scopes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. The Blast-Radius Firewall
&lt;/h2&gt;

&lt;p&gt;Before any delegated task executes, it is intercepted by the &lt;strong&gt;Blast-Radius Firewall&lt;/strong&gt;. The firewall calculates an explainable risk metric based on operation severity:&lt;/p&gt;

&lt;p&gt;$$\text{Score}(\text{Scope}) = \sum \text{Weight}(\text{Action})$$&lt;br&gt;
&lt;em&gt;(where $\text{Read}=1, \text{Audit}=2, \text{Write}=4, \text{Send}=6, \text{Admin}=10$)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If an agent attempts an unauthorized action (e.g., a read-only query agent attempting &lt;code&gt;cloudsql:orders:write&lt;/code&gt;), the firewall instantly halts execution, raises a &lt;code&gt;QuarantineError&lt;/code&gt;, and logs the full diagnostic rationale.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Cryptographic HMAC-SHA256 Provenance Audit Trail
&lt;/h2&gt;

&lt;p&gt;Standard database logs can be manipulated if a storage layer is compromised. To ensure verifiable non-repudiation, every single delegation hop (whether &lt;strong&gt;ALLOWED&lt;/strong&gt; or &lt;strong&gt;QUARANTINED&lt;/strong&gt;) is cryptographically signed using &lt;code&gt;HMAC-SHA256&lt;/code&gt;:&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="c1"&gt;# provenance/chain.py
&lt;/span&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProvenanceRecord&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;parent_agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;child_agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;requested_scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;granted_scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;
    &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;blast_radius_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
    &lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ProvenanceRecord&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;sig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;SECRET&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;signed_payload&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sha256&lt;/span&gt;
        &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sig&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;SECRET&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;signed_payload&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sha256&lt;/span&gt;
        &lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compare_digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If any log record is mutated after the fact, the cryptographic audit engine immediately detects the signature mismatch.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Multi-Service Cloud Run Isolation
&lt;/h2&gt;

&lt;p&gt;Rather than running all agents in a single monolith, the Fortified Fleet deploys each worker as an independent &lt;strong&gt;Google Cloud Run&lt;/strong&gt; service backed by a dedicated &lt;strong&gt;Google Cloud IAM Service Account&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;db-query-agent-sa&lt;/code&gt; $\rightarrow$ &lt;code&gt;roles/cloudsql.viewer&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;report-agent-sa&lt;/code&gt; $\rightarrow$ &lt;code&gt;roles/datastore.user&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;security-auditor-sa&lt;/code&gt; $\rightarrow$ &lt;code&gt;roles/datastore.viewer&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;notifier-agent-sa&lt;/code&gt; $\rightarrow$ No ambient cloud permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This provides true network-level and OS-level process isolation, enforcing defense-in-depth across the entire fleet.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Gemma: A Second, Independent Line of Defense
&lt;/h2&gt;

&lt;p&gt;Scope checks answer "is this agent allowed to do this?" — they say nothing about whether the &lt;em&gt;content&lt;/em&gt; of a request is trying to manipulate an agent into doing something else. So we added a second, independent classifier ahead of the firewall: &lt;strong&gt;Gemma&lt;/strong&gt;, a distinct Google model from Gemini, screens every delegation's raw input for prompt-injection intent before the scope firewall or any agent ever sees it. Because it's a separate model from the Gemini planner, a compromised planner prompt can't also disable the classifier watching it.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Real-Time Web Dashboard &amp;amp; Attack Studio
&lt;/h2&gt;

&lt;p&gt;To make agent governance accessible, we built a real-time visual control plane:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live SVG Topology Graph&lt;/strong&gt;: Visualizes live delegation traffic with animated green flow lines and crimson quarantine flashes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Autonomous Planner (Gemini 3.5)&lt;/strong&gt;: Allows operators to submit open-ended enterprise goals, which Gemini decomposes into least-privilege subtasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attack Simulation Studio&lt;/strong&gt;: One-click vulnerability testing for Privilege Escalation, Cross-Hop Scope Widening, Log Tampering, and Prompt Injection (caught by Gemma before it ever reaches an agent).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Summary &amp;amp; Next Steps
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Fortified Enterprise Agent Fleet&lt;/strong&gt; proves that enterprise multi-agent systems do not have to sacrifice security for autonomy. By combining Gemini 3.5's reasoning capabilities with mathematical scope attenuation and cryptographic audit trails, we can safely govern autonomous agent networks at enterprise scale.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Try it live&lt;/strong&gt;: &lt;a href="https://orchestrator-719825143579.us-central1.run.app" rel="noopener noreferrer"&gt;orchestrator-719825143579.us-central1.run.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch the Demo&lt;/strong&gt;: &lt;a href="https://youtu.be/g_pUtAHzvKM" rel="noopener noreferrer"&gt;YouTube Demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built for&lt;/strong&gt;: Google's &lt;em&gt;All Things Agentic Hackathon&lt;/em&gt; (#AllThingsAgenticHackathon)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>security</category>
    </item>
  </channel>
</rss>
