Back to Checks
Prowlerprowler-provider-chatgpt
Codex cloud environments do not store credentials in environment variables
codex_environment_no_secrets_in_env_vars
Service: codexSeverity: high
OfficialVerifiedPrivate
Categories:gen-aisecrets
Resource Type:OpenAICodexEnvironment
Each Codex cloud environment is checked for environment variables whose name or value looks like a credential (tokens, passwords, API and private keys, URLs with a password).
Risk
Codex keeps environment variables set while the agent runs, unlike secrets, which are removed before it starts. A credential in an environment variable can be read or leaked by the agent, including through prompt injection from repository content.
Run this check with Prowler
Run in Prowler CloudRun
prowler chatgpt --checks codex_environment_no_secrets_in_env_varsRecommendation
Move the credential to a Codex environment secret, used only by the setup script, and rotate it.
Check Code
from prowler.lib.check.models import Check
from prowler_provider_chatgpt.check_report import finding
from prowler_provider_chatgpt.services.codex.codex_client import codex_client
class codex_environment_no_secrets_in_env_vars(Check):
def execute(self):
findings = []
for env in codex_client.environments or []:
names = env["secret_env_vars"]
if names:
text = (
f"Codex environment {env['name']} stores credentials as environment variables, "
f"readable by the agent: {', '.join(names)}."
)
else:
text = f"Codex environment {env['name']} has no environment variables that look like credentials."
findings.append(finding(self.metadata(), env, not names, text))
return findings