All posts

RBAC in Code Execution, Explained

Common misconception: assigning a single system user to a script automatically satisfies role‑based access control (RBAC). The reality is that a script runs with the privileges of the account that launched it, and those privileges are often far broader than the business intent. When developers embed credentials or rely on a shared service account, the execution environment inherits every permission granted to that account. The code can read production databases, modify Kubernetes clusters, or s

Free White Paper

Secret Detection in Code (TruffleHog, GitLeaks) + Azure RBAC: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Common misconception: assigning a single system user to a script automatically satisfies role‑based access control (RBAC). The reality is that a script runs with the privileges of the account that launched it, and those privileges are often far broader than the business intent.

When developers embed credentials or rely on a shared service account, the execution environment inherits every permission granted to that account. The code can read production databases, modify Kubernetes clusters, or spin up cloud resources, regardless of which engineer triggered the run. Auditors see a monolithic account in the logs, and security teams cannot tell who performed which action.

This starting state is uncomfortable but common. Teams accept the risk because it is easy to manage a single credential, and they assume that the operating‑system user or container runtime provides enough isolation. In practice, the lack of granular RBAC means that a compromised script can become a blast‑radius multiplier, and post‑mortems struggle to attribute malicious or accidental commands to a specific identity.

Why RBAC alone is not enough for code execution

RBAC promises that each role maps to a defined set of permissions, but the enforcement point matters. If the enforcement lives only in an identity provider or in a static IAM policy, the actual execution path bypasses that control. The code still talks directly to the target service, and the request reaches the database or Kubernetes API without any gate that can inspect the payload.

Consequently, two gaps remain:

  • The request reaches the target directly, so there is no real‑time audit of the commands that were sent.
  • There is no inline data masking or command‑level approval; a privileged role can issue destructive statements without additional checks.

Both gaps leave the organization exposed, even though a role‑based policy exists on paper.

hoop.dev as the data‑path enforcement layer

hoop.dev solves the missing enforcement layer by sitting in the data path between the identity that initiates code execution and the infrastructure that fulfills the request. The gateway verifies the caller’s OIDC or SAML token, extracts group membership, and maps that to a role‑based policy that governs each command.

Continue reading? Get the full guide.

Secret Detection in Code (TruffleHog, GitLeaks) + Azure RBAC: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Because hoop.dev proxies the connection, it can:

  • Enforce rbac at the command level. Each SQL statement, kubectl sub‑command, or shell instruction is evaluated against the caller’s role before it is forwarded.
  • Record every session. hoop.dev writes a replayable log that ties each command to the originating identity, providing an immutable audit trail.
  • Apply inline masking. Sensitive fields in query results are stripped or redacted in real time, preventing accidental leakage.
  • Require just‑in‑time approval. High‑risk operations trigger a workflow that pauses execution until an authorized reviewer grants permission.

All of these outcomes exist only because hoop.dev sits in the gateway. Without that data‑path component, the identity system alone cannot block a command, mask a response, or capture a replayable session.

How the enforcement works in practice

When a developer runs a script that connects to a PostgreSQL instance, the client points to the hoop.dev endpoint instead of the database host. The gateway’s agent, deployed inside the same network segment as the database, establishes the actual backend connection using a credential that the developer never sees. The developer’s OIDC token is presented to hoop.dev, which validates it and determines the role – for example, data‑analyst or dev‑ops‑engineer.

The gateway then inspects each SQL statement. A data‑analyst role might be allowed SELECT statements on certain tables but denied INSERT statements or DROP commands. If the script attempts a prohibited command, hoop.dev blocks it and logs the denial. If the command is classified as high‑risk – such as a bulk delete – hoop.dev pauses execution and routes a request to the approval workflow defined in the policy.

All interactions are captured. The session log includes timestamps, the exact statement, the identity that issued it, and the outcome (allowed, masked, denied, or approved). This log can be replayed in a secure viewer, satisfying audit requirements without exposing raw credentials.

Benefits of placing RBAC in the data path

Moving RBAC enforcement to hoop.dev delivers three concrete advantages:

  • Visibility. Security teams can trace every command back to a user, reducing investigation time after an incident.
  • Least‑privilege enforcement. Roles are enforced at the point of action, preventing privilege creep that often occurs when broad service accounts are used.
  • Compliance readiness. The recorded sessions and approval trails generate evidence that auditors look for in standards such as SOC 2.

Because hoop.dev is open source and MIT‑licensed, organizations can run the gateway inside their own VPC, keeping all logs and policies under their control.

Getting started

To adopt this model, begin with the getting started guide. It walks you through deploying the gateway, configuring OIDC authentication, and registering a code‑execution target such as a database or a Kubernetes cluster. The learn section provides deeper coverage of role definitions, approval workflows, and session replay.

For the full source code and contribution guidelines, visit the GitHub repository. Exploring the repo gives you a concrete view of how the data‑path proxy is built and how you can extend it for custom policies.

By moving RBAC enforcement into the data path with hoop.dev, organizations turn a vague permission model into a concrete, auditable, and controllable guardrail for every piece of code they run.

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