Air-Gapped CI Environments and Offline Identity Simulation

Only a stateful local simulator can test identity workflows offline.

· 8 min read
Cover illustration for “Air-Gapped CI Environments and Offline Identity Simulation”
Auth Flow Testing · November 21, 2026 · 8 min read · 1,893 words

Integration testing against stateful APIs needs a simulator hosted locally that remembers how each call changes users, tokens, sessions, and permissions. In air-gapped CI, that simulator must run wholly inside the isolated perimeter, keep each test run’s state separate, and be checked against the real API on a regular basis. Network isolation prevents external access, but only stateful simulation tests whether an identity workflow remains correct as calls accumulate.

Why air-gapped CI pipelines fail at identity simulation before a mock is ever written

An isolated runner can execute a test without exercising the identity rules that make the application work. A token granted by one call governs what the next call may do. A session opened at the start must still exist when a later call closes it. Granting a permission mid-flow changes subsequent responses. These are dependencies between calls.

The isolation requirement precedes any choice of testing tool. Regulated and classified workloads restrict egress by policy, with permitted traffic passing through approved DoD-controlled boundaries, including BCAP/NIPRNet for IL5 and SIPRNet for IL6. Those controlled connectivity arrangements are distinct from a runtime environment with no outbound connectivity. In either case, external access is not a testing convenience that engineers can assume.

That constraint exposes a weakness in the test foundation. Removing access to a live identity provider also removes the system that remembers previous operations and enforces their consequences. A replacement that supplies plausible responses without preserving those consequences validates only fragments of the workflow. The gap exists before the first mock response is written.

What "air-gapped" actually requires, and why most so-called offline setups don't qualify

A true air-gapped deployment has zero outbound connectivity from its authorization boundary at runtime. A self-hosted platform can still depend on a vendor’s license server, external image registry, or cloud inference endpoint. Its physical location says little about its runtime dependencies.

Five paths distinguish a fully internal deployment from an approximately offline one. License check-ins need to reach a vendor server from time to time. Telemetry or analytics creates another outbound path when enabled by default. Live software updates and container pulls depend on outside services during scale-out, as do cloud LLM calls during inference. In-app documentation links that open external URLs complete the diagnostic.

Each path must be configurable to remain fully internal. A platform that sends AI-assisted test generation to OpenAI or Anthropic is not air-gapped merely because its runner is local. Telemetry must be off by default, with explicit opt-in. An independent egress audit of the running platform must show zero outbound connections.

The architecture of a fully internalized identity-testing pipeline

The source and dependency layer begins with an internal Git server, such as GitLab or Gitea, without direct synchronization to an external cloud. Internal mirrors serve PyPI, npm, and Maven packages and container base images pre-staged through approved transfer. Builds depend on those mirrors. This makes the dependency chain self-sufficient at runtime.

The orchestration layer places both the scheduler and build agents inside the boundary. Jenkins, GitLab self-managed, Azure DevOps Server, or internal GitHub Enterprise can provide the orchestration, but pipeline references must also stay internal. An image reference such as registry.internal.company.com/node:18 belongs to that closed system, while docker.io/node:18 does not. Communication between the control and execution planes must have no external handoff.

Where the pipeline uses LLM inference, that layer needs a self-hosted endpoint. The fourth layer is API simulation, which supplies the identity behavior exercised by applications and agent tools. It replaces an external dependency without flattening its behavior. The fifth layer keeps session logs and documentation local, providing traceability without cloud telemetry or external documentation fetches. All five layers must remain self-sufficient during execution.

Why stateless mocks cannot simulate identity and auth APIs, regardless of how well they are written

A stateless mock returns the same body for the same request shape because it has no memory of earlier calls. That limitation is structural. It cannot distinguish a token that remains valid from the same token after revocation. Nor can it track a session created by an earlier operation.

The failures become concrete when calls form a sequence. A token granted in call one should be rejected in call three after revocation in call two. A downstream operation should fail when its required session is absent. A permission granted mid-flow should change later responses, while a repeated create operation that should conflict must not receive a second success. Fixed success responses conceal every one of these distinctions.

Recorded cassettes impose a different but related constraint. They can replay a fixed sequence, but retries, partial failures, and out-of-order calls take execution away from that recording. Identity tests need to cover those deviations as well as the one path that succeeds. When the replacement cannot distinguish valid transitions from invalid ones, passing CI establishes agreement with the fixture.

How can integration tests against stateful APIs run without production access?

A stateful simulator must maintain a mutable world throughout each test session. Adding a user must make that user available to later list, update, and delete operations. Granting a permission must affect downstream responses. State persists between calls within a run, but remains isolated from other runs. This is the foundation for testing operations whose correctness depends on their order.

That world also needs realistic starting conditions. Pre-seeded identities, roles, and permission structures let tests exercise existing relationships rather than spend every run bootstrapping an empty account. The simulator must change those relationships as the real API would.

