All posts

Getting RBAC Right for Self-Hosted Models

Why does rbac feel impossible with home‑grown model servers? How can you enforce fine‑grained rbac for self‑hosted AI models without exposing secret keys? Most teams deploy a model behind a single HTTP endpoint and protect it with a static API key or a network‑level firewall. The key is copied into deployment scripts, shared among developers, and sometimes baked into CI pipelines. When a data scientist runs a notebook, the same credential is used to query the model, and there is no record of w

Free White Paper

Self-Service Access Portals + Azure RBAC: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Why does rbac feel impossible with home‑grown model servers?

How can you enforce fine‑grained rbac for self‑hosted AI models without exposing secret keys?

Most teams deploy a model behind a single HTTP endpoint and protect it with a static API key or a network‑level firewall. The key is copied into deployment scripts, shared among developers, and sometimes baked into CI pipelines. When a data scientist runs a notebook, the same credential is used to query the model, and there is no record of who asked what. If a compromised container leaks the key, every downstream service instantly gains unrestricted access.

Because the request travels directly from the client to the model, the infrastructure has no visibility into the operation. No audit log is generated, no field is masked, and no approval step can intervene. The model itself is unaware of the caller’s identity, so it cannot enforce role‑based policies on its own.

What must change before rbac can work?

The first step is to replace static secrets with identity‑driven tokens. Modern identity providers (Okta, Azure AD, Google Workspace) can issue short‑lived OIDC or SAML tokens that encode the user’s groups and permissions. Service accounts can be granted the minimum scopes required for a specific job. This setup establishes who is making the request and limits the lifetime of any credential.

However, even with proper identity, the request still reaches the model directly. The model’s network stack sees only a TCP connection; it cannot verify the token, apply role checks, or record the interaction. The missing piece is a control surface that sits on the data path, inspects each request, and enforces the rbac policy before the model processes the payload.

hoop.dev as the data‑path enforcement point

hoop.dev provides exactly that control surface. It is a layer‑7 gateway that proxies every connection to a self‑hosted model. The gateway runs an agent inside the same network as the model, so traffic never leaves the trusted zone. When a user presents an OIDC token, hoop.dev validates the token against the configured identity provider, extracts the user’s groups, and matches them against a declarative rbac policy.

Continue reading? Get the full guide.

Self-Service Access Portals + Azure RBAC: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Because hoop.dev sits in the data path, it can enforce several outcomes that would otherwise be impossible:

  • Policy enforcement: hoop.dev allows or denies a request based on the caller’s role, ensuring that only authorized users can invoke privileged model endpoints.
  • Just‑in‑time approval: for high‑risk operations, hoop.dev can pause the request and route it to a human approver before the model runs.
  • Inline masking: response fields that contain sensitive information (for example, personally identifiable data) can be redacted in real time, keeping downstream logs clean.
  • Session recording: hoop.dev records each interaction, preserving a replayable audit trail for forensic analysis.

All of these enforcement outcomes exist only because hoop.dev occupies the gateway position. If the identity provider alone were used, none of the above would be guaranteed; the model would still process every request unchecked.

How the pieces fit together

Setup. You configure an OIDC or SAML identity source, define groups that correspond to rbac roles (e.g., model‑admin, model‑viewer), and create service accounts for automated pipelines. This step determines who may start a request but does not enforce any policy on its own.

The data path. hoop.dev is deployed as a Docker Compose stack or a Kubernetes pod, depending on your environment. The gateway registers the model endpoint as a connection and stores the model’s service credentials internally. Clients – whether a notebook, a CI job, or an AI‑assistant – connect to the model through hoop.dev using their usual client libraries. The gateway intercepts the wire‑level protocol, extracts the request payload, and applies the rbac checks.

Enforcement outcomes. When a request matches a policy that permits execution, hoop.dev forwards it to the model. If the request exceeds the caller’s role, hoop.dev blocks it and returns an informative error. For requests that require approval, hoop.dev queues the operation and notifies the designated approver. Every interaction is logged, and any fields marked as sensitive are masked before they reach downstream logs or monitoring tools.

Getting started with hoop.dev

To try this approach, follow the getting‑started guide. The documentation walks you through deploying the gateway, connecting an OIDC provider, and defining rbac policies for a sample model endpoint. For deeper insight into policy syntax, masking options, and audit‑log configuration, see the learn section. Because hoop.dev is open source, you can inspect the code, contribute improvements, or host the gateway behind your own firewall.

FAQ

  • Can hoop.dev enforce rbac on models that use custom protocols? Yes. hoop.dev operates at the wire‑protocol level, so as long as the protocol is supported (HTTP, gRPC, etc.), the gateway can inspect and enforce policies.
  • Does using hoop.dev add latency to model inference? The gateway adds a small, predictable overhead for policy evaluation and optional masking. In most deployments the added latency is measured in milliseconds and is outweighed by the security benefits.
  • How are audit logs recorded? hoop.dev records each session and makes the audit trail available for downstream collection. The gateway never exposes credentials in the logs.

Ready to see the code in action? Explore the repository on GitHub and start hardening your self‑hosted model deployments today.

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