@cratis/pi 7.172.2 → 7.172.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -399,15 +399,15 @@ arguments are operands. A lone `-` is a stdin operand. Value-free short flags ma
|
|
|
399
399
|
| `wc` | `-l -w -c -m` |
|
|
400
400
|
| `ls` | `-l -a -A -1 -h -d -R -t -r -F` |
|
|
401
401
|
| `df` | `-h` |
|
|
402
|
-
| `rg` | `-n -l -i`, `--files`; literal `--glob`/`-g` filters |
|
|
402
|
+
| `rg` | `-n -l -i`, `--files`; literal `--glob`/`-g` filters; with an explicit `--no-config` option only: `-A N -B N -C N -m N` (digits), `-t NAME -T NAME` (alphanumeric), `-S -o -s -I -N` (also in short-flag groups). No `--hidden`, `--no-ignore` or `--iglob` |
|
|
403
403
|
| `grep`, `egrep`, `fgrep` | `-n -i -r -R -l -L -c -v -w -x -F -E -H -h -o -q -s`; `-e PATTERN`, `-A N`, `-B N`, `-C N`; `--include=PATTERN`, `--exclude=PATTERN` or a separate literal pattern value; a search pattern is still required |
|
|
404
404
|
| `echo` | `-n -e -E` |
|
|
405
405
|
| `printf`, `test`, `[`, `true`, `false`, `pwd` | None (in particular, no `printf -v`) |
|
|
406
406
|
| `git status` | `-s -b --short --porcelain` |
|
|
407
|
-
| `git diff` | `--stat --numstat --name-only --name-status --cached --staged --check -p -U<N> --no-color
|
|
407
|
+
| `git diff` | `--stat --numstat --name-only --name-status --cached --staged --check -p -U<N> --no-color`; extra presentation flags remain refused (see #1255 below) |
|
|
408
408
|
| `git log` | `--oneline --stat --name-only -n N -nN -<N> -p --no-color --format=<fmt> --pretty=<fmt> --follow` |
|
|
409
409
|
| `git show` | `--stat --name-only -p --no-color --format=<fmt>` |
|
|
410
|
-
| `git add` | `-A -u -p -v --all
|
|
410
|
+
| `git add` | `-A -u -p -v --all`; literal named paths, including corpus files, and path globs for installed prompts. No `-f` or `-N`/`--intent-to-add` |
|
|
411
411
|
| `git commit` | `-m MSG`, `--message MSG`, `-mMSG`, `-a`, `-q`; `-F FILE` only for a literal non-protected file; no `--no-verify` |
|
|
412
412
|
| `git blame`, `ls-files`, `rev-parse`, `check-ignore`, `grep` | None |
|
|
413
413
|
| `git branch` | Exactly `--show-current`, or `--list` followed only by literal patterns |
|
|
@@ -416,6 +416,38 @@ arguments are operands. A lone `-` is a stdin operand. Value-free short flags ma
|
|
|
416
416
|
| `rsync` | `-a -r -v -n -u -z -t -p`; `--archive --recursive --verbose --dry-run --update --compress --times --perms` |
|
|
417
417
|
| `install` | `-c -v -C -p`; `-d` directory operands; `-m MODE`/`-mMODE` (three or four octal digits); the same target-directory forms as `cp` |
|
|
418
418
|
|
|
419
|
+
### Read-only admissions and deliberate refusals (#1255)
|
|
420
|
+
|
|
421
|
+
| Case | Decision | Reason | Workaround |
|
|
422
|
+
| --- | --- | --- | --- |
|
|
423
|
+
| 1: extra `git diff` flags | Refused, unchanged | Any `git diff`, including the forms already accepted, can run `diff.external`, `.gitattributes` textconv or the pager, and these flags do not prevent that (reproduced with `-w` and `--shortstat -p`). Keeping them refused limits what is newly accepted; it does not remove that risk. Re-admission needs guard-enforced sanitized configuration, tracked separately. | Use the existing exact option list above. |
|
|
424
|
+
| 1: extra `rg` flags | Narrow admission | Only the numeric context/count, alphanumeric type and short display flags listed above qualify, and only with an actual `--no-config` option disabling environment-selected configuration. A value or operand spelling `--no-config` does not qualify. Hidden/ignored-file expansion and all other new options stay refused. | Add `--no-config`, for example `rg --no-config -n -C 2 'a]*b' .cratis`. |
|
|
425
|
+
| 2: corpus script execution | Named allowlist, unchanged | The two exact entries below are already accepted; other scripts and `cd X && node …` remain refused because a script or another checkout's copy can write protected paths. | Run the exact named invocation from the current checkout without a `cd` prefix. |
|
|
426
|
+
| 3: scratch heredoc mentioning a protected path | Refused, unchanged | The whole command includes its body even when the destination is unprotected; that file could later be executed or sourced. Quoted/unquoted delimiters and append redirects are not exemptions. Stdout-only `cat <<'EOF'` remains accepted. | Use the Write tool for scratch files containing protected text. |
|
|
427
|
+
| 4: glob-like searches and file/test filters | Quoted search patterns and `ls -d Arc*` already accepted; wildcard test filter refused | `rg 'a]*b' .cratis` and `rg -n '^[a-z-]*' Source` (also with `\| sort`) treat the quoted pattern as data; path operands stay checked. `Foo*` can intersect `*.env`, and `dotnet test` compiles, executes code and writes bin/obj: it is not a read-only verb when a protected reference exists. | Use `dotnet test --filter 'FullyQualifiedName~Foo'` or `--filter 'ClassName=…'`; `~` is already a contains-match. With no protected reference the ordinary policy allows it, not a dotnet exemption. |
|
|
428
|
+
| 5: `git add` a named corpus file | Accepted, unchanged | Staging changes the index, not the working-tree content. The Write/Edit guard still protects that content. Chained content writes, `-f`, `-N`, status-variable and push chains remain refused. | Use `git add -- .cratis/ai/skills/s/SKILL.md` with the exact allowed options. |
|
|
429
|
+
|
|
430
|
+
These options were refused before #1255. This is a closed allowlist, not an admission
|
|
431
|
+
of arbitrary presentation options: `--pre`, `-f`, `--hostname-bin`, `--type-add`, `-z`,
|
|
432
|
+
unknown options and invalid values remain refused. Output redirects to protected paths
|
|
433
|
+
and pipelines to writers remain refused too. The existing protected-reference scan and
|
|
434
|
+
lexer are unchanged; the guard remains best-effort, not a sandbox.
|
|
435
|
+
|
|
436
|
+
#### Named scripts
|
|
437
|
+
|
|
438
|
+
Only these exact interpreter/path pairs qualify, with no `./`, variable, glob or
|
|
439
|
+
alternate spelling and no preceding directory change:
|
|
440
|
+
|
|
441
|
+
- `node .cratis/ai/hooks/scripts/cratis-check-pr.mjs`: `--strict`, and value options
|
|
442
|
+
`--body-file`, `--label`, `--add-label`, `--remove-label`, `--pr`, `--base`, `--repo`.
|
|
443
|
+
Values must be nonempty literal words, not start with `-`, and not be globbed.
|
|
444
|
+
- `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`: `--dry-run`, `--quiet`,
|
|
445
|
+
`--no-fetch` only.
|
|
446
|
+
|
|
447
|
+
This is not permission to run arbitrary corpus scripts: `cratis-check-handoff.mjs`
|
|
448
|
+
and all other scripts remain refused. Redirect destinations and chained commands
|
|
449
|
+
are still checked separately.
|
|
450
|
+
|
|
419
451
|
The only global Git option exemption is a single separate `-C <dir>` with a literal,
|
|
420
452
|
non-empty directory word not starting with `-`, followed by exactly one of these tails:
|
|
421
453
|
`status --short`, `rev-parse HEAD`, `branch --show-current`, or `tag --list <pattern>`.
|
|
@@ -426,6 +458,19 @@ all other global options (`-c`, `--git-dir`, `--work-tree`, `--no-pager`, `--exe
|
|
|
426
458
|
remain denied. `-C` gives **no protection** from a hostile repository's configuration:
|
|
427
459
|
fsmonitor, hooks, pager and diff/textconv helpers can still run. This is a syntax filter,
|
|
428
460
|
not a repository sandbox.
|
|
461
|
+
|
|
462
|
+
Known limitations of the same kind (both need control of the local environment or Git
|
|
463
|
+
configuration, which the guard cannot see):
|
|
464
|
+
|
|
465
|
+
- Plain `rg` forms that were already accepted (`-n`, `-l`, `-i`, `--files`) do not require
|
|
466
|
+
`--no-config`, so a `RIPGREP_CONFIG_PATH` set in the environment can add options such as
|
|
467
|
+
`--pre`. Only the flags admitted for #1255 require a literal `--no-config`; requiring it for
|
|
468
|
+
every `rg` would refuse the most common read-only searches.
|
|
469
|
+
- Already accepted `git diff` forms (for example `-p` or `-U2`) run an inherited
|
|
470
|
+
`GIT_EXTERNAL_DIFF` program. Controlling the environment already implies code execution,
|
|
471
|
+
so the guard does not try to detect it.
|
|
472
|
+
- `git add <file>` runs any `filter.<name>.clean` driver defined in Git configuration for a
|
|
473
|
+
path that `.gitattributes` assigns to that filter.
|
|
429
474
|
Git format values containing `%(` are not accepted. Index/commit operations are deliberate
|
|
430
475
|
allowances, not general shell execution permission. Output-to-file options such as
|
|
431
476
|
`git diff --output=...` are never exempt, even with a non-protected destination on a line
|
|
@@ -275,10 +275,10 @@ function short_flags(w, flags, k) {
|
|
|
275
275
|
return 1
|
|
276
276
|
}
|
|
277
277
|
function number(s) { return s ~ /^[+-]?[0-9]+$/ }
|
|
278
|
-
function options_allowed(verb, first, i, w, filters, patterns, ended) {
|
|
278
|
+
function options_allowed(verb, first, i, w, filters, patterns, ended, rg_new, no_config) {
|
|
279
279
|
for (i = first; i <= argc; i++) {
|
|
280
280
|
w = W[i]
|
|
281
|
-
if (!ended && w == "--") { if (verb !~ /^(sort|uniq)$/) return
|
|
281
|
+
if (!ended && w == "--") { if (verb !~ /^(sort|uniq)$/) return !rg_new || no_config; ended = 1; continue }
|
|
282
282
|
if (ended || w !~ /^-/ || w == "-") {
|
|
283
283
|
# Admit sort/uniq only as stdin filters. File operands, including after
|
|
284
284
|
# --, retain whole-command classification and every existing refusal.
|
|
@@ -306,6 +306,20 @@ function options_allowed(verb, first, i, w, filters, patterns, ended) {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
if (verb == "git diff" && w ~ /^-U[0-9]+$/) continue
|
|
309
|
+
# New rg display/filter flags require an actual option, never a pattern or option value,
|
|
310
|
+
# disabling config-supplied helpers. Hidden/ignored-file expansion stays refused.
|
|
311
|
+
if (verb == "rg") {
|
|
312
|
+
if (w == "--no-config") { no_config = 1; continue }
|
|
313
|
+
if (w == "-A" || w == "-B" || w == "-C" || w == "-m") {
|
|
314
|
+
if (++i > argc || W[i] !~ /^[0-9]+$/) return 0
|
|
315
|
+
rg_new = 1; continue
|
|
316
|
+
}
|
|
317
|
+
if (w == "-t" || w == "-T") {
|
|
318
|
+
if (++i > argc || globbed[i] || W[i] !~ /^[A-Za-z0-9]+$/) return 0
|
|
319
|
+
rg_new = 1; continue
|
|
320
|
+
}
|
|
321
|
+
if (short_flags(w, "nliSosIN") && !short_flags(w, short_options[verb])) { rg_new = 1; continue }
|
|
322
|
+
}
|
|
309
323
|
if (verb == "shellcheck" && w ~ /^--severity=(error|warning|info|style)$/) continue
|
|
310
324
|
if ((verb == "git log" && w ~ /^--(format|pretty)=/) || (verb == "git show" && w ~ /^--format=/)) {
|
|
311
325
|
if (index(w, "%(")) return 0
|
|
@@ -327,7 +341,7 @@ function options_allowed(verb, first, i, w, filters, patterns, ended) {
|
|
|
327
341
|
}
|
|
328
342
|
if (!short_flags(w, short_options[verb])) return 0
|
|
329
343
|
}
|
|
330
|
-
return !filters || patterns > 0
|
|
344
|
+
return (!filters || patterns > 0) && (!rg_new || no_config)
|
|
331
345
|
}
|
|
332
346
|
# awk is read-only only for the shape awk [-F sep] 'program' operands. Every other option (-f, -v, -e, -i,
|
|
333
347
|
# --include, --, ...) is refused. awk output, execution and file reads need one of > | system getline close
|