@jjanczur/tyran 0.1.51 → 0.1.53

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.
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "name": "tyran",
13
13
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
14
- "version": "0.1.51",
14
+ "version": "0.1.53",
15
15
  "source": "./",
16
16
  "author": {
17
17
  "name": "Jacek Janczura",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tyran",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
5
5
  "author": {
6
6
  "name": "Jacek Janczura",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,220 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.53 — 2026-11-21
4
+
5
+ ### Path allowlists in a tracked gitleaks config apply, and a pathspec commit scans what it commits
6
+
7
+ Issue #105, points 1 and 3.
8
+
9
+ **Path allowlists.** The secrets gate piped every file into one
10
+ `gitleaks stdin` buffer, so every finding had an empty `File`. A `paths`
11
+ allowlist in a tracked `.gitleaks.toml` therefore never matched a real file,
12
+ and a fixture under `__tests__/` was refused whatever the config said. This is
13
+ the issue's AND case. Its OR case, a key under `src/` passing, did not
14
+ reproduce here with an allowlist regex that matches the empty string; that
15
+ case is now pinned as a guard. When a repository tracks a `.gitleaks.toml`,
16
+ the gate now writes the files it determined into a temporary tree and runs
17
+ `gitleaks dir` over it, so each file is scanned under its own path. Coverage
18
+ stays arithmetic. The scanner's trace must name every file written, as read or
19
+ as skipped by the allowlist and for no other reason, and the bytes it reports
20
+ must equal the sizes of the files it read. A scan that does not add up is
21
+ repeated over stdin, so a scanner change costs a false refusal, never a missed
22
+ key. A push range holding several versions of one path is split into rounds,
23
+ with one path per round under case and Unicode folding. Labels that are not
24
+ plain relative paths, and files gitleaks would read as its own configuration
25
+ (`.gitleaks*`), stay on stdin. A repository with no tracked config is scanned
26
+ exactly as before, because gitleaks' default config allowlists paths of its
27
+ own (lock files, images).
28
+
29
+ One consequence for a repository whose tracked config says
30
+ `[extend] useDefault = true`: gitleaks' default path allowlist now applies to
31
+ it too. Measured on 8.30.1, a key in `package-lock.json`, `yarn.lock`,
32
+ `go.sum`, a `.png` or a `.svg` is skipped by that allowlist. Over stdin it was
33
+ refused. A key under `vendor/` is still read. A file under `node_modules/` is
34
+ neither read nor reported by `gitleaks dir`. The accounting notices that and
35
+ scans it over stdin, where it is refused.
36
+
37
+ **Pathspec commits.** `git commit -m x -- b.txt` commits the working-tree
38
+ content of `b.txt` and nothing else that is staged. The gate scanned the whole
39
+ index instead. A key staged in another file refused the commit, and a key in
40
+ an unstaged edit of `b.txt` was published unscanned. `planCommand` now reads
41
+ the pathspec (`commitPathspec`), and the scan is the diff from `HEAD` to the
42
+ working tree for those paths. `--include` scans the index plus those paths.
43
+ The pathspec is narrowed on only under three conditions:
44
+
45
+ - it comes from the quote-aware reading with every quote closed;
46
+ - every word after the verb is understood;
47
+ - every path matches a tracked file (`git ls-files --error-unmatch`).
48
+
49
+ Each of these leaves the commit scanned whole:
50
+
51
+ - an unknown flag, a short cluster, `-a` or `--pathspec-from-file`;
52
+ - a glob, pathspec magic, a `#` comment or a word the shell would expand;
53
+ - a message read as paths: `-m "update b.txt"`, or unquoted words
54
+ (`git commit -m fix the bug`), which git refuses as pathspecs anyway.
55
+
56
+ With no `HEAD` yet, the index and the working tree are scanned. The diffs pass
57
+ `--no-relative`, so a `diff.relative` setting cannot move the paths they print.
58
+
59
+ **Found on the way: last-wins, again.** The commit side of `planCommand` had
60
+ the shape fixed for pushes in 0.1.52.
61
+
62
+ - **Two commits in one line.** The second commit's plan replaced the first's.
63
+ `git commit -am a && git commit -m b` lost the first commit's `-a`, so an
64
+ unstaged key it committed was not scanned. A second commit now only widens
65
+ the scan, and is never narrowed.
66
+ - **Two adds before a commit.** `git add a && git add b && git commit` kept
67
+ only `b`. Every add now folds in.
68
+ - **An add in a subdirectory.** `cd sub && git add new.pem && git commit` read
69
+ the added file at the repository root: `new.pem`, not `sub/new.pem`. It found
70
+ nothing there, and the commit published the file unscanned. Added paths are
71
+ now absolute, resolved where the `git add` ran, and an add folds into the
72
+ commit even when a `cd` lies between them.
73
+
74
+ 23 tests in `hook-secrets-gate-paths.test.mjs`; on 0.1.52, 15 are red. Five
75
+ of the 15 drive `scanTree` with a scripted scanner trace, and each of these is
76
+ not trusted:
77
+
78
+ - a file the trace does not name;
79
+ - a skip for another reason;
80
+ - a byte count that disagrees;
81
+ - a path the gate never wrote.
82
+
83
+ Eight more are guards that pass on both versions: a message that looks like a
84
+ pathspec, `--include`, no `HEAD`, a `node_modules/` file, and others. Five
85
+ mutants were run against the file, and each turns at least one test red:
86
+
87
+ - the per-file accounting;
88
+ - the byte check;
89
+ - the skip-reason check;
90
+ - the tracked-config switch;
91
+ - the add-folding.
92
+
93
+ Still open: #105 point 2. A file created in the same command that commits it
94
+ (`printf ... > f && git add f && git commit`) is read before it exists, and is
95
+ scanned as empty. The same goes for a new file under a directory named to
96
+ `git add` (`git add src/ && git commit`): the directory is not a file, and the
97
+ untracked files under it are not read.
98
+
99
+ ## 0.1.52 — 2026-11-21
100
+
101
+ ### Both gates judge every push on a command line, not only the last one
102
+
103
+ The policy gate judged only the LAST push in a line. Under P1,
104
+ `git push origin HEAD:main && git push origin feature/x` passed and the first
105
+ push reached `main`. The cause was in `planCommand`, which both gates read: it
106
+ keeps one target per repository, and each push into that repository overwrote
107
+ the previous one's argv. The target now carries `pushArgvs`, every push in
108
+ order, and the policy gate reads the destination, the deletion and the force of
109
+ each one. Any one push past the class refuses the line.
110
+
111
+ The secrets gate had the same shape on the remote. 0.1.51 unioned the refs of
112
+ two pushes but kept the last push's remote, and the range is "commits not on
113
+ that remote". So `git push upstream leaky && git push origin leaky`, with
114
+ `leaky` already on `origin`, scanned an empty range while `upstream` received
115
+ the branch for the first time. The remotes are now unioned too, and the range
116
+ is listed once per remote. A `gh pr create`, which names no remote, adds no
117
+ unnamed one beside a push that names its remote.
118
+
119
+ Three new tests. The policy-gate test runs six spellings under P1, both orders
120
+ among them; on 0.1.51 it is red. The secrets-gate pair is a planner test and a
121
+ gate test against real git and gitleaks; both are red on 0.1.51.
122
+
123
+ ### A quoted value with a space no longer hides git commit or git push
124
+
125
+ Reported from a real install. `git -c user.name="Jacek Janczura" commit -m x`,
126
+ the single-quoted `-c` spelling and `GIT_AUTHOR_NAME='Jacek Janczura' git
127
+ commit` all passed the secrets gate UNSCANNED with a key staged, while
128
+ `git -c user.name=JJ commit` was refused. `tokensOf` splits a segment on
129
+ whitespace before it drops the quotes, so the subcommand resolver read
130
+ `Janczura` as the verb, or, behind an assignment, as the program with `git` as
131
+ the verb. No target meant no scan. `env X=1 git commit` and
132
+ `for b in a; do git push ...; done` had the same hole with no quote at all. The
133
+ policy gate reads the same plan, so a quoted identity in front of `git push`
134
+ also walked past the deployment class.
135
+
136
+ `planCommand` now also reads each segment the way the shell splits it
137
+ (`shellWords`: single and double quotes, `$'...'`, backslashes), and peels
138
+ assignments and wrapper prefixes in a loop (`gitInvocation`). A verb either
139
+ reading finds counts, so every command the old reading recognised is handled
140
+ as before. `splitSegments` stays quote-blind, for the reason recorded on
141
+ `SEPARATORS`. A separator inside a quoted value in front of the subcommand
142
+ (`git -c user.name="A; B" commit`) leaves the verb unreadable, and that now
143
+ fails closed (`unreadableVerb`, refused by both gates) instead of passing.
144
+
145
+ The gate change is the patch from `fix/secrets-gate-quoted-commit` (0648f5c),
146
+ ported onto the 0.1.51 push code, with its fail-closed check replaced. The
147
+ patch decided one segment at a time, and review found three spellings that
148
+ still passed a staged key unscanned. In `GIT_AUTHOR_NAME="A; B" git commit`
149
+ the quote hiding `git` opened in the previous segment. In
150
+ `GIT_AUTHOR_NAME="A; cd /tmp" git commit` the second segment starts with `cd`,
151
+ which the walk handles and skips. In `GIT_AUTHOR_NAME="A; git -C <decoy>
152
+ commit" git commit` a commit is found, in a clean decoy repository, and stands
153
+ in for the real one. The check is now one linear pass over the whole line
154
+ (`quotedSeparatorHidesVerb`), split where the shell splits it. It is decided
155
+ by position: a line fails closed when a separator inside a quote comes at or
156
+ before the verb of a commit, push or add. A separator in a commit message
157
+ comes after the verb and does not trip it. Neither does one inside `"$(...)"`,
158
+ which the shell runs as commands and the quote-blind lexer already reads.
159
+
160
+ 41 tests in `hook-secrets-gate-quoting.test.mjs` (the branch's 36, plus the
161
+ spellings above, a value too long for any bounded look-back, and a push inside
162
+ a shell loop) and one in the policy-gate suite. On 0.1.51, 38 of the 41 are
163
+ red. With the branch's patch alone, 5 are red: the three assignment-separator
164
+ gate tests, the decoy, and the planner test that lists the separator
165
+ spellings.
166
+
167
+ ### A redirection's file descriptor is no longer read as a refspec
168
+
169
+ 0.1.51 left one spelling of a remote-branch deletion refused for gigabytes:
170
+ `git push origin :gone 2>/dev/null`. `splitSegments` ends a segment at `>`,
171
+ so the `2` stayed behind as the last word of the push. It is not a `:dst`
172
+ refspec, so the deletion was scanned as a wide push. `git push 2>&1` read
173
+ the same `2` as the remote, and the policy gate then named a remote called
174
+ `2`. `splitSegments` now drops a whole word of digits directly in front of
175
+ `<` or `>`. That is the shell's own rule for a descriptor: in `v2>x` the word
176
+ `v2` is an argument and stays.
177
+
178
+ Two new tests. The planner test has five redirect spellings plus the `2>&1`
179
+ remote and the `v2` control. The gate test runs against real git and
180
+ gitleaks. Both are red on 0.1.51.
181
+
182
+ ### An explicit lease's expected sha is no longer refused as an API key
183
+
184
+ `git push --force-with-lease=pv3/api-token-fix:<40-hex sha> origin ...` was
185
+ refused as `generic-api-key`. Gitleaks reads the expected value as a
186
+ high-entropy key whenever the ref in front of it carries a keyword (`secret`,
187
+ `token`, `api`, `key`, `auth`). The only workaround was a bare
188
+ `--force-with-lease`, which drops the expected value.
189
+
190
+ `planCommand` now records the `<ref>:<full lowercase hex>` slot of a lease on
191
+ a `git push`, with the repository that push targets. `decide` hides that one
192
+ value (same length, all zeros) from the command-text scan, and ONLY when
193
+ `git --no-lazy-fetch cat-file -e <hex>^{object}` finds it in that repository.
194
+ Everything else leaves the text scanned as before: a hex that names no object,
195
+ an object of another repository, an abbreviation, a git failure or a timeout.
196
+ Nothing else in the command changes. `--no-lazy-fetch` matters: in a partial
197
+ clone the question would otherwise fetch the missing object from the promisor
198
+ remote, which sends the suspected value off the machine as `want <hex>`.
199
+
200
+ The gate change is the patch from `fix/secrets-gate-lease-sha` (dce74d6),
201
+ ported onto this release's push code. 13 tests in
202
+ `hook-secrets-gate-lease-sha.test.mjs`; on 0.1.51, 5 are red, the reported
203
+ false refusal among them.
204
+
205
+ ### Release titles no longer lose the words of a leading code span
206
+
207
+ The GitHub releases for 0.1.48 to 0.1.51 were titled `0.1.51 — : deleting a
208
+ remote branch ...`: the first heading's code span was missing. The release job
209
+ pasted the title into a bash line as `--title "..."`, and inside double
210
+ quotes a backtick is command substitution, so `secrets-gate` ran as a command
211
+ and printed nothing. The title now reaches the shell through an environment
212
+ variable, and backticks are dropped from it, since a title renders no
213
+ Markdown. The four titles were corrected by hand.
214
+
215
+ Also corrected: the 0.1.51 entry said its 13 tests ran end to end against real
216
+ git and gitleaks. 8 of them test the parser and 5 run the full gate.
217
+
3
218
  ## 0.1.51 — 2026-11-21
4
219
 
5
220
  ### `secrets-gate`: deleting a remote branch is no longer refused for gigabytes it never sends
@@ -31,9 +246,10 @@ main` passed the real gate with a private key on `leaky`. The refs are now
31
246
  unioned. A deletion never replaces an earlier push, and a wide range stays
32
247
  wide.
33
248
 
34
- 13 new tests in `hook-secrets-gate-delete-refspec.test.mjs`, end to end against
35
- real git and gitleaks. On the unpatched gate 10 of them are red, the ticket's
36
- own `git push origin --delete gone` among them.
249
+ 13 new tests in `hook-secrets-gate-delete-refspec.test.mjs`: 8 test the parser
250
+ (`planCommand`) and 5 run the full gate against real git and gitleaks. On the
251
+ unpatched gate 10 of them are red, the ticket's own `git push origin --delete
252
+ gone` among them.
37
253
 
38
254
  The gate change is in `hooks/scripts/`, which is KERNEL in this repository. It
39
255
  was made in a session the operator opened for it with `boundaries.kernel:
package/README.md CHANGED
@@ -329,7 +329,7 @@ enforces the cap (3947 of 5000 characters). What each one assumes, when it
329
329
  fires and who invokes it, is in
330
330
  [skills and agents](https://jjanczur.github.io/tyran/skills/); the prompts
331
331
  themselves are in [`skills/`](skills/) and [`agents/`](agents/). Behind all of
332
- it: 1734 unit tests, run with `node --test "tests/**/*.test.mjs"`.
332
+ it: 1817 unit tests, run with `node --test "tests/**/*.test.mjs"`.
333
333
 
334
334
  ## Documentation
335
335
 
@@ -1993,7 +1993,13 @@ async function decideBash({ input, toolInput, root, runner, budget, boundaries,
1993
1993
  if (boundaries.push === 'allow') return PASS;
1994
1994
 
1995
1995
  const plan = planCommand(command, startDir);
1996
- const pushes = plan.targets.filter((t) => t.scanPush === true && Array.isArray(t.pushArgv));
1996
+ // EVERY push, not one per directory. A target is per repository and a line
1997
+ // can push the same repository twice; judging the target's last argv let
1998
+ // `git push origin HEAD:main && git push origin feature/x` reach `main`
1999
+ // under P1. `pushArgvs` is every push in that repository, in order.
2000
+ const pushes = plan.targets
2001
+ .filter((t) => t.scanPush === true && Array.isArray(t.pushArgv))
2002
+ .flatMap((t) => (Array.isArray(t.pushArgvs) ? t.pushArgvs : [t.pushArgv]).map((argv) => ({ dir: t.dir, argv })));
1997
2003
  // Asked of the LEXER, not spelled again here. The first version of this gate
1998
2004
  // carried its own alias test, which was a second spelling of one rule two
1999
2005
  // files apart — and the secrets gate, which had the same blind spot, went on
@@ -2008,6 +2014,17 @@ async function decideBash({ input, toolInput, root, runner, budget, boundaries,
2008
2014
  'to a protected branch while this gate saw no push at all.',
2009
2015
  );
2010
2016
  }
2017
+ // Same hole, opened by a separator inside a quoted value in front of the
2018
+ // subcommand (`git -c user.name="A; B" push origin main`): the lexer splits
2019
+ // there on purpose, so the verb is in a segment with no `git` in it.
2020
+ if (plan.unreadableVerb) {
2021
+ throw new PolicyFailure(
2022
+ 'a quoted value in front of the git subcommand holds a command separator (`;`, `&`, `|`, ' +
2023
+ 'a bracket), so which subcommand it runs is not readable from the command line',
2024
+ 'set the value first (`git config user.name "A B"`) or drop the separator from it, then run ' +
2025
+ 'the subcommand on its own.',
2026
+ );
2027
+ }
2011
2028
  if (pushes.length === 0) return PASS;
2012
2029
 
2013
2030
  const deployClass = await loadDeployClass(root);
@@ -2048,7 +2065,7 @@ async function decideBash({ input, toolInput, root, runner, budget, boundaries,
2048
2065
  }
2049
2066
 
2050
2067
  for (const target of pushes) {
2051
- const push = readPush(target.pushArgv);
2068
+ const push = readPush(target.argv);
2052
2069
  const dir = target.dir;
2053
2070
 
2054
2071
  if (push.unreadable.length > 0) {