Skip to content

Scoped profiles: fix-it denials, inspect --grants, ask before and during a run, temp: and --sealed - #74

Merged
rmichaelthomas merged 7 commits into
mainfrom
scoped-profiles
Nov 15, 2026
Merged

rmichaelthomas merged 7 commits into
mainfrom
scoped-profiles

Conversation

@rmichaelthomas

Copy link
Copy Markdown
Owner

Summary

Implements docs/design-scoped-profiles.md in its build order. A person writing a quick script no longer needs to learn permission flags, and a running program still cannot widen its own access.

  1. Fix-it denials. Clock, environment, command, HTTP and socket denials name the guion.toml line and the run flag that would allow them. run --json carries diagnostic.grant and a denials array. Error codes are unchanged.
  2. guion inspect --grants [--json]. Compares what the reachable code needs with what guion.toml grants. Targets computed at run time are reported as known only while running.
  3. Question before a run. Asked only when a person is at a terminal. The answer is read from /dev/tty, never stdin. Skipped when CI or GUION_NO_PROMPT is set, or with --no-prompt, --json, --sealed, --replay, or guion test. [a] edits guion.toml in place with toml_edit, keeping comments and order.
  4. temp: and --sealed. Each run and test gets a private folder under TMPDIR, removed afterwards (--keep-temp keeps it). --sealed runs with no file access and none of the project's grants.
  5. Question during a run. Targets only known at run time are asked about by name, serialized, once per target. Recordings list grants that came from a question. guion repl follows the same rules, and a yes lasts the session.

Decisions worth a look

  • A "no" to the first question means nothing more is asked that run.
  • guion repl previously put permission flags after the file name, where run read them as program arguments. Fixed, since session grants depend on it (noted in the CHANGELOG).
  • .. path escapes get a message but no structured grant.

Not verified

  • The Windows CONIN$ answer path has not been compiled or run on Windows.
  • The pty tests use script. They pass on macOS, and the Linux form has not been run.

Testing

Full workspace test run passed locally (98 test binaries) and cargo clippy --workspace --all-targets -D warnings is clean. 27 new tests are in crates/cli/tests/grants.rs.

🤖 Generated with Claude Code

rmichaelthomas and others added 7 commits November 15, 2026 11:53
…json grants

Every missing-grant denial (clock, environment, command, HTTP, sockets, absolute file paths)
names the guion.toml line and the run flag that would allow it. guion run --json carries
diagnostic.grant (table, key, value, flag) and a denials array that also lists denials a
program handled itself. HostPolicy gains an optional GrantAsker for the later questions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reads literal hosts, commands, sockets and environment names from entry-reachable code,
compares them with guion.toml, and lists each missing grant as table, key, value and flag.
Computed targets are reported as known only while running.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…toml in place

guion run puts one plain question about the missing grants it can see in the code, answered
from the terminal itself (never stdin), skipped under CI, GUION_NO_PROMPT, --no-prompt, --json,
replays and without a terminal. [a] adds the exact entries to guion.toml with toml_edit,
keeping comments and order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
guion run and guion test give each run a fresh owner-only folder under TMPDIR, reached as
temp:name; it never falls through to the project folder and is removed when the run ends,
including after a failure (--keep-temp keeps it). --sealed runs with no file access and none
of the project's grants.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…stion-given grants

When a person is present, a denied effect whose target is computed (a host read from a file,
a command from arguments) pauses and asks about that exact target; questions are serialized and
a target is asked once. A no to the first question means nothing more is asked that run. A
recording's header lists the grants that came from a question; run --json reports them too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ion flags now reach the run

Each repl entry is a separate run, so an allowed grant is passed to later entries as a run flag.
Repl options were placed after the file name, where run treats them as program arguments; they
now come before it. RuntimeError boxes its grant hint to stay small.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…gelog; design marked built

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@rmichaelthomas
rmichaelthomas merged commit f380600 into main Nov 15, 2026
4 checks passed
@rmichaelthomas
rmichaelthomas deleted the scoped-profiles branch November 15, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant