Skip to content
Agentic Levels
Start hereLevelsTracksPromptsAbout
Get my levelGet my level

  • Start hereYour first useful task with AI.
  • Level quiz8 questions. No AI needed.
  • Fluency ScoreYour Level and a score, from your own AI.

  • LevelsThe 11 levels, in order.
  • LessonsShort lessons, filter by level.
  • TracksGuided paths by tool, role or goal.
  • Set up your AI tool
  • Starter packFree files that help AI remember.

  • PromptsReady prompts to copy and adapt.
  • ChatGPT vs Claude vs GeminiPick the right one for the job.
  • How-tos
  • ReferenceCommands for Claude Code, Codex, Antigravity.
  • ResourcesHand-picked reading and tools.

  • Your progress
  • Your next moveAn interview that picks your next skill.
  • Your next lessonsThe next lessons at your level.
  • Updates

  • Pricing
  • About
  • FAQ & Feedback
  • Work with us
  • How we handle your data
Sign inPreferences
AboutPricingHow-tosPromptsStarter packMy stackHow we handle your data

© 2026 Fuentes Studio

PrivacyTermsRefundsAccessibilityAI content policyCredits
yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

←Codex Fundamentals
  1. Tracks
  2. ›Codex Fundamentals: Module 3
  3. ›Approve commands by risk, and guard network and secrets
4

Level 4 · Lesson 5 of 12 · Free

Approve commands by risk, and guard network and secrets

One command, one decision, plus internet access and keys

After this, you'll be able to sort approval requests into safe, inspect first, and reject categories, decide when network access is needed, keep secrets out of prompts, and switch off any permission you granted.

Before you start

Complete Read sandbox mode before approving first.

The idea

Approval is a risk decision, not a mood. Codex asks because the command crosses a boundary. Not because the command is bad.

Worked example

Before and after

Before: Turn on full internet, approve everything for this session, and here is my shipping API key to test checkout (everything open, key in the chat). After: Plan network access for this task. We only need to install packages and read the shipping provider's docs, so ask me before each network command and leave network_access off. Use the key already in my local setup, and check the diff and the output for it.

What the AI might say

Internet is needed for two things: installing packages and reading the provider's docs. On your computer Codex asks before each command that reaches the internet, so I'd approve each one once and leave network_access off. I won't print or copy the key.

Why it works

The After limited access to what the task needs and kept the secret out of the prompt. It also asked for a leak check, and each yes covers one command.

Risk LadderRead from goal to proof so Approve commands by risk stays inspectable.
  1. 1
    GoalAfter this, you'll be able to sort approval requests into safe, inspect first, and
  2. 2
    InputsLow risk stays inside the workspace and proof loop
  3. 3
    Approve commands by riskEach request is classified by what it can affect
  4. 4
    ReviewMedium-risk requests ask for explanation or narrow approval
  5. 5
    ProofClassify three approval prompts and choose the narrowest useful response for each

Low risk means reading local state or running a known test. Medium risk means installing a dependency, hitting the network, or touching a pile of generated files (files a tool writes for you). High risk means auth, billing, production data, deployment (publishing to the live site), secrets, destructive Git history (erasing the saved record of past commits), or anything outside the workspace.

Ask Codex to explain before medium or high risk. A real answer names why the command is needed and what it changes. A vague one means you reject it and ask Codex for a safer plan.

Three tiers, one rule each. Approve once by default. Approve for the session when you'll see the same prompt again soon, or add it to the allow list when you want it to skip the prompt for good.

That writes a persistent rule matched by prefix, so any command starting with the same words gets approved from then on, not just a session-only pass. Ask Codex Where is my allow list stored, and what is in it? to see what you have saved.

OpenAI's docs say the terminal version saves these rules in a rules file inside the .codex folder in your home folder. They don't say where the app shows the choice or a remove button.

