Skip to content

Persist approved grants per project #177

Open

Description

@hakula139

Goal

Session grants (#132) expire when the session ends. As a result, users who always allow cargo test in a project must approve it again in every new session. Config files cannot store these grants when they are read-only Nix store paths. Persist explicitly confirmed grants in a state file keyed by project root.

Acceptance criteria

  • The approval prompt offers "always allow in this project", displays the grant, and asks for confirmation before saving it.
  • Store grants in $XDG_STATE_HOME/ox/grants.toml, keyed by project root. Write the file atomically with private permissions, and never write grants to config.
  • Persisted grants join the allow tier, while explicit user-configured deny and ask rules retain precedence under Use a cheap model classifier to decide ambiguous calls in auto mode #131.
  • Persisted grants also apply to headless runs.
  • /status lists the project's persisted grants, and /grants lists them and revokes one or all of them in the TUI. Interactive REPL support is removed by Remove the interactive --no-tui REPL frontend #837.
  • Tests cover saving, loading grants in a new session, precedence under deny and ask rules, separate projects, and revocation.

Notes

Builds on session grants (#132) and the ask tier (#174), which have both landed. XdgBase::State in util/path.rs and atomic_write_private in util/fs.rs already exist for the state file.

Decision: the project root is the git root, falling back to the canonical cwd outside a repository.

Metadata

Metadata

Assignees

Labels

area: permissionenhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions