Exec approval rules are persisted globally by default (should be repo-local by default)

Resolved 💬 3 comments Opened Mar 29, 2026 by rebroad Closed May 16, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

Exec-policy approval rules are currently easy to persist globally (~/.codex/rules/default.rules) without users realizing the scope impact. This is a security footgun.

Problems

  1. Rule persistence scope is effectively global unless explicitly handled otherwise.
  2. Approval UX does not clearly communicate where the approved prefix rule will be written before user approval.

Proposal

  1. Add config for rule write scope with secure default:
  • exec_policy_rule_write_scope = "project" | "global"
  • Default: "project" (repo-local)
  1. In approval prompt UI, show destination file path before approval:
  • Example: Will save rule to: /repo/.codex/rules/default.rules
  1. If scope is global, show explicit warning-style label:
  • Scope: global (applies across repositories)
  1. Keep post-approval confirmation with exact destination path.

Expected behavior

  • New approvals default to repo-local persistence.
  • Global persistence is explicit opt-in.
  • Users can make informed approval decisions based on visible scope/path.

Rationale

This reduces accidental over-broad trust and makes security implications clear at decision time.

Related issues / distinction

  • Related: #15751 (per-profile rule toggling).
  • Overlap: both involve the pain of rules applying globally.
  • Distinction (this issue): this requests changing where newly approved rules are persisted by default (repo-local vs global) and improving approval-time disclosure of the destination path.
  • Distinction: that issue requests runtime/profile-level control over rule application after rules already exist.

If maintainers prefer, these can be merged into a single umbrella issue; this one focuses specifically on safer default persistence + clear UX disclosure.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #15751

Powered by Codex Action

etraut-openai contributor · 3 months ago

This feature hasn't received enough upvotes, so closing.

sandipb · 1 month ago

This is a really scary gap. I always thought approvals will be stored at repo level.

I have a personal repo where I have a task(Taskfile) which is ok to be run without approval because the side-effects are not harmful. So when working in that repo I allowed that approval to be persisted. In a different repo, Codex ran that task without any permission prompt. Weirdly that task didn't even exist in that repo. When I asked Codex why it ran that command, and whether it is listed as a possible task in repo docs, it said something like "I found out in global approval rules. So I thought it is available here".

<img width="2918" height="408" alt="Image" src="https://github.com/user-attachments/assets/c48f4481-bedd-46cd-8867-4d091fd51c1e" />