As of September 4, 2026, OpenAI’s public Defense Factory material describes a repeatable loop for finding, reproducing, fixing, and validating security issues rather than a mandatory turnkey platform; see the official Defense Factory reference architecture. Do not copy the whole factory first. Start with one high-frequency patch validation workflow in a task-level temporary isolated environment, then route Apple-specific work to a cloud Mac pool.
Decision: This approach fits teams that need controlled, reproducible security-agent execution. It does not fit a team that wants to give an agent unrestricted production access or run long-lived heavy workloads without lifecycle controls.
This guide is for platform engineers building dynamic reproduction around Codex Security, security teams limiting agent credentials and network access, and DevSecOps leaders planning elastic Mac capacity for iOS, macOS, or cross-platform projects. If the immediate need is only static scanning, start with repository integration rather than building the full execution lifecycle.
Start with one patch workflow, not the entire factory
The first deployment target should be narrow: one repository, one class of security finding, and one reversible change. A broad security operations program introduces too many variables at once. When reproduction fails, the team then cannot tell whether the problem is the code, the dependency graph, the service setup, the agent permission boundary, or the test itself.
A useful pilot has a simple path:
- A candidate finding is created.
- The team attempts dynamic reproduction.
- A confirmed vulnerability is linked to a precise source version.
- A proposed patch is generated and reviewed.
- A new task independently retests the patch.
- Evidence is archived before the disposable environment is destroyed.
These are workflow states, not claims about product status. OpenAI’s public material should be treated as a reference architecture and operating model, not as an OpenAI-mandated implementation for every organization. The Codex Security documentation should remain the authority for the current product entry point, supported workflow, and access conditions.
Define the evidence required at each boundary before running the first task. For a candidate finding, retain the scanner or agent output and source revision. For a reproduced issue, add the exact preconditions, affected version, execution command, and result. For a proposed patch, save the patch identity and review status. For a verified fix, require fresh-build results, security-test output, normal regression results, and human approval.
The distinction matters because a Codex Security discovery is not automatically a confirmed vulnerability. Codex Security provides discovery and analysis capabilities. The business ticket system manages ownership and remediation flow. The execution environment supplies the controlled place to build and test. Combining those responsibilities in one system makes it easy to treat a scan result as proof.
First step: separate the control plane from task execution
The control plane should schedule tasks, issue temporary identities, enforce policy, proxy credentials, collect status, and decide whether a job may proceed. It should not become the place where untrusted repository code runs.
The execution plane should be disposable. It receives a locked source revision, a declared dependency set, approved configuration, and a test entry point. It builds and runs the application inside an isolated workspace. When the task ends, the workspace is destroyed or reset from a trusted template.
Keep these permissions separate:
| Resource or action | Control plane | General execution pool | Cloud Mac pool | Approval boundary |
|---|---|---|---|---|
| Schedule a validation task | Allowed | No | No | Policy check |
| Read the target repository | Brokered, temporary | Scoped to task | Scoped to task | Repository policy |
| Read package or build artifacts | Brokered, temporary | Read-only where possible | Read-only where possible | Artifact policy |
| Modify source or create a branch | Request only | Denied by default | Denied by default | Independent approval |
| Create or close a business ticket | Request only | Denied by default | Denied by default | Human or service approval |
| Run standard build and tests | No code execution | Allowed in task workspace | Allowed for Apple-specific tasks | Runtime policy |
| Use Xcode, Apple SDKs, signing, or macOS APIs | No | Do not schedule | Allowed when explicitly required | Apple toolchain policy |
| Destroy the workspace | Orchestrates | Receives termination | Receives termination | Logged lifecycle event |
A shared execution pool is acceptable only when the scheduler can provide separate workspaces, identities, network policy, and cleanup guarantees. The isolation boundary is the task, not the number of virtual machines. Use a dedicated environment when the repository contains sensitive material, the network boundary is strict, or the cost of contamination is high.
Do not place a personal long-lived token in an image, bootstrap script, environment template, or build cache. Use a short-lived credential broker. For CI-style identity federation, the GitHub Actions OIDC guidance explains the general pattern of exchanging workflow identity for temporary cloud access rather than distributing static secrets.
The cloud Mac pool must use different scheduling labels and identity policy from the general pool. A task should enter that pool only because it needs Xcode, Apple SDK behavior, code signing, a simulator, native macOS APIs, or another Apple-specific dependency. This prevents ordinary security reproduction work from consuming scarce Mac capacity.
Build the first temporary isolated environment
The first task should reconstruct the application before importing the security finding. This ordering prevents an environment defect from being misclassified as a failure to reproduce the vulnerability.
Use a locked source commit rather than the developer’s current working tree. Resolve dependencies from a committed lockfile or approved manifest. Declare service versions, required variables, database fixtures, test commands, and network destinations. If a required external service cannot be used in the isolated environment, replace it with an approved test double and record that limitation.
A reliable bootstrap sequence looks like this:
- [ ] Create a task record with repository, source commit, requester, policy class, and expiration condition.
- [ ] Issue a temporary task identity with the minimum repository, artifact, and test-service permissions.
- [ ] Allocate a fresh workspace from a versioned environment template.
- [ ] Restore dependencies from the locked manifest and record the resulting dependency fingerprint.
- [ ] Apply non-secret test configuration through a broker, with sensitive values scoped to the task.
- [ ] Build the application without the candidate finding loaded.
- [ ] Run a normal health check and a baseline test entry point.
- [ ] Classify setup failures separately from application or security-test failures.
- [ ] Import the candidate finding only after the baseline passes.
- [ ] Capture the environment version, initialization output, build result, and failure classification.
The baseline is a stop condition. If the application cannot build or start from the locked revision, stop the vulnerability validation and repair the environment definition first. Do not allow an agent to “work around” missing dependencies by silently changing the source or pulling unapproved packages.
The Codex Security system card is useful context for treating model behavior, tool use, and system boundaries as separate risk areas. It should not be used as evidence that a particular team will achieve a specific security outcome or productivity gain.
Record failures with stable categories such as source mismatch, dependency resolution, service startup, permission denial, network policy, test assertion, and agent timeout. This classification becomes more valuable than a single success rate because it tells the platform team what to improve in the template, scheduler, or policy.
Run dynamic validation while keeping writes behind approval
Once the baseline is healthy, allow the agent to read the required source and execute the authorized validation commands. Keep external writes restricted. Creating a ticket, opening a pull request, changing a repository, uploading an artifact, or calling an external system should require an independent policy decision.
The execution task should produce evidence that another operator can inspect without reopening the original workspace:
- source commit and dependency fingerprint;
- environment template and initialization result;
- precise reproduction conditions;
- affected application or package version;
- command and test output;
- relevant logs and exit status;
- network and tool decisions;
- agent actions that changed local state;
- reviewer decision and timestamp;
- unresolved assumptions or limitations.
A static trace can identify a promising path, but it cannot by itself prove runtime impact. If the dynamic test cannot confirm the behavior, preserve the result as inconclusive. Do not upgrade uncertain findings simply to improve closure metrics.
Operational reminder: An isolated environment limits blast radius; it does not make a malicious repository, a compromised dependency, or an overly broad network policy harmless. Treat outbound access, package installation, service credentials, and artifact uploads as separate controls.
For dynamic testing, define the allowed network destinations before execution begins. A package mirror, test database, or internal fixture service may be necessary. General outbound access is a different decision and should not be enabled merely because the agent reports that it needs it.
The business ticket should reference the evidence bundle, but it should not become the only copy. Store the audit record outside the disposable execution environment. Otherwise, destroying the workspace also destroys the explanation for why a finding was confirmed, rejected, or left unresolved.
Generate the patch, then create a clean retest task
The patch-generation session must not sign its own result. This is the most important separation in the workflow. A session that changed the code, modified local configuration, and interpreted the original failure has too much context to serve as the sole verifier.
Create a new task from the proposed commit or patch artifact. Rebuild from a fresh environment template. Restore the same baseline inputs where permitted, then run:
- the security test that previously demonstrated the issue;
- nearby abuse-case or boundary tests;
- normal unit and integration tests;
- application startup and health checks;
- platform-specific build and signing checks where applicable.
The independent task should answer three separate questions. Does the original behavior fail under the documented conditions? Does the patched revision remove that behavior? Does the patch preserve expected functionality? A “ticket closed” state answers none of these questions by itself.
For iOS and macOS projects, do not send every task to a Mac. Repository analysis, dependency review, and platform-neutral tests can run in the general pool. Use a real Mac when the result depends on Xcode, Apple SDKs, simulator behavior, native frameworks, macOS runtime behavior, signing, or packaging.
The Apple command-line tools documentation is the appropriate reference for the installed toolchain and command-line build path. If the workflow produces signed Mac code, follow Apple’s distribution signing guidance and keep signing credentials outside the base image.
A cloud Mac is therefore a routing decision, not a universal requirement. It provides value when the patch cannot be trusted until it passes a real Apple build or runtime boundary. It adds operational requirements too: exclusive or task-scoped access, clean workspace reset, signing-key control, simulator data cleanup, and a clear destruction record.
FAQ: isolation, evidence, and Apple validation
The following answers cover the boundary decisions that usually block a first deployment.
Does every security agent need its own isolated environment?
Not necessarily. Each task needs an execution boundary that can be isolated, audited, and destroyed without affecting another task. A shared pool can work when jobs receive separate workspaces, identities, network policies, and lifecycle controls. Use dedicated environments when the code, credentials, regulatory boundary, or failure impact makes cross-task contamination unacceptable.
How should evidence be saved after Codex Security finds a vulnerability?
Save the exact source commit, dependency lockfile, environment template, service configuration, test command, reproduction output, affected version, and reviewer decision. Store the evidence outside the disposable workspace. A static finding alone is not confirmation; retain the dynamic execution result, including failed or inconclusive attempts, so another operator can reconstruct the decision.
Why must an agent-generated patch be retested in a separate environment?
The patching session has incentives and context that can hide an incomplete fix. A fresh environment removes modified files, cached dependencies, temporary services, and agent-created assumptions. Rebuilding from the proposed commit lets an independent task test the security condition and normal behavior without allowing the generator to approve its own work.
Do iOS and macOS patches always require a real Mac for validation?
No. Repository checks, language tests, and platform-neutral logic can run in a general execution pool. Real Mac hardware becomes necessary when validation depends on Xcode, Apple SDK behavior, code signing, simulator behavior, native frameworks, or macOS runtime details. Route only those tasks to an isolated cloud Mac pool rather than using Mac capacity for every scan.
Which logs should remain after a temporary patch validation environment is destroyed?
Keep identity and approval events, source and dependency fingerprints, environment version, commands, test results, network and tool decisions, agent actions, timestamps, failure classification, reviewer outcome, and destruction confirmation. Do not preserve secrets or an uncontrolled copy of the workspace. Evidence should remain readable after the execution environment is gone.
Finish the first week with recovery and destruction tests
A temporary environment is only temporary if the lifecycle actually ends. At task completion, revoke the task identity, remove workspace access, destroy the workspace, invalidate temporary service credentials, and confirm that no sensitive artifact remains in a cache, log stream, image layer, or shared volume.
Keep the audit evidence outside the execution environment. The retained record should prove:
- who or what requested the task;
- which policy allowed it;
- which source and dependencies were tested;
- which tools and destinations were available;
- what the agent and test runner did;
- which result was obtained;
- who approved external writes or release actions;
- when access was revoked;
- when destruction completed.
Run recovery exercises before expanding the pilot. Interrupt a task during setup, during testing, and after a patch artifact is produced. Then rebuild from the saved task state. The expected result is not that every task succeeds. The expected result is that a failed or interrupted task cannot resume with stale credentials, an untracked modified workspace, or an ambiguous evidence record.
The GitHub self-hosted runner documentation provides relevant operational guidance for runner isolation, maintenance, and lifecycle management. A self-hosted runner or Mac executor should not be treated as clean merely because the previous job reported success.
Set a stop condition for the pilot: if the team cannot reproduce the baseline, identify the exact source revision, archive the test evidence, or confirm destruction, do not add more repositories. Fix the lifecycle boundary first.
Choose capacity from task behavior, not a fixed fleet
After the workflow is reliable, measure the inputs that affect scheduling:
- environment startup delay;
- task occupancy duration;
- interruption and recovery frequency;
- proportion of Apple-specific jobs;
- peak simultaneous tasks;
- build queue time;
- cleanup duration;
- frequency of signing or simulator requirements.
These observations determine whether a shared general pool, an elastic peak pool, or temporary dedicated environments are appropriate. Do not turn an early pilot into a permanent fleet based on one busy day. The Defense Factory announcement supports the broader direction of iterative defensive workflows, but it does not establish a universal team size, machine count, performance target, or deployment requirement.
For standard validation, elastic general execution is usually the sensible default. For Apple work, a separate cloud Mac pool avoids mixing Xcode state, simulator data, signing material, and macOS-specific caches with unrelated jobs. If Mac tasks are rare, on-demand allocation is easier to justify. If they are frequent and queue time becomes a release blocker, compare reserved capacity with temporary isolation using actual occupancy records rather than assumed utilization.
Do not treat the word “cloud” as proof of isolation. The scheduler still needs task-scoped identities, clean allocation, controlled network egress, protected signing credentials, and verifiable teardown. A cloud Mac with a reused workspace can be less trustworthy than a well-managed general runner.
What to keep before expanding the workflow
Before adding another repository or finding class, review the pilot against this release gate:
- [ ] The baseline build succeeds from a locked source revision.
- [ ] Setup failures are distinguishable from application and security-test failures.
- [ ] Codex Security findings remain separate from confirmed vulnerability states.
- [ ] The execution task cannot approve its own generated patch.
- [ ] Repository, artifact, ticket, and cloud permissions are independently scoped.
- [ ] External writes require an explicit approval path.
- [ ] Dynamic reproduction evidence is stored outside the disposable workspace.
- [ ] Apple-specific tasks are routed to a separate cloud Mac identity and pool.
- [ ] Xcode, signing, simulator, and macOS runtime evidence is retained when relevant.
- [ ] Interrupted tasks can be rebuilt without stale credentials or hidden local changes.
- [ ] Workspace destruction and credential revocation generate auditable records.
- [ ] Unconfirmed findings remain marked as inconclusive rather than being forced into a binary result.
If any item fails, the correct rollback is to keep the workflow at its current scope, repair the control or execution boundary, and rerun the same test. Expanding coverage before the first path is reproducible creates more tickets, more ambiguous evidence, and more cleanup debt.
When a cloud Mac is the right next step
A local Mac can be the best choice for a small team with steady daily work, physical-device requirements, or long-lived debugging sessions. A cloud Mac is more suitable when the need is temporary, parallel, geographically distributed, or tied to a CI-style validation queue. It can also help when platform engineers need a clean Apple toolchain without giving every general-purpose security task access to a Mac.
The current non-Mac approach has real limitations when Apple validation is required: containerized runners cannot reproduce every macOS behavior, Linux-based builds cannot replace Xcode and Apple SDK checks, and a shared developer workstation leaves behind caches, signing state, and undocumented changes. A permanently assigned local Mac has the opposite problem: it can sit idle between tasks while remaining difficult to reset and audit.
That is where renting a cloud Mac through zekmac can make the workflow easier to operate for temporary validation. Start by listing which tasks truly require Xcode or macOS, then compare their peak concurrency, isolation period, cleanup requirements, and recovery path. If the work is continuous, heavy, and dependent on physical interfaces, purchasing and operating dedicated hardware may still be the more rational choice. If the demand is intermittent and the priority is a clean, disposable Apple execution boundary, an on-demand zekmac environment is the more flexible option.
FAQ
Does every security agent need its own isolated environment?
Not necessarily. Each task needs an execution boundary that can be isolated, audited, and destroyed without affecting another task. A shared pool can work when jobs receive separate workspaces, identities, network policies, and lifecycle controls. Use dedicated environments when the code, credentials, regulatory boundary, or failure impact makes cross-task contamination unacceptable.
How should evidence be saved after Codex Security finds a vulnerability?
Save the exact source commit, dependency lockfile, environment template, service configuration, test command, reproduction output, affected version, and reviewer decision. Store the evidence outside the disposable workspace. A static finding alone is not confirmation; retain the dynamic execution result, including failed or inconclusive attempts, so another operator can reconstruct the decision.
Why must an agent-generated patch be retested in a separate environment?
The patching session has incentives and context that can hide an incomplete fix. A fresh environment removes modified files, cached dependencies, temporary services, and agent-created assumptions. Rebuilding from the proposed commit lets an independent task test the security condition and normal behavior without allowing the generator to approve its own work.
Do iOS and macOS patches always require a real Mac for validation?
No. Repository checks, language tests, and platform-neutral logic can run in a general execution pool. Real Mac hardware becomes necessary when validation depends on Xcode, Apple SDK behavior, code signing, simulator behavior, native frameworks, or macOS runtime details. Route only those tasks to an isolated cloud Mac pool rather than using Mac capacity for every scan.
Which logs should remain after a temporary patch validation environment is destroyed?
Keep identity and approval events, source and dependency fingerprints, environment version, commands, test results, network and tool decisions, agent actions, timestamps, failure classification, reviewer outcome, and destruction confirmation. Do not preserve secrets or an uncontrolled copy of the workspace. Evidence should remain readable after the execution environment is gone.
zekmac M4 Remote Node
Validate Patches on a Dedicated Remote Mac
Provision an isolated remote Mac for repeatable patch testing without changing your production environment.