Behavioral fidelity also requires recurring comparison with the real API. Golden request-response pairs let tests check response keys, value types, and mutation side-effects at each step of a trajectory. Fault injection must be a built-in capability. Offline deployment requires internally mirrored container images, no license check-in, and no external runtime pulls. Parallel CI jobs need their own state so that a revocation, deletion, or permission change in one test cannot change the result of another.

How MCP server testing fits into the same architecture and where it introduces new failure modes

MCP adds an agent’s choice of tools and call order to the behavior under test. An agent may retry a failed operation, create before reading in one run, or read before creating in another. Live API variability compounds that uncertainty. A stateful simulator removes the live dependency while preserving the consequences of the agent’s chosen sequence.

The interception point determines what the test exercises. Mocking the LLM tests the MCP server’s JSON handling. Mocking MCP transport validates tool names, JSON Schema, and argument routing, while replacing the underlying APIs exercises pagination, rate limits, error envelopes, and auth refresh logic. The simulator therefore belongs at the network layer behind the MCP server, where different tool sequences can operate against the same behavioral rules.

Production OAuth credentials are not a substitute for this separation. Even a read-only list call with the wrong filter can impose load on a customer’s tenant, while write tools can fill shared environments with synthetic data across retries and branches. ClawsBench built five stateful services for Gmail, Calendar, Docs, Drive, and Slack, each backed by SQLite for isolated, reproducible evaluation. The paper’s golden-pair testing identified and fixed 11 recurring bug classes in those implementations. Stateful behavior still needs evidence of fidelity.

Fault injection as a required property of identity simulation, not a testing afterthought

A simulator that preserves state but always succeeds leaves degradation untested. The required fault classes include latency, 429s, 503s, malformed payloads, dropped connections, and duplicate delivery. For identity workflows, these become token-refresh timeouts, rate-limited auth endpoints, unavailable identity providers, malformed JWTs, interrupted session establishment, and repeated auth events. A failure can leave state behind without any clear sign of an error.

AgentChaos injected faults into the LLM API responses of five agent systems using four backbone models. The study found that silent degradation was the dominant failure mode, with the most damaging failures never raising an error. That finding comes from tests of agent systems, which did not focus on identity providers. Its relevance to identity-dependent agent testing is that successful execution alone cannot establish correct behavior under faults.

llmmas-otel provides injection at agent-to-agent communication, LLM calls, and tool calls, with annotated traces and offline message records. Its framework-agnostic design lets it fit into a system with few changes to the source code. For identity simulation, a 429 at token refresh exercises retry and backoff logic, while a malformed JWT exercises downstream validation. A dropped connection during session establishment tests handling of partial auth state, and duplicate delivery tests idempotency. The offline simulator must generate these conditions itself because disconnecting an already isolated environment cannot reproduce them.

Fidelity drift and how simulators silently stop matching the real API over time

A simulator can preserve state correctly and still model an obsolete API. Response shapes change, required fields appear, and error codes are added or deprecated. The simulator may keep returning responses without any sign of failure. CI then accepts code that agrees with yesterday’s contract.

Golden-pair verification must run before every simulator release, checking response keys, value types, and mutation side-effects against current API behavior. A quarterly audit is not an adequate release gate. The earlier ClawsBench findings show why implementations that seem right need to be checked against real responses, even when they agree with their own rules.

The same concern extends to long-running agent training. Firefly builds a retrieval-augmented simulator that caches exploration results and replays them during training and evaluation, enabling reproducibility without live servers. A cache preserves behavior as observed at the time of capture. Its continued usefulness therefore depends on verification against the real API.

Air-gapped execution separates acquisition of current API evidence from the isolated pipeline’s runtime verification. The approved-transfer model provides the boundary for bringing dependencies and verification material inside without opening runtime egress. A simulator’s trustworthiness depends on how recently its behavior was compared with reality.

Putting it together: a concrete pipeline layout for identity-dependent CI inside an isolated perimeter

The resulting blueprint gives each CI job its own simulator instance and isolated state volume. Realistic identities, roles, sessions, and permissions are baked into the simulator image. With images and packages mirrored inside the boundary, jobs can start and run without relying on public infrastructure.

Fault scenarios are declared per test. One scenario injects a 429 at token refresh, another a 503 at session establishment, and another a malformed JWT at validation. For agent tests, local MCP servers use STDIO for agent-to-server communication. The simulator sits behind those servers at the network layer, so tool calls test identity state without reaching live APIs.

Self-hosted orchestration runs entirely inside the boundary, and runners reference resources by internal addresses. Before each simulator image can enter the internal registry, it must pass golden-pair verification using up-to-date evidence from the API brought through the approved boundary. Local session logs preserve the audit trail without cloud telemetry. Bundled documentation lets teams get help with running the system inside the same perimeter.

This layout removes live credentials from CI and prevents test writes from corrupting shared sandboxes. It also replaces uncontrolled provider rate limits with deliberate fault scenarios and supplies reproducible state across parallel jobs. Agent reasoning may still vary, but the identity environment no longer varies with live service conditions. The acceptance criterion is whether ordered calls produce the correct accumulated state, including under failure, against a model whose fidelity remains under active verification.

More in Auth Flow Testing