All posts

Implementing IAM for Nested Agents

An offboarded contractor’s CI job still runs nightly, spawning a chain of helper processes that talk to internal databases. Those helper processes are called nested agents because they inherit the original token and then launch their own connections on behalf of the pipeline. The contractor’s IAM policy granted the CI service account broad read‑write rights, so each nested agent can issue queries, modify tables, and even open SSH tunnels without any additional review. When the contractor leaves,

Free White Paper

AWS IAM Policies: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

An offboarded contractor’s CI job still runs nightly, spawning a chain of helper processes that talk to internal databases. Those helper processes are called nested agents because they inherit the original token and then launch their own connections on behalf of the pipeline. The contractor’s IAM policy granted the CI service account broad read‑write rights, so each nested agent can issue queries, modify tables, and even open SSH tunnels without any additional review. When the contractor leaves, the token remains active, the pipeline keeps running, and the nested agents continue to act with the same privileges. The result is a classic IAM blind spot: a credential that was intended for a single job now powers an entire cascade of actions across multiple services.

Traditional IAM approaches focus on the first hop – the identity that authenticates to the gateway. They assign roles, set token lifetimes, and rely on revocation when a user departs. However, once a credential is handed to a process, the downstream agents inherit that identity automatically. The IAM system has no visibility into what those agents do, whether they obey policy, or whether they should be allowed to run at all. In many organizations the only evidence of activity lives in scattered logs that are hard to correlate, and there is no real‑time guardrail to stop a dangerous command before it reaches the target system.

To close this gap, enforcement must happen where the traffic actually flows, not just at the point of authentication. The data‑path – the gateway that proxies every request – is the only place where a policy engine can inspect, mask, approve, or block operations originating from any nested agent. Without a dedicated data‑path control, IAM alone cannot guarantee that a credential used by a CI job will not be abused by the agents it spawns.

IAM considerations for nested agents

Setting up IAM for nested agents starts with defining the identity that each top‑level process receives. This involves configuring OIDC or SAML providers, creating service accounts with the minimum set of permissions, and applying least‑privilege scopes to the token. The setup phase decides who can start a connection and what baseline rights they have. It is necessary, but it does not enforce any rule once the token is in use.

Why the data‑path is the enforcement frontier

The gateway sits between the identity provider and the target infrastructure. By placing a proxy at Layer 7, every database query, SSH command, or HTTP request passes through a single control surface. This is the only point where you can reliably apply:

Continue reading? Get the full guide.

AWS IAM Policies: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.
  • Command‑level audit that records who issued what and when.
  • Inline masking that redacts sensitive fields in query results before they reach the caller.
  • Just‑in‑time approval workflows that pause risky operations for a human reviewer.
  • Session recording that captures the full interaction for later replay.

All of these outcomes exist because the gateway can see the traffic in real time. If the gateway is removed, the IAM system alone cannot provide them.

How hoop.dev provides the required data‑path control

hoop.dev implements an identity‑aware proxy that sits in the network close to the resources you protect. It verifies OIDC/SAML tokens, maps group membership to fine‑grained policies, and then forwards the request to the target only after applying the configured guardrails. Because hoop.dev is the only component that touches the wire, it can:

  • Record each nested‑agent session, creating an audit trail that ties every downstream action back to the original credential.
  • Mask sensitive columns in database responses, ensuring that even a compromised agent cannot exfiltrate PII.
  • Require just‑in‑time approval for commands that match a risk profile, stopping a rogue agent before it executes.
  • Block disallowed commands outright, preventing accidental or malicious changes to critical systems.

These enforcement outcomes are possible only because hoop.dev occupies the data‑path. The IAM setup defines the identity, but hoop.dev enforces the policy at the point of execution.

Getting started with a nested‑agent safe zone

Begin by reviewing the getting started guide to deploy the gateway in your environment. The guide walks you through registering a resource, configuring OIDC authentication, and defining a policy that limits what nested agents can do. Once the gateway is running, you can explore the policy language and masking options in the learn section. The open‑source repository on GitHub contains the full source code and examples for extending the control plane to match your organization’s IAM model.

Explore the source code on GitHub to see how the proxy integrates with your existing identity provider and how you can tailor the enforcement rules for your nested‑agent workloads.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts