@cratis/pi 7.170.1 → 7.170.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.
@@ -34,6 +34,8 @@ searches with secret/certificate/key-like prefixes also remain blocked. For ripg
34
34
  symlinks, not filename-only mode. Literal directory checks retain the process-cwd fallback when the
35
35
  payload omits cwd; glob probing does not. Filesystem check/use races remain: this is not a sandbox.
36
36
 
37
+ The Bash write guard checks manifest and environment-file names against both logical and resolved physical basenames; run `cratis ai update` to receive this change.
38
+
37
39
  A Pi session runs guards from its starting checkout. Refresh the corpus there with `cratis ai update`,
38
40
  or start a new session in the checkout you change. Selecting a newer installed guard corpus per call
39
41
  is tracked in [Cratis/AI#1114](https://github.com/Cratis/AI/issues/1114).
@@ -66,6 +68,8 @@ suffix that follows a slash in it (`$PWD/.cratis/x` and `~+/.cratis/x` are treat
66
68
  directory), without parsing the expansion, and refused if a suffix is protected, which includes a read of a protected path through a variable. This is a
67
69
  best-effort lexical check, not enforcement: a variable holding the whole path still passes.
68
70
 
71
+ Git reflog selectors with unprotected prefixes (`stash@{0}`, `HEAD@{1}`, `branch@{upstream}`) are revisions, not paths.
72
+
69
73
  The shell-write reference scan keeps conservative leading-dot intersections: a tool named `Bash`,
70
74
  `SHELL`, and the hook process's options do not establish the execution shell's options. Globbed writes
71
75
  therefore remain blocked. Read operands under protected paths are not write targets: `rg -n`/`-l`,
@@ -377,18 +377,25 @@ manifest_writes_allowed() {
377
377
 
378
378
  # Return the category, leaving normal Write/Edit diagnostics unchanged below.
379
379
  classify_file() {
380
- local reference_pattern="${2:-0}"
380
+ local reference_pattern="${2:-0}" physical_base=""
381
381
  abspath "$1" "$cwd"; normalize_target_path "$REPLY"; file="$REPLY"
382
382
  base_of "$file"; base="$REPLY"
383
383
  physical_target_path "$file" || physical_file=""
384
+ if [ -n "$physical_file" ]; then base_of "$physical_file"; physical_base="$REPLY"; fi
384
385
  if agent_control_target "$file" || { [ -n "$physical_file" ] && agent_control_target "$physical_file"; }; then
385
386
  classification=controls; return 0
386
387
  fi
387
- if names_match "$base" "${manifest_patterns[@]}"; then
388
- if manifest_writes_allowed; then return 1; fi
389
- classification=manifest; return 0
388
+ if names_match "$base" "${manifest_patterns[@]}" || names_match "$physical_base" "${manifest_patterns[@]}"; then
389
+ if manifest_writes_allowed; then
390
+ # Preserve reference-pattern policy when resolution leaves the basename unchanged.
391
+ [ "$base" != "$physical_base" ] || return 1
392
+ else
393
+ classification=manifest; return 0
394
+ fi
395
+ fi
396
+ if names_match "$base" "${environment_patterns[@]}" || names_match "$physical_base" "${environment_patterns[@]}"; then
397
+ classification=environment; return 0
390
398
  fi
391
- if names_match "$base" "${environment_patterns[@]}"; then classification=environment; return 0; fi
392
399
  return 1
393
400
  }
394
401
 
@@ -405,6 +412,9 @@ if [ "$reference_mode" = 1 ]; then
405
412
  unset 'candidates[last]'
406
413
  new_content=""
407
414
  for candidate in "${candidates[@]}"; do
415
+ # Reflog selectors name revisions, unless the prefix or the literal path (or its symlink target) is protected.
416
+ if [[ "$candidate" =~ ^[A-Za-z0-9._/-]*@\{(-?[0-9]+|upstream|push|u)\}$ ]] \
417
+ && ! classify_file "${candidate%@*}" && ! classify_file "$candidate"; then continue; fi
408
418
  reference_pattern=0
409
419
  case "$candidate" in *'*'* | *'?'* | *'['* | *'{'* | *'@('* | *'+('* | *'!('*) reference_pattern=1 ;; esac
410
420
  if classify_file "$candidate" "$reference_pattern"; then printf '%s\n' "$candidate"; continue; fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.170.1",
3
+ "version": "7.170.3",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [