Data Report · RedactSure Research
Chris Sowa · Founder, RedactSure
Published
Last updated
What Credentials Does Codex Hold When It Runs in the Cloud?
Codex holds none of the credentials you stored as secrets, because OpenAI's cloud documentation removes those before the agent phase, and it holds every value you set as an environment variable for the whole run. Check which setting holds each credential before a cloud task reaches a repository.

A cloud coding task starts with two lists, and only one of them is usually reviewed. One list is the repository settings page, where a token or a connection string sits in one of Codex's two settings, a secret or an environment variable. The other is the environment the task inherits when it boots, which the agent phase reads from without anyone looking at it again. OpenAI's cloud documentation treats the two differently: the marked entries are available to setup scripts and removed before the agent phase, while the environment variables last for the whole chat. That single difference decides whether a value a developer meant to keep out of the model's context is sitting in it at every step.
For a developer connecting a cloud task to a repository that carries customer data, each value in the settings list is a separate exposure. A credential that stays in the environment can appear in a command output, a summary or a pull request body, and a value that appears once stays in the context for the rest of the run. A credential that leaves before the agent phase cannot. The inventory is small enough to check before the next run: which values the task holds, where each one lives, what the token behind it can reach, and what the vendor's pages leave unsaid about the repository connection itself.
Key findings
- Least privilege sizes the credentials a cloud task may use and says nothing about the content of the page it reads, so a run can pass a scope review and still hold every value the screen showed it, unless a consistent token is substituted before any model reads it (What Is Least Exposure?).
- It would also require a named person approving each action that spends a credential, and a record of what the model received on each page, since a token's scope answers neither question (How Do I Know Which Credentials a Coding Agent Has Touched?).
- OpenAI's cloud pages describe what happens to the values you store and do not describe where the token that opens the repository comes from, which is the credential a repository owner cannot see in the settings list (OpenAI, Environment, 2026).
- OpenAI's cloud environment page states that Codex secrets "are only available to setup scripts" and that they "are removed before the agent phase starts," while "Environment variables are set for the full duration of the chat (including setup scripts and the agent phase)" (OpenAI, Environment, 2026).
- Doppler, which builds configuration for Codex runs, states that it "injects the config's secrets as environment variables, and Codex inherits them," the same distinction arriving from outside OpenAI's settings page (Doppler, 2026).
- GitGuardian counted about 29 million secrets leaked on public GitHub in 2025 and quotes its chief executive saying "AI agents need local credentials to connect across systems" (GitGuardian, 2026).
Which credentials can a Codex cloud task read while it runs?
A Codex cloud task runs in a container that OpenAI builds from your repository, and the credentials it can reach are the ones the configuration puts there. The documentation describes three routes. Codex secrets you store on the environment "are only available to setup scripts," and they "are removed before the agent phase starts," while values you set as environment variables are "set for the full duration of the chat (including setup scripts and the agent phase)" (OpenAI, Environment, 2026). The connection that clones the repository is the third route, and the cloud pages reviewed do not describe the token behind it, a credential with no line of its own in the settings list (OpenAI, Environment, 2026).
The scope comes first. A governed browser environment covers what an agent reads and does on a rendered page: dashboards, consoles, settings pages and the forms on them. It does not cover the terminal, the IDE, the local filesystem, direct API calls or MCP. A cloud task that receives a database URL in its environment sits on the second route, outside a browser control. A task that opens the repository's settings page in a browser session and reads the values drawn there sits on the first route, and that is where the control described at the end of this page acts.
Take one repository settings page with two entries: a registry token stored as a secret and a database URL set as an environment variable. The setup script installs the private package with the token, the agent phase starts after the token is gone, and the agent phase runs a migration command that reads DATABASE_URL from the environment. The model reads the URL in the command output and does not read the token. Two entries on one page, two answers, and the setting rather than the sensitivity of the value decides which one the run keeps, as What Credentials Does a Coding Agent Pick Up When It Runs My Tests? records for a test run.
Why does the setting decide what the model reads?
The two settings are separate mechanisms, visible in how a run starts. Setup scripts run first and get the credentials stored as secrets; the agent phase runs after them and gets the environment. The same page states that "Setup scripts run in a separate Bash session from the agent," so an export in a setup script does not carry into the agent phase (OpenAI, Environment, 2026). Codex secrets on that page "are stored with an additional layer of encryption and are only decrypted for task execution," which protects them at rest and leaves the agent-phase question to the setting that holds them (OpenAI, Environment, 2026).
What the agent phase reads, then, is the environment. A command that prints a variable puts the value in the output the model reads, and from there it can reach a summary, a commit message or a pull request body the task writes. That route is why a value's sensitivity is the wrong question, and a value the environment holds is readable by every command an approval permits, which makes the settings list, not the prompt, the place the exposure is decided (Does Codex's Full Sandbox Escalation Expose Your Credentials?). A staging database URL in an environment variable is in the context for the whole run even though nobody would call it sensitive, and a production token that the setup script uses is gone before the agent starts.
Doppler, which builds configuration for Codex runs, describes the same split from the other side: it "injects the config's secrets as environment variables, and Codex inherits them" (Doppler, 2026). The page adds that "The agent can fetch secrets, but never change them," a rule about writes that leaves open whether the run keeps what it fetched (Doppler, 2026). For the worked record, the registry token is gone after setup and the database URL is present at every step, so the question for any value is which list it is on.
What do the vendors themselves say?
Three vendor pages bear on the title, and each documents one half of the split. OpenAI documents both settings on one page, which it marks Legacy. Doppler documents what happens when a configuration tool supplies the values. GitHub documents what its own secret settings do in a different product, Actions, and where a token's scope stops.
| Dimension | Vendor, per its documentation | What a buyer should verify |
|---|---|---|
| Where a stored credential goes | Values stored as secrets "are removed before the agent phase starts" and are "only available to setup scripts" (OpenAI, Environment, 2026) | Which setting each credential uses, and who can change it |
| What the agent phase inherits | "Environment variables are set for the full duration of the chat" (OpenAI, Environment, 2026) | Whether any value in that list is sensitive, not only the marked ones |
| What the task may do | "an approval policy that controls when it must stop and ask you before acting"; "OS-level mechanisms enforce sandbox policies" (OpenAI, Approvals, 2026) | Whether an approval covers a command that prints a value |
| Configuration supplied by a tool | Doppler "injects the config's secrets as environment variables, and Codex inherits them" (Doppler, 2026) | Whether the agent may populate or modify its own configuration |
| Token scope | Fine-grained tokens can be "limited to only access specific repositories" (GitHub, Managing, 2026) | What the repository connection can reach beyond the one repository |
| Fork behavior | Actions secrets "are not passed to the runner when a workflow is triggered from a forked repository" (GitHub, Actions, 2026) | Whether the task runs on forks or on pull requests from outside |
Two limits sit beside that table. The OpenAI page that documents the split is marked Legacy, so a newer experience is unreviewed until its own page is read (OpenAI, Environment, 2026). OpenAI's approvals page states the approval policy and the sandbox and does not describe what a model receives from an application screen, so those controls answer what the task may do and not what it holds (OpenAI, Approvals, 2026).
GitHub's pages describe GitHub's own settings and not a cloud coding task's configuration. The fork rule is a rule about a workflow triggered from a fork, and the token guidance describes scope for a personal access token, so neither answers where a value lives inside a Codex run. The vendor's account of the split is on the OpenAI page. A reader who wants a control over what the model reads has to look outside both products, which is the subject of the last section.
What can a token on the settings page reach?
The reach of a credential is a separate question from its setting. GitHub's token page says "Treat your access tokens like passwords" and that a fine-grained token can be "limited to only access specific repositories," a scope that narrows reach without recording a read (GitHub, Managing, 2026). A credential scoped to one repository and one operation is a better answer than an account-wide one, and the run still holds it for as long as the environment does.
The rest of the record is about what scope cannot do. GitHub's Actions page says secrets "are not passed to the runner when a workflow is triggered from a forked repository," a fork rule for one product and not a statement about a cloud task's own configuration (GitHub, Actions, 2026). Push protection scans "code for hardcoded secrets at the time of the push," so it catches a value written into a commit and not one that arrives through the environment (GitHub, Push, 2026). OWASP's CI/CD guidance says "Prefer using temporary credentials over static credentials" and "Avoid sharing the same set of credentials across multiple contexts" (OWASP, 2026).
The population shows it. Datadog found that "37 percent of customers who send CloudTrail logs to Datadog are using IAM users in their GitHub Actions," from a customer sample it does not describe as representative (Datadog, 2026). GitGuardian counted about 29 million secrets leaked on public GitHub in 2025, and its chief executive said "AI agents need local credentials to connect across systems" (GitGuardian, 2026). Durable credentials in automated systems are ordinary, and the ones that leak are the ones that were readable somewhere.
None of that scope answers the screen question. A token limited to one repository and one operation still reaches whatever the model read while the run held it, which is why the record of reads matters as much as the scope. A team can compare the two: the token page says what the credential may touch, and the run's own output shows what the model read.
What should a developer ask for in writing before a run?
Ask for the setting list in writing, with each value stored as a secret or set as an environment variable, and ask which of the two the agent phase can read. Ask what token opens the repository, where it is stored, and what it can reach beyond the one repository. Ask what the model receives on a rendered settings page, and whether any value on that page is replaced before the model reads it. Ask who approves a command that spends the credential, and what record shows the command and the value it used.
Then check the answers against a run. A team can open the repository's settings page and the cloud environment page side by side and count the entries in each list. The split that keeps a credential out of the agent's reach is the one Codex's cloud page describes, a deploy step outside the task that holds the value (How Do I Let a Coding Agent Deploy Without Giving It Deployment Credentials?). A team that can name the deploy step and the approver has the two places a value can be kept.
A fine-grained token settles part of this. The least-privilege answer is a token limited to specific repositories and advice to choose minimal permissions, as Do GitHub Fine-Grained Tokens Give Coding Agents Least Privilege? records, and that answer narrows what the token reaches without changing what a page shows the model. That is why Does a GitHub Fine-Grained Token Replace a Secure Agent Workspace? treats a token rule as one layer and not as the workspace.
Three answers are worth rejecting: a list that names the setting but not the agent phase's reach, a repository connection described as "handled by the app" with no token named, and a record that stops at the action without showing what the model read on the page.
What does a governed environment change?
A governed environment acts where the page is drawn. Values chosen by policy are replaced with consistent tokens before any model reads the page, so a repository settings page renders as REGISTRY_002 and DATABASE_003 and the model works the page on those tokens for the whole run. Real values resolve only at the approved destination, at the moment of an approved action, and a named person approves each payment, submission and record change. Every screen as tokens, every action and every approval is written to a record that exports to the organization's own monitoring.
For this page's question, the change is where the exposure stops. A value in a shell environment sits outside that reach, so the inventory work on the settings list stays with the team. An agent that opens a rendered settings page, a console or a dashboard reads tokens in place of the values, for the whole run. The control is model agnostic and works with any model, so a change of model does not change what the page shows, and the substitution is enforced outside the model where integrated rather than by an instruction in a prompt. Coverage is the applications that render in the governed environment and the supported workflows a team connects, and it stops at that boundary.
The record is what makes an inventory defensible. A team that can show, per run, which tokens the model read, which action a named person approved and where the real value resolved has an answer to the question a reviewer asks after a leak: what did the agent hold, and for how long. The comparison at RedactSure vs OpenAI Codex: 2026 Comparison & Alternative sets that design against the sandbox and approval model on this page.
What the record shows
The control that answers the title sits before the model, not in the settings list: a value on a rendered page is replaced with a consistent token, the real value resolves only at an approved destination, a named person approves the action, and the record shows what the model read. Against that, the inventory is short. A credential stored as a secret is available to setup scripts and removed before the agent phase; a value set as an environment variable is there for the whole chat; and the token that opens the repository is not described on the pages reviewed, which leaves a developer to ask for it. The rest is about scope: a fine-grained token narrows reach, push protection catches a hardcoded value, and neither records a read. To test it, open one repository's settings page next to the cloud environment settings, mark each credential stored as a secret or set as an environment variable, and compare that list with what the run's own output shows the model read.
Methodology and limitations
This page rests on OpenAI's cloud environment documentation and its approvals page, Doppler's page for running Codex, three GitHub documentation pages, OWASP's CI/CD risk guidance, a Datadog report and a press release reporting GitGuardian's 2026 count, plus existing RedactSure research pages. Vendor pages were read between October 20, 2026 and November 2, 2026, and each Sources line carries the date for its page. Public documentation read in full gives a sound view of where each product applies its control, and these pages are specific about the two settings.
No product on this page was tested for it, and "not described" means the pages reviewed and not a claim about what a vendor does. Vendor features change, and the page carries its date. RedactSure is deploying now with enterprise and government customers. The example describes a record type, one repository settings page with two entries, and not an organization. Determinations about whether a workflow meets a contractual, audit or regulatory requirement belong to counsel, assessors and the organization's own security and compliance officers. Nothing here replaces a pilot of one workflow on the organization's own screens.
Frequently asked questions
What credentials does Codex hold when it runs in the cloud?
It holds the values you set as environment variables for the whole run, and it holds none of the values you stored as secrets once the agent phase starts. Codex's cloud documentation removes those after the setup scripts and before the agent runs, and it says nothing about the token that opens the repository. The practical list is the environment page plus whatever the repository connection uses. Read the two lists together before the next task.
What does the model read from a repository settings page during a cloud task?
It reads whatever the page renders, which for a settings page means the values the page displays and any value a command prints into the output. A database URL set as an environment variable can appear in a migration log the model reads; a token removed before the agent phase cannot. Nothing on that settings page tells the model which values a policy would have replaced. Compare a rendered page with the settings list to see the difference.
Can an environment variable end up in what the model reads?
Yes, whenever a command prints it, and a cloud task runs many commands. The documentation keeps environment variables for the full duration of the chat, including the agent phase, so any command the agent runs can read them and any output the model reads carries them. The transcript, the summary and any pull request body the task writes are the places to look. A value that appears once stays for the rest of the run.
Who approves a command that uses a credential?
Codex's documentation describes "an approval policy that controls when it must stop and ask you before acting" and states that "OS-level mechanisms enforce sandbox policies." That approval covers the command and not the value it reads: a person who approves a migration does not thereby approve the database URL the command prints. A named approver for the action and a rule about what the model may read are two separate controls, and most teams have only the first.
What record shows which credential a run used?
The cloud pages describe the sandbox, the approval policy and the environment, and none of them describes a per-run record of which credential the model read or which command printed it. GitHub's token page says what a token may reach and does not record a read. A team that needs that answer keeps the run's own output next to the settings list. Without both, the record shows what the task was allowed to do, not what it held.
What should a team check before a cloud task runs?
Compare two lists and ask one question. Open the repository settings page and the cloud environment page, mark each credential stored as a secret or set as an environment variable, and ask which of the two the agent phase can read in this vendor's implementation. Then check the run's output for the values you expected to be absent. The check takes one task, one test credential and one review, and it repeats after each release.
How RedactSure Keeps a Cloud Task's Credentials Out of the Model
An environment variable set for convenience sits in the run for its whole duration, and the setting that removes a credential stops at the setup script. OpenAI's page removes a stored credential before the agent phase and leaves the environment variable in place.
The environment that enforces this is built by RedactSure, an AI agent controls, governance and data protection company.
Before: the task opens the repository settings page and reads the registry token as the page draws it, so the value enters the model's context. Inside: the page renders REGISTRY_002, the model works the page on that token, and the real token resolves only at the approved destination when a named person approves the push.
RedactSure is deploying now with enterprise and government customers.
Everyone else controls where data can go. RedactSure controls what the AI can see.
See it on your own workflow
A credential the run keeps for its whole duration is the one a transcript will show. Bring one cloud task and one repository setting and see, with test values, the page as the model receives it, the approval, and the record. Book a demo