Don't Run Customer Code in Your Control Plane

Upgrading Hammer's old build framework would not solve the real problem. The execution model had to change: customer code cannot run inside the control plane.

Don't Run Customer Code in Your Control Plane

The decision framework we applied to the Forge modernisation programme gave each system a verdict: refactor, rewrite, rebuild, replatform, or rationalise. Hammer got the rebuild verdict.

It is worth being precise about why.

The old hammer-manager ran on Rails 4.2. That fact is not what made it a rebuild case. A framework upgrade would have left us with a newer version of the same structural problem. The problem was the execution model: customer builds ran on a shared filesystem, inside the same operational plane as the orchestrator.

Preserve the build contract. Replace the unsafe execution model. That was the brief.

What hammer-manager was doing

To understand the risk, you need to understand what the old system looked like at runtime.

hammer-manager was a Rails application responsible for orchestrating Hammer build jobs. When a Forge customer pushed to a tracked branch, the build pipeline would receive the trigger, select a worker, and dispatch the job. The worker would pull the source, run Hammer, and write the output.

The problem was where that work happened and what surrounded it.

Build jobs ran on a shared filesystem. Workers were Sidekiq processes — sometimes running on the host, sometimes in containers — but without hard isolation between the execution environment and the orchestrator's own operational space. The orchestrator knew where all the jobs were. It held the queue state. It had access to configuration that covered multiple customers. And the workers executing customer code were inside that same operational boundary.

The daily-rotating build token was an acknowledgement that something needed to be controlled. Rotate the token often enough and you reduce the window of exposure if one is compromised. It is a sensible measure. It is also a symptom fix: the underlying co-location problem does not go away because the token changes every twenty-four hours.

We also tried NVM-in-sandbox at one point. Node Version Manager inside the execution environment allows different Hammer projects to use different Node versions on the same host. It solves a real practical problem. It does not change the structural one. You can pick which Node runtime the build uses; you cannot make the build ignorant of the filesystem it shares with the orchestrator.

Why this is the important problem

A shared filesystem between a build executor and a control plane creates a class of risk that is difficult to eliminate without changing the architecture.

A customer build is code you do not control, running in your environment. In the normal case, it compiles a static site and writes to the expected output path. In a malformed or malicious case, it is software running with whatever permissions and filesystem access the executor has. If the executor shares a filesystem with the orchestrator, the blast radius of a bad build is not contained to that build.

This is not a hypothetical. Build systems that run customer code on shared infrastructure without hard isolation have had incidents. The pattern is well understood in cloud infrastructure: AWS isolates Lambda execution environments, GitHub Actions runners are ephemeral and destroyed after each job, Google Cloud Build workers are per-job containers. The industry moved to per-job isolation because the alternative is accepting shared-state risk across tenants.

The control plane separation problem is adjacent but distinct. The control plane is the thing that knows what to build, for whom, when, and with what credentials. It holds queue state, project configuration, customer account relationships. The execution plane is the thing that does the build work. These are different jobs with different trust requirements.

Giving the execution plane access to the control plane's data is the anti-pattern. If an execution worker is compromised, it should not be able to read the database that contains other customers' project configurations. If a build goes wrong in an unusual way, the worker should not have the access required to affect jobs it is not running. The boundary between orchestrator and executor should be narrow and explicit: the worker receives what it needs for one job, and nothing more.

hammer-manager did not have that boundary. The worker and the orchestrator were in the same place.

What the rebuild verdict required

Once we accepted that the execution model was the problem, the scope of the rebuild became clear.

We needed an architecture where:

  • Each build job runs in an isolated execution environment, created for that job and destroyed when it completes
  • Executors receive only the credentials and access they need for their specific job, scoped to that job's lifetime
  • Executors do not have direct access to the database or the message queue that the control plane uses
  • The orchestrator dispatches work and collects results, but does not co-locate with the execution workers

The interface that customers depend on had to stay the same. A Forge customer pushes to a branch. The build runs. They see status updates. They get the compiled output. That contract was not changing. Everything beneath it was.

This is the rebuild framing from post 2: the existing implementation was not worth preserving, but the promise it made was. A rebuild starts from the contract, not from the code.

Hammer Cloud: the architecture

The resulting system is Hammer Cloud.

The orchestration layer is still Sidekiq. That part of the model works and was worth keeping. What changed is the relationship between the orchestrator and the execution workers.

When a build is dispatched, the orchestrator creates an ephemeral job environment. The executor receives a short-lived credential scoped to that job: sufficient to pull the source, run the build, and write output to the designated location. It does not have database access. It does not have access to the Redis instance the orchestrator uses. Its network access is bounded. When the job completes, the execution environment is destroyed and the credential expires.

The short-lived credential model is not novel. AWS STS AssumeRole, GitHub App installation tokens, and Kubernetes workload identity all implement variants of the same pattern. You generate a token at dispatch time with a defined TTL and a defined scope. Revocation is automatic. There is nothing to clean up because there is nothing persistent.

The executor model is provider-neutral. The orchestrator dispatches to an executor interface; the underlying compute can be routed to different providers without the job contract changing. That gives us flexibility on cost, geography, and capacity without tying the architecture to a specific infrastructure vendor.

What we did not change

The Forge build contract from a customer's perspective is unchanged.

Push to a tracked branch. Forge detects the push, dispatches a Hammer build, and shows you status in the dashboard. When the build completes, the output is ready to deploy. Build logs are available. Errors surface through the same feedback channel they always did.

None of that changed. The customer experience of the build pipeline is the same. What changed is what happens between the dispatch and the output: isolated, ephemeral, credential-scoped execution rather than shared-filesystem, co-located execution.

It is worth being direct about what we are not claiming. This post describes the execution model change. Whether the full legacy decommission is complete — whether hammer-manager is fully retired from production — is a separate question. That involves cutover timing, validation, and a transition period that does not make for a clean narrative conclusion. What is true is that the new execution model exists, is running, and replaced the shared-filesystem pattern.

The principle the work enforced

There is a general principle here that extends beyond Hammer Cloud.

If your system runs code you did not write, on behalf of users you do not fully control, that code should not run inside the operational boundary that governs your other tenants' data and configuration.

This sounds obvious when stated directly. It is less obvious when you are building quickly, when the first version of a build system is a Sidekiq worker inside your Rails app because that is the path of least resistance, and when the problem only becomes visible later as the platform grows and the tenant count increases.

The pattern that hammer-manager fell into is common. Build the orchestrator. Add worker jobs. Keep them close together because it is simpler. Rotate tokens because something should be controlled. Add NVM because builds need version isolation. Each step is reasonable locally. Collectively they produce a system where customer code and control plane data are too close together.

The rebuild was the right verdict not because hammer-manager was old, but because the structure it had built up over time was not worth preserving. Sometimes the honest answer is that the architecture is the problem, and patching around it will not close the gap.

What this connects to

This post is the third worked example in the Forge modernisation execution series. The Rails post covered how to make a large framework migration safe to execute. The next post covers the CLI rewrite: why the job the CLI needed to do had changed enough that a rewrite was the honest answer, and what a platform interface looks like when humans, CI systems, and AI agents are all first-class callers.

Both connect back to the same question the decision framework from post 2 was designed to answer: where does the value live, and what does that tell you about what to do next?

In Hammer's case, the value lived in the build contract. The execution model needed to be rebuilt from the inside out.

Hammer is the build tool that powers Forge's static site compilation. Forge is the deployment platform it builds for. If you are dealing with build infrastructure that has accumulated similar structural risk, we are interested in what you are working on.

Want to learn more?

We write about AI, product strategy, and the future of building. Get in touch to continue the conversation.

Start a conversation →