Skip to content

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

Closed

Description

@rebroad

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)
  2. In approval prompt UI, show destination file path before approval:
    • Example: Will save rule to: /repo/.codex/rules/default.rules
  3. If scope is global, show explicit warning-style label:
    • Scope: global (applies across repositories)
  4. 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: feature: Per-profile exec policy rule toggling #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.

Activity

  1. added
    enhancement
    CLI
    sandbox
    on Mar 29, 2026
  2. github-actions commented on Mar 29, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. changed the title [-]Default exec-policy approval rules to project-local scope, and surface write target in approval UX[/-] [+]Exec approval rules are persisted globally by default (should be repo-local by default)[/+] on Mar 29, 2026
  4. removed
    CLI
    on Mar 29, 2026
  5. etraut-openai commented on May 16, 2026

    @etraut-openai
    Contributor

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

  6. sandipb commented on Jul 16, 2026

    @sandipb

    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".

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions