All posts

Subagents and Machine Identities: What to Know

Many assume that a subagent’s machine identity is a static credential stored on the host, but it is actually a dynamic, policy‑driven token that the gateway validates on each request. In practice, teams often bake long‑lived keys or service‑account passwords into subagents and push those binaries across many servers. The credential is then reused by every instance of the subagent, regardless of who or what initiates the request. Because the token never changes, any compromise of a single host i

Free White Paper

Machine Identity + Managed Identities: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Many assume that a subagent’s machine identity is a static credential stored on the host, but it is actually a dynamic, policy‑driven token that the gateway validates on each request.

In practice, teams often bake long‑lived keys or service‑account passwords into subagents and push those binaries across many servers. The credential is then reused by every instance of the subagent, regardless of who or what initiates the request. Because the token never changes, any compromise of a single host instantly grants unrestricted access to every downstream database, Kubernetes cluster, or SSH endpoint the subagent can reach. Auditors see a flat line of activity with no indication of who triggered a query, and security tooling cannot distinguish a legitimate automation run from a malicious actor that has stolen the embedded secret.

Machine identity challenges with subagents

The core problem is that a static machine identity provides no contextual enforcement. Even when an organization moves to short‑lived tokens issued by an identity provider, the subagent still talks directly to the target service. The request bypasses any gate that could inspect the payload, apply data masking, or require a human approval before a destructive command runs. In other words, the improvement stops at authentication; it does not address authorization, audit, or data‑loss prevention at the point where the subagent actually talks to the resource.

This gap leaves three critical exposure points:

  • Unrecorded command execution – the target service sees a valid token but has no visibility into which subagent instance, which user, or which automation workflow initiated the call.
  • No inline data protection – responses that contain personally identifiable information or credentials flow back to the subagent unfiltered, increasing the risk of leakage.
  • Lack of just‑in‑time (JIT) approval – high‑risk operations such as schema changes or privileged pod exec happen without an extra review step.

Why a data‑path gateway is required

To close the gap, the enforcement point must sit on the traffic path between the subagent and the target service. Only a gateway that intercepts the wire‑level protocol can apply consistent policies regardless of the subagent’s language, runtime, or deployment model. The gateway must be able to read the identity token, map it to a policy, and then decide whether to allow, mask, or block the request.

Setup steps – provisioning OIDC or SAML client registrations, creating service‑account identities, and assigning least‑privilege groups – establish who a subagent claims to be. Those steps are necessary, but they do not enforce any control on their own. The real enforcement happens in the data path, where the gateway can see every command, every response, and every credential exchange.

How hoop.dev implements the required architecture

hoop.dev is a Layer 7 gateway that sits exactly where the enforcement must occur. It receives the subagent’s machine‑identity token, validates it against the configured identity provider, and then forwards the request to the target only after applying the appropriate policy.

Because hoop.dev is the only component that handles the traffic, it can provide the following outcomes:

  • hoop.dev records each subagent session, creating a replayable audit trail that ties every query back to the originating identity.
  • hoop.dev masks sensitive fields in responses in real time, preventing downstream services from exposing raw secrets or personal data.
  • hoop.dev enforces just‑in‑time approvals, pausing high‑impact commands until an authorized reviewer grants permission.
  • hoop.dev blocks dangerous commands before they reach the target, reducing the blast radius of accidental or malicious actions.

The gateway runs a lightweight agent inside the customer network, so credentials never leave the protected perimeter. Subagents connect with their normal client tools – psql, kubectl, ssh – but the connection is tunneled through hoop.dev, which adds the policy layer transparently.

Continue reading? Get the full guide.

Machine Identity + Managed Identities: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

For teams that need to get started quickly, the getting‑started guide walks through deploying the gateway, registering a subagent, and configuring machine‑identity scopes. The learn section dives deeper into policy definitions, inline masking rules, and approval workflows.

Practical steps for adopting machine identities with subagents

1. Define a minimal set of groups in your identity provider that represent the roles subagents need – for example, data‑reader and admin‑operator. Assign each subagent a service‑account that belongs only to the appropriate group.

2. Deploy hoop.dev in a network segment that can reach all target services. The gateway will hold the long‑lived credentials required to talk to those services, while subagents use only their short‑lived tokens.

3. Create policies that map groups to actions. A data‑reader policy might allow SELECT statements on a PostgreSQL instance but require JIT approval for any UPDATE or DELETE. An admin‑operator policy could permit schema changes but still enforce masking of password columns in query results.

4. Enable session recording for compliance and troubleshooting. Because hoop.dev captures the full request‑response flow, you can replay a session to understand exactly what a subagent did without needing to instrument the subagent itself.

5. Monitor audit logs generated by hoop.dev. The logs include the subagent’s machine‑identity token, the resolved user identity, the target resource, and the outcome of each policy check. This visibility turns a black‑box automation pipeline into a transparent, auditable process.

FAQ

What is the difference between a static machine credential and a machine identity token?

A static credential is a long‑lived secret that never changes, making it easy to steal and reuse. A machine identity token is issued by an identity provider, has a short lifespan, and is validated on each request, allowing the gateway to enforce policies based on the current identity context.

Can hoop.dev enforce policies on encrypted traffic?

hoop.dev terminates the protocol at Layer 7, so it can inspect and modify the payload before re‑encrypting it for the downstream service. This enables inline masking and command blocking even when the original client uses TLS.

Do I need to modify my existing subagent code to use hoop.dev?

No. Subagents continue to use their standard client libraries. The only change is the endpoint they connect to – the gateway’s address – which can be supplied via environment variables or a simple configuration file.

By moving the enforcement point into the data path, organizations gain real‑time control over what subagents can do, while still preserving the agility of machine‑identity authentication.

Explore the open‑source repository on GitHub to see the code, contribute, or customize the gateway for your environment.

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