Every permission needs a way back. To undo a rule you added by mistake, ask Codex: Show me the allow-list rules you saved and remove the one for [the command]. Then restart Codex, ask What is in my allow list now? and check the rule is gone. A session approval ends when you close the chat.

Network access is its own risk. A local test and a command that reaches the internet aren't the same risk, even when both feel routine. On your computer, Codex keeps the internet off for its commands by default inside workspace-write.

In Auto, Codex asks before any command that reaches the internet.

Approving usually lets that one command run outside the sandbox, so read what else it could do before you say yes, and approve that one command once. Change the network_access setting in the settings file only for a task with many such commands, then quit and reopen Codex, and turn it off the same way afterwards. Web search is separate, and its default setting is cached, which means saved results.

Why narrow beats open. A stray web page, package script, or issue comment can carry hostile instructions.

That trick is called prompt injection: text written to make Codex do something you didn't ask. Treat anything Codex reads online as untrusted.

In the cloud, choose the narrowest option. A cloud environment's Networks section offers public internet, package manager domains only, or extra allowed domains (a domain is a website address like npmjs.org).

Pick the package domains or your own short list. OpenAI's page doesn't restate the default, so open the section and check it. Cloud needs an eligible paid plan.

Secrets get the same discipline. A secret is a key or password a project needs.

Never paste one into a prompt, because a chat can be saved, shared, or copied into a file. Keep keys in a password manager (an app like 1Password that stores them safely), in a local .env file (a plain file on your computer that holds a project's keys), or in your cloud environment's secrets.

Ask Codex How do I store this key so it never enters the chat? before you do anything. Saving an HTTP secret (a password for one website address) in a cloud environment also allows access to its domains, so add only the ones you mean. Your own Codex sign-in file, auth.json, is a secret too.

If a key leaked, act in this order. A leak means the key appeared in a chat, a file you committed, or any output.

Don't commit that change, and ask Codex to undo it. Then revoke the key at the provider (the service that issued it), make a new one, and tell the person who owns the account so they can check its use.

A key that has appeared anywhere is spent.

Auto-review is a documented option, not the default. With Auto-review, a reviewer step looks at approval requests instead of you.

Each request shows as Reviewing, Approved, Denied, Aborted, or Timed out. You switch it on with approvals_reviewer set to auto_review in your settings file, and the default is user, meaning you.

Start with the default. If you try Auto-review, read the Denied and Timed out items, and keep deciding the high-risk ones yourself. To switch it off, set approvals_reviewer back to user and restart Codex.

In Claude Code and Antigravity: Claude Code and Antigravity both let you write Allow, Ask, and Deny rules, and a Deny rule wins over the others. Each tool has its own network and secret settings, so check its own guide. The habit is the same in all three: never paste a key into a prompt.

Let Codex reach only what the task needs, only for as long as it needs it. The goal is not to block Codex. It is to make every boundary crossing visible.

Try it (17 min)

Paste this into Codex

Part 1. Classify these Codex approval requests:

Commands or actions (no real prompts yet? Use these three examples. You're only classifying them, so don't run them: `npm test -- profile`, `npm install date-picker`, `rm -rf public/uploads`):
1. [paste request]
2. [paste request]
3. [paste request]

For each, choose:
- approve once
- approve for session
- ask for explanation
- reject

Give the reason and the follow-up proof you need.

Part 2. Decide network and secret access for this task:

Task: [describe task. No task? Use: update my shop's shipping rates from the carrier's public page.]
Needs package install: [yes/no/unknown]
Needs docs or web: [yes/no/unknown]
Needs a key or password: [yes/no/unknown]
Where it runs: [local, cloud]

Return:
1. Whether network access is needed, and how to switch it back off afterward.
2. Which domains to allow if it is (a cloud environment only; on your own computer network is on or off).
3. How the key should be supplied without pasting it into the prompt.
4. What proof confirms no secret was exposed, and what I do if one was.

What a good response looks like

Part 1. npm test -- profile: approve once, it only runs a local check, and I need to see it pass. npm install date-picker: ask for explanation, it uses the internet and changes the package list, then approve once if the change is expected. rm -rf public/uploads: reject, it deletes a whole folder with no undo and is outside the task. Part 2. Network: needed only to read the carrier's public rates page, so approve that one network command once and nothing else. Limiting access to one site is possible only in a cloud environment's Networks section. Key: the carrier login stays in my password manager, never pasted in chat. Proof: search the diff and the output for any part of the key. If any shows up, do not commit. Revoke that key at the carrier, make a new one, and tell the account owner.

Check yours against

  • Each request is classified by what it can affect
  • Medium-risk requests ask for explanation or narrow approval
  • High-risk requests are rejected or escalated
  • Network is enabled only when the task needs it, with a way to switch it off
  • Secrets are not pasted into the prompt, and a leak plan names revoking the key at the provider
  • Approving based on command length instead of effect.
  • Treating test commands and install commands as the same risk.
  • Letting Codex delete files without naming the recovery path (how you would get the files back).
  • Approving broad session access because you want the run to move faster.
  • Turning on unrestricted internet because one dependency failed, and leaving it on.
  • Letting Codex follow instructions from an issue, README, or web page without treating them as untrusted.
  • Pasting a key into the chat so the task can move faster.

When this breaks

  • Breaks when a command is technically familiar but dangerous in this repo.
  • Breaks when a session-level approval or an allow rule lets later commands exceed the original reason and nobody removes it.
  • Breaks when a key appears in a chat, output, or committed file because secret handling was not planned, and the old key stays live.

AI can help with this

Use Codex to help you sort approval requests into safe, inspect first, and reject categories, decide when network access is needed, keep secrets out of prompts, and switch off any permission you granted. Start with the exercise prompt and your real input. Ask for one draft, then check it against this proof: Each request is classified by what it can affect. Accept only the version you can verify yourself.

You can now

✓

You can classify read, write, network, and destructive actions

  • ✓You can request a better explanation
  • ✓You can choose approve once by default
  • ✓You can decide whether network access is needed, and switch it off after
  • ✓You can keep secrets out of prompts and say what to do if a key leaked

Try it from memory

Pulling this out of your own head now is the part that actually moves it into long-term memory. Re-reading only feels like it does.

Pick three things Codex could ask to do in your own project. Sort them from low to high risk and say what you'd check before saying yes to the riskiest. Then say what you'd do about any password the task needs.

One good answer: 'Choir ticket site. Read the show list: low. Fetch the venue's seat map from the web: medium, it goes online. Change where ticket payments go: high, it touches billing. Before yes, I'd ask what it changes and how to undo it. The venue login stays in my password manager.' Check yours: sign-ins, payments, passwords or keys, and live customer data are high. So are publishing, erasing the project's saved history of changes, and touching files outside the project folder.

Key takeaways

Approve the effect, not the command name, and grant the smallest network and secret access that finishes the task. Every permission you give needs a way to take it back.

  1. 1Low risk stays inside the workspace and proof loop.
  2. 2Network, install, and broad writes need more inspection.
  3. 3Auth, billing, secrets, production data, and destructive git actions are high risk.
  4. 4Network is off by default on your computer. Turn it on for one task, then off.
  5. 5A secret is never pasted into a prompt. If one leaks, revoke it at the provider and tell the owner.
  6. 6Auto-review is an option you can try and switch off. The default is you.

Go deeper

  • Codex agent approvals and securitylearn.chatgpt.com (opens in a new tab) ↗
  • Codex cloud environmentslearn.chatgpt.com (opens in a new tab) ↗
  • Codex config referencedevelopers.openai.com (opens in a new tab) ↗
Up nextRun the proof loop→

Was this helpful?

Related lessons

Use an orchestrator to keep the team from driftingTrust No Tool ResponseKeep private work private
← Back to Codex Fundamentals