Commit Graph
3 Commits
Author SHA1 Message Date
Devika Verma 038e37a7fe fix(permissions): git commands run under the grant only when the project's git settings are inert (OPE-232)
Git obeys settings stored inside the project, and some of them name programs
that reading commands then run, or point git at files and history elsewhere.
Before the read-only grant covers a command with a git stage, the engine now
lists the settings that apply in the folder git would use
(coworker/git_settings.py):

- every project-level setting must be on a short list known to be inert;
  the person's own global and system settings are trusted;
- the repository must lie inside the folders, or be a registered worktree of
  one that does; a folder inside a larger repository asks;
- the git folder may hold no links or junctions, objects borrowed through
  alternates must lie inside the folders, and a remote that fetches missing
  objects on demand asks;
- when the person's own settings define a diff or filter program, a project
  that carries any attributes asks (the standard Git LFS filter and the Git
  for Windows text converter are trusted);
- initialised submodules are held to the same check; a project LFS settings
  file asks;
- environment variables that make git run a program, or read attributes,
  objects or the index from elsewhere, ask.

Listing settings never runs them. actionlint leaves the list: it may start
other linters.

Tests: tests/test_readonly_git_settings.py.
2026-10-28 22:29:10 +05:30
Devika Verma d7b3f12915 fix(permissions): env and git config ask; the card's grant button follows the shell (OPE-232)
- Bare `env` asks, as `printenv` already does.
- `git config` is no longer read-only: settings can hold credentials.
- On PowerShell, a recursive Get-ChildItem piped into a cmdlet that reads the listed
  files asks; piped into Select-Object, Sort-Object or Measure-Object it still runs.
- The card offers "Allow read-only commands for this session" using the engine's shell
  kind, so on Windows it matches what the grant covers.
2026-10-28 22:29:10 +05:30
Devika Verma 6f2ef8bef0 fix(permissions): the read-only checker allows only reviewed flags (OPE-232)
Every command the read-only session grant accepts now lists the flags known
only to change what is shown or which local files are read. Any other flag,
including one nobody has reviewed, gets a card. This replaces the lists of
known-bad flags.

- Each git subcommand has its own list; branch, tag, stash, remote, config
  and reflog are accepted only in their listing and reading forms.
- Operands that write are refused (a second xxd or uniq operand, a date
  operand without `+`, an `@file` strings operand).
- sed, awk and jq programs are accepted in a conservative subset.
- Recursive walks that follow symbolic links ask.
- Added with their own lists: tree, cmp, tac, rev, fold, paste, join,
  expand, unexpand, seq, nproc, sha224sum, sha384sum, sha512sum, b2sum,
  cksum, sum.
- PowerShell has its own list of cmdlets, aliases and parameters instead of
  borrowing bash names; non-file-system provider paths ask.
- read_targets comes from the same parse, so every path an allowed flag
  carries is checked against the session's folders.
- Brace expansion and unquoted parentheses reject; `#` inside a word stays
  part of the word.

Tests: tests/test_readonly_allowlist.py. The scoping and grant fixtures now
name the bash shell, and `find -L .` now asks.
2026-10-28 22:29:10 +05:30