All posts

How to Implement Session Recording for Code Execution

Why session recording matters for code execution Every unsupervised code run leaves a blind spot that attackers can exploit. Development teams often let scripts, notebooks, or ad‑hoc commands run directly against production services using shared credentials. When a bug or malicious payload slips through, there is no reliable way to reconstruct what was executed, what data was returned, or who triggered the action. The lack of a verifiable audit trail makes forensic analysis slow, compliance rep

Free White Paper

SSH Session Recording + Session Binding to Device: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Why session recording matters for code execution

Every unsupervised code run leaves a blind spot that attackers can exploit. Development teams often let scripts, notebooks, or ad‑hoc commands run directly against production services using shared credentials. When a bug or malicious payload slips through, there is no reliable way to reconstruct what was executed, what data was returned, or who triggered the action. The lack of a verifiable audit trail makes forensic analysis slow, compliance reporting impossible, and repeat incidents more likely.

Beyond external threats, internal mistakes are common. A junior engineer may accidentally run a destructive migration script, or an automated job may loop forever, consuming resources. Without a replayable record, the root cause is guessed rather than verified, and remediation is delayed.

The missing piece in typical setups

Most organizations rely on identity providers to issue tokens, then hand those tokens to developers who connect straight to the target runtime, be it a container, a Python interpreter, or a Node.js process. The authentication step (the Setup) decides who may start a session, but it does not enforce what happens once the connection is open. The request travels directly to the execution environment, bypassing any centralized guardrail. As a result, there is no place to capture the command stream, no way to enforce approval before a risky operation, and no immutable log of the output.

In this state, session recording is impossible because the only point of observation is the client itself, which can be tampered with or simply omitted. The infrastructure still receives the raw request, and the organization is left with a black box.

Putting the guardrail in the data path

The only reliable way to guarantee session recording is to place the enforcement mechanism on the path that all traffic must cross. This Data Path acts as an identity‑aware proxy that can inspect, log, and, if needed, block traffic before it reaches the execution engine. By interposing a gateway, the organization gains a single source of truth for every command issued and every response returned.

When the gateway sits between the client and the runtime, it can record the full session, store the transcript in a tamper‑evident store, and make the recording available for replay. Because the gateway is the only component that sees the raw traffic, the recorded data cannot be altered by the client or the target process.

Continue reading? Get the full guide.

SSH Session Recording + Session Binding to Device: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

How hoop.dev captures execution sessions

hoop.dev implements the data‑path approach for code execution. It runs a lightweight agent inside the same network as the runtime and proxies every connection through a Layer 7 gateway. The gateway authenticates the user via OIDC or SAML, then forwards the request to the agent, which talks to the interpreter.

During the exchange, hoop.dev records each byte that flows in both directions. The recorded stream includes the exact commands typed, the timestamps, and the resulting output. After the session ends, hoop.dev stores the transcript and makes it searchable for auditors, security engineers, or developers who need to replay the activity.

Because hoop.dev is the sole point where traffic is inspected, the enforcement outcomes, such as session recording, replay, and audit, exist only because hoop.dev resides in the data path. If the gateway were removed, the same authentication tokens would still allow direct access, but no recording would occur.

In addition to raw capture, hoop.dev ties each recording to the identity that initiated it, preserving a clear chain of accountability. This satisfies internal policies that require per‑user evidence of code execution, and it supports external compliance programs that demand auditable logs.

Getting started with session recording

To add session recording to your code execution workflow, start by deploying the hoop.dev gateway. The quick‑start guide walks you through a Docker Compose deployment that includes OIDC authentication, an agent, and the default recording configuration. Once the gateway is running, register your execution environment as a connection in the hoop.dev console. The registration step tells the gateway which host and port to forward traffic to, and it stores the runtime credentials so they never appear on the client side.

After registration, any client that connects through hoop.dev, whether it is a local terminal, an IDE integration, or an automated CI job, will have its session automatically recorded. You can view recordings in the hoop.dev UI, filter by user or time range, and replay them to see exactly what happened.

For detailed steps, see the getting‑started documentation. The docs also explain how to configure retention policies, integrate with your identity provider, and enable role‑based access to the recordings themselves.

For a high‑level overview of hoop.dev’s capabilities, visit the hoop.dev product overview. If you prefer to explore the source code or contribute, the project is open source on GitHub. Visit the repository to clone the code, review the architecture, and submit improvements.

FAQ

  • Can I record sessions for languages other than Python? Yes. hoop.dev proxies any protocol that runs over a TCP socket, including Node.js, Ruby, Java, and compiled binaries, as long as the runtime is reachable by the agent.
  • How long are recordings kept? Retention is configurable in the hoop.dev UI. You can set policies ranging from a few days for development environments to several years for production workloads.
  • Do recordings contain sensitive data? Recordings capture exactly what the runtime returns. hoop.dev can apply inline masking to hide credit‑card numbers, passwords, or other regulated fields before the transcript is stored, ensuring compliance with data‑privacy requirements.
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