Feature Request: Secure Ephemeral Secrets for Codex Tasks

I would like to propose a native secrets-handling feature for the Codex app.

Today, developers often need to provide Codex with credentials such as API keys, cloud access tokens, Terraform variables, SSH credentials, database passwords, or service-account secrets. The unsafe approach is to paste them into the chat, store them in a repository, or manually create a local .env file.

Codex should provide a dedicated “Add Secret” or “Add Credential” button directly inside the task interface.

The secret value should never become part of the conversation, prompt history, repository, generated code, or normal task logs. Instead, it should be stored temporarily in an encrypted secrets store and injected into the Codex runtime only when needed.

For example:

Name: OTC_PASSWORD

Value: ************

Scope: Current task

Expiration: 2 hours

Allowed use: Terminal and Terraform

Delete after task completion: Enabled

Codex would then use the secret only through a reference such as:

$OTC_PASSWORD

or:

$env:OTC_PASSWORD

or:

TF_VAR_client_secret

The model should not need access to the raw value. It should only know that an approved secret with a specific name is available to the task runtime.

Suggested security controls

Encrypt secrets at rest and in transit.

Keep secret values outside the chat and model context.

Inject secrets directly into the task process environment.

Avoid writing plaintext .env files whenever possible.

Allow secrets to be scoped to one command, one task, one workspace, or a fixed time period.

Automatically delete secrets when the task finishes or the timer expires.

Mask secret values in terminal output, logs, generated patches, screenshots, and error messages.

Prevent accidental exposure through commands such as env, printenv, set, or Write-Host $env:SECRET.

Require explicit approval before a secret is used by a new tool, command, domain, or external service.

Show an audit trail such as:

Secret OTC_PASSWORD was injected into Terraform at 14:22.

Raw value was not displayed or stored in task output.

Allow immediate revocation from the Codex interface.

Prevent secrets from being committed to Git.

Automatically update .gitignore when temporary secret files are unavoidable.

Support organization policies, access controls, retention rules, and administrator auditing.

Example workflow

User adds credential

Credential is encrypted outside the conversation

User authorizes it for the current Codex task

Codex receives only the variable name or secret reference

The task runtime injects the value into the approved process

Outputs are automatically redacted

The credential is deleted when the task ends

This would make Codex significantly safer for real DevOps, cloud, infrastructure, automation, and production workflows.

The idea is not simply to add a password manager to Codex. It is to provide ephemeral, least-privilege secret injection for AI coding agents.

Possible feature names:

Codex Secure Runtime Secrets

Ephemeral Credentials

Task Secrets

Secure Environment Variables

This would remove one of the biggest practical risks when using coding agents with real infrastructure: developers would no longer need to paste sensitive credentials into conversations or leave them behind in local files.