Commit Graph
4 Commits
Author SHA1 Message Date
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
Shakti Prasad Mohapatra 300a0e4da5 fix(security): scope find's global options so -L/-H/-P cannot bypass the read grant
find's global options (-L/-H/-P, -D, -O, and the BSD -E/-X/-d/-s/-x) precede the
starting points, but _stage_targets treated every leading dash token as the start
of find's predicates and returned no read targets. With none, the session grant's
root check in permissions.py passed vacuously: 'find -L /etc -name shadow' and
'find -H ~/.ssh -type f' auto-ran under 'read-only command (session grant)' while
the unprefixed forms correctly asked for approval. That is exactly the escape
OPE-130 was created to close.

Parse find's global options ahead of the path list (-D consumes its debugopts
value; -f names the starting point itself), then collect starting points until
the first predicate. The unprefixed behavior is unchanged.

Tests: read_targets now names the starting point for prefixed forms; the session
grant asks for the out-of-root prefixed reads and still auto-runs them inside
the root.
2026-10-12 00:19:10 +05:30
Harneet Singh 07d948b46f security: reject shell variable expansion in readonly grants 2026-08-26 11:00:38 -04:00
Devika Verma 5cbd3249d2 OPE-130: scope read-only session grants to the session's folders 2026-08-22 09:16:01 +05:30