@hasna/hooks 0.15.0 → 0.15.2

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@hasna/hooks",
4
- "version": "0.15.0",
4
+ "version": "0.15.2",
5
5
  "hooks": {
6
6
  "affected-tests": {
7
7
  "version": "0.1.0",
@@ -176,7 +176,7 @@
176
176
  "pre-bash": {
177
177
  "version": "0.1.0",
178
178
  "script": "hooks/pre-bash/src/hook.ts",
179
- "sha256": "553827d083453821e9b8b87c7c72da1a1aa162385c27959343170726690beecb"
179
+ "sha256": "76bd1336efd61eaf8497f93df017236f4382fba664fdb921699c2bf51a05d196"
180
180
  },
181
181
  "precompact": {
182
182
  "version": "0.1.0",
@@ -276,7 +276,7 @@
276
276
  "trash-guard": {
277
277
  "version": "0.1.2",
278
278
  "script": "hooks/hook-trash-guard/src/hook.ts",
279
- "sha256": "b088d07782c0b89e868e148393acfe946b7d9b3e91ebd56e737043ea992e7646"
279
+ "sha256": "88ed81d67d8618a62eecdb58e748cb8187e3005e92349c9eee3c9b756bbcc0ac"
280
280
  },
281
281
  "typecheck-gate": {
282
282
  "version": "0.1.0",
@@ -1,4 +1,4 @@
1
- import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, type Stats, writeFileSync, writeSync } from "node:fs";
1
+ import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, statSync, type Stats, writeFileSync, writeSync } from "node:fs";
2
2
  import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
3
3
  import { homedir, tmpdir } from "node:os";
4
4
 
@@ -149,8 +149,11 @@ export interface GitCommandInfo {
149
149
  function splitShellSegmentsPass(
150
150
  command: string,
151
151
  atomicSubstitutions: boolean
152
- ): { segments: string[]; isolation: boolean[]; depths: number[]; groups: number[]; piped: boolean[]; shortCircuit: boolean[]; unterminated: boolean } {
152
+ ): { segments: string[]; isolation: boolean[]; depths: number[]; groups: number[]; piped: boolean[]; shortCircuit: boolean[]; followedBy: string[]; unterminated: boolean } {
153
153
  const segments: string[] = [];
154
+ // The separator after each segment: ";", "&", "&&", "||", "|", "(", ")", "\n" or "end".
155
+ // The `&` of a redirection such as `2>&1` is not a separator and stays in the segment.
156
+ const followedBy: string[] = [];
154
157
  const isolation: boolean[] = [];
155
158
  const depths: number[] = [];
156
159
  const groups: number[] = [];
@@ -170,9 +173,10 @@ function splitShellSegmentsPass(
170
173
  let groupCounter = 0;
171
174
  const groupStack: number[] = [0];
172
175
 
173
- const flush = (nextSeparator: string | null) => {
176
+ const flush = (nextSeparator: string | null, separatorToken: string = nextSeparator ?? "end") => {
174
177
  if (current.trim()) {
175
178
  segments.push(current.trim());
179
+ followedBy.push(separatorToken);
176
180
  // A stage of a pipeline runs in its own process, as does anything inside `( … )`.
177
181
  isolation.push(parenDepth > 0 || pipedFromPrevious || nextSeparator === "|");
178
182
  depths.push(parenDepth);
@@ -235,8 +239,16 @@ function splitShellSegmentsPass(
235
239
  }
236
240
  if (ch === ";" || ch === "|" || ch === "&" || ch === "(" || ch === ")" || ch === "\n") {
237
241
  const doubled = (ch === "|" || ch === "&") && command[i + 1] === ch;
242
+ // A single `&` inside a redirection (`2>&1`, `>&2`, `<&0`, `&>file`, `&>>file`) is not a
243
+ // separator at all: it stays inside the segment, so a real background `&` after it
244
+ // (`cd /tmp >/dev/null 2>&1 & rm -rf x`) still ends the cd's own segment (HAA-00113).
245
+ // An escaped `\>` is a literal character, not a redirection.
246
+ if (ch === "&" && !doubled && (/(^|[^\\])(\\\\)*[<>]$/.test(current) || command[i + 1] === ">")) {
247
+ current += ch;
248
+ continue;
249
+ }
238
250
  // `||` and `&&` are sequencing, not a pipe.
239
- flush(ch === "|" && !doubled ? "|" : null);
251
+ flush(ch === "|" && !doubled ? "|" : null, doubled ? ch + ch : ch);
240
252
  // `a && X=1` and `a || X=1` run X= only if the left side decided so.
241
253
  precededByShortCircuit = doubled && (ch === "|" || ch === "&");
242
254
  if (ch === "(") {
@@ -254,7 +266,7 @@ function splitShellSegmentsPass(
254
266
  }
255
267
 
256
268
  flush(null);
257
- return { segments, isolation, depths, groups, piped: pipedFlags, shortCircuit: shortCircuitFlags, unterminated: substitutionDepth > 0 || inBacktick };
269
+ return { segments, isolation, depths, groups, piped: pipedFlags, shortCircuit: shortCircuitFlags, followedBy, unterminated: substitutionDepth > 0 || inBacktick };
258
270
  }
259
271
 
260
272
  function splitShellSegments(command: string): string[] {
@@ -272,6 +284,12 @@ interface ShellSegment {
272
284
  piped: boolean;
273
285
  /** Reached only via `&&` / `||`, so whether it ran depends on the previous command. */
274
286
  shortCircuit: boolean;
287
+ /**
288
+ * The separator after this segment: ";", "&", "&&", "||", "|", "(", ")", "\n" or "end".
289
+ * A `cd` followed by a single "&" runs in the background and moves nothing; one followed
290
+ * by anything but "&&" may have failed while the next command still runs.
291
+ */
292
+ followedBy: string;
275
293
  /**
276
294
  * True when the segment runs in a subshell `( … )` or as a stage of a pipeline. A `cd`
277
295
  * there affects only that child process, so treating it as persistent silently moves the
@@ -304,6 +322,7 @@ function splitShellSegmentsUncached(command: string): ShellSegment[] {
304
322
  group: chosen.groups[index] ?? 0,
305
323
  piped: chosen.piped[index] ?? false,
306
324
  shortCircuit: chosen.shortCircuit[index] ?? false,
325
+ followedBy: chosen.followedBy[index] ?? "end",
307
326
  isolated: chosen.isolation[index] ?? false,
308
327
  }));
309
328
  }
@@ -1559,34 +1578,41 @@ const OWN_SCRATCH_MIN_PREFIX = 8;
1559
1578
  /** A `..` path component anywhere in the command (after a separator, quote or start). */
1560
1579
  const PARENT_COMPONENT = /(?:^|[\s/'"`=:;&|()<>{},])\.\.(?=$|[\s/'"`;&|()<>{},])/;
1561
1580
  /** The only command words a command using the own-scratch exception may run, written literally. */
1562
- const DELETE_ONLY_WORD = /^(?:\/bin\/|\/usr\/bin\/)?(?:rm|rmdir|find)$/;
1581
+ const DELETE_ONLY_WORD = /^(?:\/bin\/|\/usr\/bin\/)?(?:rm|rmdir)$/;
1563
1582
  /** Shell constructs that can run or build a command the word check cannot see. */
1564
1583
  const HIDDEN_COMMAND = /\$\(|`|<\(|>\(|\$\{|\$'|\\\n/;
1565
- /** find actions that run or open something other than a delete, or that follow links. */
1566
- const FIND_RUNS_SOMETHING = /(?:^|\s)-(?:exec|execdir|ok|okdir|fprint|fprint0|fprintf|fls|L|H|follow)(?=\s|$)/;
1584
+ /** A leading `cd` to one plain absolute (or `~/`) path: no option, no quote, no variable. */
1585
+ const LEADING_CD = /^cd\s+(?:\/|~\/)[A-Za-z0-9._@+\/-]*$/;
1567
1586
 
1568
1587
  /**
1569
1588
  * Whether the command as a whole may use the own-scratch exception at all. It must be
1570
1589
  * made only of deletes: every simple command (split on `;`, `&`, `|` and newlines, more
1571
1590
  * finely than the shell would, so a quoted separator only splits more) starts with the
1572
- * literal word `rm`, `rmdir` or `find` (optionally `/bin/` or `/usr/bin/`), a `find`
1573
- * piece has no quote or backslash (which could hide `-exec`) and runs no `-exec`-like
1574
- * action and no `-L`/`-H`/`-follow`, and nothing builds a command the words cannot show
1575
- * (`$(…)`, backticks, any parenthesis — process substitution, zsh `=(…)` and glob
1576
- * qualifiers included —, `${…}`, `$'…'`, a line continuation). Anything else
1577
- * could make or move a link in the same run, which a check made before the command
1578
- * cannot see. Also refused: any `..` component (a symbolic link followed by `..` is
1579
- * resolved by the kernel from the link's target, which a textual path check cannot see).
1591
+ * literal word `rm` or `rmdir` (optionally `/bin/` or `/usr/bin/`), except that the
1592
+ * FIRST may be `cd <one plain absolute path>`. That `cd` is what lets a session whose
1593
+ * working folder is a repository checkout leave it, as the repo-checkout guard's own
1594
+ * logic requires; it cannot change what is deleted, because every target must be
1595
+ * written as an absolute path (the call site's check). `find` is not admitted: its
1596
+ * actions can be assembled from pieces no word check reads (`{-exec,}`, `-exe$*c`).
1597
+ * Nothing may build a command the words cannot show (`$(…)`, backticks, any
1598
+ * parenthesis — process substitution, zsh `=(…)` and glob qualifiers included —,
1599
+ * `${…}`, `$'…'`, a line continuation): anything else could make or move a link in the
1600
+ * same run, which a check made before the command cannot see. Also refused: any `..`
1601
+ * component (a symbolic link followed by `..` is resolved by the kernel from the link's
1602
+ * target, which a textual path check cannot see).
1580
1603
  */
1581
1604
  export function ownScratchCommandAllowed(command: string): boolean {
1582
1605
  if (PARENT_COMPONENT.test(command) || HIDDEN_COMMAND.test(command) || /[()]/.test(command)) return false;
1583
1606
  const pieces = command.split(/[;&|\n\r]+/).map((piece) => piece.trim()).filter(Boolean);
1607
+ if (pieces.length > 0 && LEADING_CD.test(pieces[0])) pieces.shift();
1584
1608
  if (pieces.length === 0) return false;
1585
1609
  return pieces.every((piece) => {
1586
- const first = piece.split(/\s+/)[0];
1587
- if (!DELETE_ONLY_WORD.test(first)) return false;
1588
- if (!first.endsWith("find")) return true;
1589
- return !/['"\\]/.test(piece) && !FIND_RUNS_SOMETHING.test(piece);
1610
+ const words = piece.split(/\s+/);
1611
+ if (!DELETE_ONLY_WORD.test(words[0])) return false;
1612
+ // `rmdir -p <own>/b` removes <own>/b and then every empty parent, the session folder
1613
+ // itself included, which the exception refuses (HAA-00114).
1614
+ if (words[0].endsWith("rmdir") && words.slice(1).some((word) => word === "--parents" || /^-[A-Za-z]*p[A-Za-z]*$/.test(word))) return false;
1615
+ return true;
1590
1616
  });
1591
1617
  }
1592
1618
 
@@ -1656,7 +1682,7 @@ function ownScratchHint(targetPath: string, rule: ProtectedPathRule): string {
1656
1682
  if (rule.label !== "Hasna state root ~/.hasna") return "";
1657
1683
  const scratchRoot = join(rule.root, "scratchpad", "scratch");
1658
1684
  if (!isInsidePath(resolve(targetPath), scratchRoot) || resolve(targetPath) === scratchRoot) return "";
1659
- return " To remove content of your own scratch folder, write each target as an absolute path below ~/.hasna/scratchpad/scratch/<your session id>/, with no `..`, in a command made only of rm, rmdir or find -delete.";
1685
+ return " To remove content of your own scratch folder, write each target as an absolute path below ~/.hasna/scratchpad/scratch/<your session id>/, with no `..`, in a command made only of rm or rmdir, optionally after one leading `cd <absolute path>` (for example out of a repository checkout).";
1660
1686
  }
1661
1687
 
1662
1688
  /** True only for an existing directory that is not itself a symbolic link. */
@@ -1713,6 +1739,45 @@ function realpathThroughExisting(path: string): string | null {
1713
1739
  }
1714
1740
  }
1715
1741
 
1742
+ /** Uncertain cds (that may have failed) tracked before the analysis fails closed. */
1743
+ const MAX_UNCERTAIN_CDS = 8;
1744
+
1745
+ /**
1746
+ * A real location re-spelled under a protected root as the rules write it: when the root
1747
+ * itself sits behind a link (macOS /tmp is /private/tmp), a real path inside the root's real
1748
+ * location is mapped back under the root's own spelling, so the rule still recognises it.
1749
+ */
1750
+ function inRuleSpelling(realPath: string, root: string): string {
1751
+ const realRoot = realpathThroughExisting(root);
1752
+ if (!realRoot || realRoot === resolve(root)) return realPath;
1753
+ if (realPath === realRoot) return resolve(root);
1754
+ return isInsidePath(realPath, realRoot) ? join(resolve(root), relative(realRoot, realPath)) : realPath;
1755
+ }
1756
+
1757
+ /** True only for a path that exists now and is a directory (links followed, as cd does). */
1758
+ function isExistingDirectory(path: string): boolean {
1759
+ try {
1760
+ return statSync(path).isDirectory();
1761
+ } catch {
1762
+ return false;
1763
+ }
1764
+ }
1765
+
1766
+ /**
1767
+ * Where an `rm` of `path` really acts: the real location of its parent folder (every link
1768
+ * there followed, as the kernel does) plus its own last name, which rm removes without
1769
+ * following. Null when the parent cannot be resolved, or when it equals `path`.
1770
+ */
1771
+ function realParentLocation(path: string): string | null {
1772
+ const resolved = resolve(path);
1773
+ const parent = dirname(resolved);
1774
+ if (parent === resolved) return null;
1775
+ const realParent = realpathThroughExisting(parent);
1776
+ if (!realParent) return null;
1777
+ const real = join(realParent, basename(resolved));
1778
+ return real === resolved ? null : real;
1779
+ }
1780
+
1716
1781
  function isMissingPathError(error: unknown): boolean {
1717
1782
  return error instanceof Error && "code" in error && (error as NodeJS.ErrnoException).code === "ENOENT";
1718
1783
  }
@@ -2467,6 +2532,9 @@ function cwdTrackedSegments(command: string, baseCwd: string, nonEmptyNames: Rea
2467
2532
  // outright left `(cd / && rm -rf *)`, the standard "cd without moving my shell" idiom,
2468
2533
  // completely unguarded. Depth 0 is the parent shell.
2469
2534
  let cdOperations = 0;
2535
+ // cds that may have failed widen the set of folders a later relative delete is judged in;
2536
+ // past this many the set is not tracked further and the analysis fails closed instead.
2537
+ let uncertainCds = 0;
2470
2538
  let stack: Array<{ group: number; cwds: string[]; previous: string[]; dirStack: string[][]; explicit: boolean }> = [
2471
2539
  { group: 0, cwds: [baseCwd], previous: [baseCwd], dirStack: [], explicit: false },
2472
2540
  ];
@@ -2489,7 +2557,7 @@ function cwdTrackedSegments(command: string, baseCwd: string, nonEmptyNames: Rea
2489
2557
  return stack[depth];
2490
2558
  };
2491
2559
 
2492
- splitShellSegmentsDetailed(command).forEach(({ text: segment, depth, group, piped, shortCircuit }, segmentIndex) => {
2560
+ splitShellSegmentsDetailed(command).forEach(({ text: segment, depth, group, piped, shortCircuit, followedBy }, segmentIndex) => {
2493
2561
  const frame = frameFor(depth, group);
2494
2562
  // A leading `{` from a brace group is not part of the command.
2495
2563
  const tokens = shellWords(segment).filter((token, index) => !(index === 0 && (token === "{" || token === "}")));
@@ -2514,6 +2582,9 @@ function cwdTrackedSegments(command: string, baseCwd: string, nonEmptyNames: Rea
2514
2582
  // reached via `&&`/`||` may not run at all: `cd /home/hasna; false && cd /tmp;
2515
2583
  // rm -rf *` left the guard in /tmp while bash stayed in the home directory.
2516
2584
  if (piped) return;
2585
+ // `cd /tmp & rm -rf x` runs the cd in a background job: the shell that runs the rm
2586
+ // never moved, so the tracked cwd must not move either (HAA-00113).
2587
+ if (followedBy === "&") return;
2517
2588
  if (shortCircuit) {
2518
2589
  analysis.degraded = true;
2519
2590
  return;
@@ -2583,7 +2654,21 @@ function cwdTrackedSegments(command: string, baseCwd: string, nonEmptyNames: Rea
2583
2654
  next.add(resolveFrom(current, operand));
2584
2655
  if (collapsed !== null) next.add(resolveFrom(current, collapsed));
2585
2656
  }
2586
- frame.cwds = [...next].slice(0, MAX_CWD_VARIANTS);
2657
+ // A cd may fail (a missing folder, no permission) and the shell runs the next
2658
+ // command anyway unless the two are joined by `&&`: `cd /nonexistent; rm -rf state`
2659
+ // deletes `state` in the folder the shell was already in. Unless the cd is followed
2660
+ // by `&&`, or every folder it can land in exists as a directory right now, the
2661
+ // folder before it stays a candidate too (HAA-00113).
2662
+ const landed = [...next];
2663
+ const mayFail = followedBy !== "&&" && uncertainCds <= MAX_UNCERTAIN_CDS && !landed.every((dir) => isExistingDirectory(dir));
2664
+ let candidates = landed;
2665
+ if (mayFail) {
2666
+ uncertainCds += 1;
2667
+ if (uncertainCds > MAX_UNCERTAIN_CDS) analysis.degraded = true;
2668
+ else candidates = [...new Set([...landed, ...priorCwds])];
2669
+ }
2670
+ if (candidates.length > MAX_CWD_VARIANTS) analysis.degraded = true;
2671
+ frame.cwds = candidates.slice(0, MAX_CWD_VARIANTS);
2587
2672
  if (isAbsolute(expandHome(operand)) || collapsed !== null) frame.explicit = true;
2588
2673
  }
2589
2674
  frame.previous = priorCwds;
@@ -2796,27 +2881,42 @@ export async function classifyDangerousOperation(input: CodewithHookInput): Prom
2796
2881
  return extraRule ? [...rules, extraRule] : rules;
2797
2882
  };
2798
2883
 
2799
- for (const rule of rulesFor(targetPath)) {
2800
- if (threatensRule(targetPath, rule, currentManagedRepoRoot)) {
2801
- // A session removing content of its own scratch folder (session id from the
2802
- // harness, not the command) is not a threat to the ~/.hasna tree.
2803
- // The target must be written as an absolute path (the same wherever the command
2804
- // runs), so no `cd`, `pushd` or `cd -P` before it can move what it means.
2805
- if (
2806
- rule.label === "Hasna state root ~/.hasna" &&
2807
- ownScratchCommandAllowed(command) &&
2808
- isAbsolute(expandHome(target.path)) &&
2809
- !target.path.split(/[\\/]/).some((part) => part === ".." || part === ".") &&
2810
- isOwnScratchContent(targetPath, rule.root, input.session_id)
2811
- ) continue;
2812
- return {
2813
- block: true,
2814
- targetPath,
2815
- protectedPath: rule.root,
2816
- protectedLabel: rule.label,
2817
- operation: target.operation,
2818
- reason: scopedBlockReason(target.operation, targetPath, rule, target.remote) + ownScratchHint(targetPath, rule),
2819
- };
2884
+ // Judge the target where the command names it, and also where it really acts: a link
2885
+ // in a parent folder (`cd ~/link && rm -rf state`, `rm -rf ~/link/state`, with
2886
+ // ~/link -> ~/.hasna) moves the delete into a protected root the text never names
2887
+ // (HAA-00113). rm removes the last name itself without following it.
2888
+ const realLocation = realParentLocation(targetPath);
2889
+ // A trailing slash (`rm -rf ~/link/`) makes rm follow the last name too, so the delete
2890
+ // acts inside wherever that link finally points (HAA-00113 review).
2891
+ const realTarget = /[\\/]\.?$/.test(target.path) ? realpathThroughExisting(targetPath) : null;
2892
+ const judgedLocations = [targetPath];
2893
+ for (const location of [realLocation, realTarget]) {
2894
+ if (location && !judgedLocations.includes(location)) judgedLocations.push(location);
2895
+ }
2896
+ for (const judged of judgedLocations) {
2897
+ for (const rule of rulesFor(judged)) {
2898
+ const ruleJudged = judged === targetPath ? judged : inRuleSpelling(judged, rule.root);
2899
+ if (threatensRule(ruleJudged, rule, currentManagedRepoRoot)) {
2900
+ // A session removing content of its own scratch folder (session id from the
2901
+ // harness, not the command) is not a threat to the ~/.hasna tree.
2902
+ // The target must be written as an absolute path (the same wherever the command
2903
+ // runs), so no `cd`, `pushd` or `cd -P` before it can move what it means.
2904
+ if (
2905
+ rule.label === "Hasna state root ~/.hasna" &&
2906
+ ownScratchCommandAllowed(command) &&
2907
+ isAbsolute(expandHome(target.path)) &&
2908
+ !target.path.split(/[\\/]/).some((part) => part === ".." || part === ".") &&
2909
+ isOwnScratchContent(ruleJudged, rule.root, input.session_id)
2910
+ ) continue;
2911
+ return {
2912
+ block: true,
2913
+ targetPath: ruleJudged,
2914
+ protectedPath: rule.root,
2915
+ protectedLabel: rule.label,
2916
+ operation: target.operation,
2917
+ reason: scopedBlockReason(target.operation, ruleJudged, rule, target.remote) + ownScratchHint(ruleJudged, rule),
2918
+ };
2919
+ }
2820
2920
  }
2821
2921
  }
2822
2922
 
@@ -90,12 +90,12 @@ counts, and the rewrite replaces only the verb, behind its wrappers.
90
90
  written word does not show, is refused.
91
91
  - A command this hook cannot follow to its end, when it names a delete verb,
92
92
  `find -delete` or `git clean` (read with `$'…'` and `$"…"` decoded and in any
93
- case, HO-00226), or its scan finds a delete (HO-00208). The causes: an unterminated quote or
94
- substitution, an extended glob such as `@(a|b)`, a `case` word inside a
95
- substitution, or a `$'…'` spelling that shows a delete the plain reading
96
- missed. A here-document is read as bash reads it: the rest of its operator's line is still the command
97
- (`cat <<EOF && rm x`), `<<-` strips tabs, and a body with no terminator runs
98
- to the end of the command.
93
+ case, HO-00226), or its scan finds a delete (HO-00208). The causes include
94
+ an unterminated quote or substitution, an extended glob such as `@(a|b)`, a
95
+ `case` word inside a substitution, and a `$'…'` spelling that shows a delete
96
+ the plain reading missed. A here-document is read as bash reads it: the rest
97
+ of its operator's line is still the command (`cat <<EOF && rm x`), `<<-`
98
+ strips tabs, and a body with no terminator runs to the end of the command.
99
99
  - The protected class, below.
100
100
 
101
101
  A `#` comment is read as bash reads it too (HO-00210). A `#` that starts a
@@ -2547,8 +2547,9 @@ function scanVerdict(scanned: ScanResult, command: string): CodewithHookOutput |
2547
2547
  // can be trusted: the lexer stopped, a `case` word sits inside a
2548
2548
  // substitution (scanReading), or the `$'…'` spelling found what the plain
2549
2549
  // reading missed (scanCommand). A delete the scan found, or a delete-verb
2550
- // word, means it might be a delete: refuse. The text match alone misses a quoted verb the
2551
- // scan still read (`r""m` after two here-documents; HO-00208 B1).
2550
+ // word, means it might be a delete: refuse. The text match alone misses a
2551
+ // quoted verb that the scan still read (`r""m` after two here-documents;
2552
+ // HO-00208 B1).
2552
2553
  return scanned.rmHits.length > 0 || scanned.handoffHits.length > 0 || mentionsDeleteVerb(command)
2553
2554
  || mentionsRefusedDeleteForm(command)
2554
2555
  ? deny(
@@ -150,7 +150,7 @@ async function runStagedSecretsScan(targetCwd: string, targetCertain: boolean):
150
150
  status: "skipped",
151
151
  scanned: false,
152
152
  code: "gitleaks-inconclusive",
153
- detail: `git could not resolve a work tree for ${targetCwd}${top.exitCode ? ` (git rev-parse exited ${top.exitCode})` : ""}, so this git command was NOT scanned for staged secrets.`,
153
+ detail: `git could not resolve a work tree for ${targetCwd}${top.exitCode ? ` (git rev-parse exited ${top.exitCode})` : ""}, so this git command was NOT scanned for staged secrets.${/\$/.test(targetCwd) ? " The repository path holds a shell variable the scan cannot expand: write the path literally (git -C /full/path/to/repo …)." : ""}`,
154
154
  };
155
155
  }
156
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/hooks",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command",
5
5
  "type": "module",
6
6
  "bin": {