@vaultcompass/conductor 0.8.1 → 0.10.0

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.
package/README.md CHANGED
@@ -142,10 +142,9 @@ required.
142
142
 
143
143
  **`.guardrails/manifest.json` records the absolute path on the machine
144
144
  that ran `init`**, for the hook, when there is one, and for the policy
145
- file alike, and
146
- conductor does not add a `.gitignore` entry for it. That path is specific
147
- to your checkout, so do not commit the file: add
148
- `.guardrails/manifest.json` to your own `.gitignore` today. The file
145
+ file alike. That path is specific to your checkout, so do not commit the
146
+ file: init appends `.guardrails/` to `.gitignore` when git does not already
147
+ ignore it, and prints the line instead when it cannot append safely. The file
149
148
  lives inside your working tree so `--revert` can find it later, and
150
149
  recording repo-relative paths there instead of absolute ones is a known
151
150
  gap, not a design; it has not been fixed yet.
@@ -167,7 +166,7 @@ required.
167
166
  A commit with a staged credential in it prints the full report and exits 1:
168
167
 
169
168
  ```
170
- conductor 0.8.0
169
+ conductor 0.10.0
171
170
  verdict-token: blocked (1)
172
171
  conductor run: 2 gate(s), 1 finding(s)
173
172
 
@@ -183,7 +182,7 @@ required.
183
182
 
184
183
  deferred intent intent-guard did not run here; it runs from stage ci onwards
185
184
 
186
- verdict: exit 1, 1 blocking finding(s) across 2 gate(s).
185
+ verdict: exit 1, 1 blocking finding(s) in 1 of 2 enforced gate(s).
187
186
  ```
188
187
 
189
188
  The `mode`, `corpusBuiltAt`, `lockfileFormat` and `online-flag` line under
@@ -243,6 +242,47 @@ decides the run, not even as a preview: step 1's preview gives you the same
243
242
  report without putting a file the pull request controls behind a verdict on
244
243
  the pull request page.
245
244
 
245
+ ## Adoption ramp
246
+
247
+ A repository with history will not start clean, and a gate that is red on its
248
+ first pull request gets switched off. The order that works:
249
+
250
+ 1. **Advisory first.** The first pull request runs with `advisory: true` and
251
+ `pr-comment: true`, as in "Adopting conductor" above. Findings print and
252
+ are commented, and none of them fails the run.
253
+
254
+ 2. **Record what is already there, in each gate's own file.** conductor does
255
+ not write these and does not read them for the gates; each tool does.
256
+ - vault-guard keeps its own baseline of accepted findings. See the
257
+ [vault-guard documentation](https://github.com/vaultcompasshq/vault-guard)
258
+ for the file and how it is produced.
259
+ - osv-scanner reads `osv-scanner.toml` for ignored advisories, each with a
260
+ reason and an optional expiry. See the
261
+ [osv-scanner configuration docs](https://google.github.io/osv-scanner/configuration/).
262
+ - gitleaks reads `.gitleaks.toml` for rule tuning. Generic rules such as
263
+ `generic-api-key` are the usual noise on test fixtures and doc
264
+ placeholders; allowlist those paths there. See the
265
+ [gitleaks documentation](https://github.com/gitleaks/gitleaks).
266
+
267
+ 3. **Accept an old history finding.** A secret that is already in history and
268
+ already rotated stays in every history scan. Put its fingerprint on its own
269
+ line in a `.gitleaksignore` file at the repository root. gitleaks' own
270
+ report carries the fingerprint, in the form `commit:path:rule:line`:
271
+
272
+ ```
273
+ 0a1b2c3d4e5f60718293a4b5c6d7e8f901234567:docs/example.md:generic-api-key:12
274
+ ```
275
+
276
+ conductor reads `.gitleaksignore` from the base branch on a pull request,
277
+ so adding the line takes effect after its own merge, like any other
278
+ control change.
279
+
280
+ 4. **Switch to enforce.** When a few ordinary pull requests report only what
281
+ you expect, remove `advisory: true`, and set `enforce: true` on the gates
282
+ you want to be able to refuse a merge. `conductor init` writes the intent
283
+ gate with `enforce: false` and `require-frozen: false` until a contract is
284
+ frozen, so a repository with no contract is not blocked by that gate.
285
+
246
286
  ## Why
247
287
 
248
288
  Run all three family gates and you have three inits, three config files,
@@ -326,6 +366,7 @@ gates:
326
366
  enabled: true
327
367
  stage: ci
328
368
  enforce: true
369
+ present-on-base: report
329
370
 
330
371
  report:
331
372
  format: text
@@ -361,13 +402,18 @@ blocking findings do not raise it, and its failing to run at all does not
361
402
  make the run exit 2. That is the adoption ramp, so a gate can be switched on
362
403
  and read for a few weeks before it is allowed to refuse anybody's commit.
363
404
  `init` writes it out for every gate. For the intent gate it writes `true`
405
+ (and see `present-on-base` below for the vulnerabilities gate)
364
406
  when a frozen contract already exists at init time
365
407
  (`.intent-guard/intent-contract.yaml`, or the pre-1.3.0
366
408
  `.conductor/intent-contract.yaml`), since the ramp is already climbed by
367
409
  then, and leaving it unenforced would silently let a frozen contract's
368
410
  protected paths produce findings that never fail the check. It writes
369
411
  `false`, with a comment explaining why, when there is no contract yet to
370
- enforce against.
412
+ enforce against, and in that case it also writes `require-frozen: false`
413
+ under `options`, since intent-guard otherwise blocks on a missing contract.
414
+ The `options` comment is written per gate: gitleaks and osv-scanner have no
415
+ severity floor, so their comments point at `.gitleaks.toml` and
416
+ `osv-scanner.toml` rather than at `fail-on`.
371
417
 
372
418
  **`options`** is handed to that gate unchanged. Each key is one of that
373
419
  gate's own long flags with the leading dashes stripped: `fail-on: high`
@@ -383,7 +429,50 @@ gitleaks, and
383
429
  `--format`, `--config` and `--lockfile` to osv-scanner, so those are
384
430
  reserved too. Narrow what either
385
431
  tool reports in its own config file (`.gitleaks.toml`, `osv-scanner.toml`)
386
- instead.
432
+ instead. Two osv-scanner flags are written without being reserved: a run
433
+ that scans a requirements file always gets `--no-resolve`, and a
434
+ `no-resolve` key here is dropped from that run with a note; and a
435
+ pull-request run gets `--no-call-analysis=all` unless this block names
436
+ `call-analysis` or `no-call-analysis`, in which case that value is used.
437
+ `timeout-seconds` is refused under `options` on every gate, and `timeout`
438
+ on every gate but gitleaks, where it is gitleaks' own `--timeout` flag and
439
+ is passed through (see `timeout-seconds` below and "What a history scan
440
+ costs").
441
+
442
+ **`present-on-base`** (the `vulnerabilities` gate only, beside `enforce`,
443
+ never under `options`) is `block` or `report`. On a pull-request run whose
444
+ osv-scanner scan blocked, the umbrella also scans the base branch copies of
445
+ the lockfiles that carry findings and labels each finding `introduced` or
446
+ `present-on-base`. `block` blocks on every finding; `report` reports the
447
+ present-on-base ones without blocking and blocks only on what the pull
448
+ request introduced. A policy without the key blocks on every finding, so no
449
+ existing policy is loosened; `init` writes `report` for a new repository.
450
+ On a pull request the key is read from the base branch's policy like every
451
+ other key, so a pull request cannot set it for itself. A run with no base (a
452
+ local run, a push) has no labels, and every finding blocks. The key on any
453
+ other gate is an error, and an older conductor rejects it, so move the
454
+ Action first.
455
+
456
+ **`timeout-seconds`** (any gate, beside `enforce`, never under `options`)
457
+ is how long conductor lets that gate run before stopping it: a whole number
458
+ of seconds from 10 to 21600. The floor is there because the same limit
459
+ bounds the gate's version probe, and a limit of a second or two can stop the
460
+ probe of a gate that starts slowly before it ever scans. The ceiling is the
461
+ six hours after which a GitHub-hosted job is cancelled; a larger limit could
462
+ never fire there. Without the key each gate keeps the default for its
463
+ product: 120 seconds for dep-guard, vault-guard and intent-guard, 600 for
464
+ gitleaks, 300 for osv-scanner. There is no policy-wide default, for the same
465
+ reason there is no shared severity threshold: the five gates differ in cost
466
+ by orders of magnitude. Every spawn of the gate gets the full limit (the
467
+ version probe, the scan, the intent gate's preparation steps, osv-scanner's
468
+ base run on a pull request). A gate stopped at its limit could not run, with
469
+ the reason `timed-out` and what to do about it, and an enforced one makes
470
+ the run exit 2. On a pull request the key is read from the base branch's
471
+ policy like every other key, so a pull request cannot raise, lower or
472
+ remove its own limit; an invalid value on the base fails every pull request
473
+ with exit 2 until the base is fixed, and an invalid value only on the head
474
+ is a policy proposal there and fails the push run after merge. An older
475
+ conductor rejects the key, so move the Action first.
387
476
 
388
477
  **There is no shared severity threshold, on purpose.** One top-level
389
478
  `failOn` would read as one decision and mean five different things, so
@@ -392,7 +481,11 @@ its own threshold in its own `options` block, spelled the way that gate
392
481
  spells it.
393
482
 
394
483
  **`command`** takes an absolute path and overrides binary resolution for
395
- that gate, for pointing at a build that is not installed anywhere.
484
+ that gate, for pointing at a build that is not installed anywhere. `args`
485
+ beside it sets the argument prefix. conductor's history gate assumes
486
+ gitleaks' `git` mode; an `args` that switches it to `dir` mode changes what
487
+ gitleaks' own `--timeout` does (in `dir` mode it exits 0 after a partial
488
+ scan, with no warning).
396
489
 
397
490
  **`report.format`** is `text` or `sarif`, and `--format` overrides it.
398
491
 
@@ -401,7 +494,14 @@ that gate, for pointing at a build that is not installed anywhere.
401
494
  `conductor init` writes the policy file and `.guardrails/manifest.json`, the
402
495
  record `--revert` reads back later. The manifest currently records absolute
403
496
  machine paths rather than repo-relative ones (see "Adopting conductor"
404
- above); do not commit it.
497
+ above); do not commit it. When git does not already ignore it, init appends
498
+ `.guardrails/` to `.gitignore` (or creates one) and says so; a `.gitignore`
499
+ that is a symbolic link or not a regular file is left alone and the line is
500
+ printed for you to add. On a policy file that already exists, init lists the
501
+ gate roles it has no entry for, with the two lines that add each. An external
502
+ gate (gitleaks, osv-scanner) is written enabled only when its binary is found
503
+ on the machine running init, with a comment under it that CI must install it;
504
+ a CI job without it gets `conductor/gate-missing` and exit 2.
405
505
 
406
506
  - `--hook` also writes one pre-commit hook running every enabled gate whose
407
507
  stage is `commit`. Without it, init writes only the policy file and the
@@ -413,7 +513,9 @@ above); do not commit it.
413
513
  `--hook` itself.
414
514
  - `--dry-run` prints every file it would write or change and writes nothing.
415
515
  - `--revert` removes exactly what a previous init wrote, and nothing else.
416
- A file changed since init is reported and left alone.
516
+ A file changed since init is reported and left alone. The one exception is
517
+ the `.guardrails/` line init appends to `.gitignore`: `--revert` does not
518
+ remove it.
417
519
  - `--adopt` replaces one gate's own pre-commit hook with the umbrella hook.
418
520
  Without it, init reports the collision and stops rather than stacking a
419
521
  second invocation of a gate that is already hooked. A hook the umbrella
@@ -440,7 +542,14 @@ and none of it can block the policy file from being written, on a plain
440
542
 
441
543
  Init recognises the hook manager already wired into the repository. husky is
442
544
  redirected to the tracked hook it maintains rather than the generated
443
- dispatcher git runs. lefthook and the pre-commit framework are refused, with
545
+ dispatcher git runs. On a fresh clone, where husky's install has not set
546
+ `core.hooksPath` yet, husky is recognised from `package.json` (a `husky`
547
+ dependency or devDependency, or a `prepare` script that runs husky) or a
548
+ tracked `.husky/` directory, and init writes `.husky/pre-commit` and says the
549
+ install still has to run, rather than writing `.git/hooks/pre-commit`, which
550
+ husky's install would bypass. This applies only when `core.hooksPath` is not
551
+ set at all: one set by hand, even to `.git/hooks`, is left alone. A prepare
552
+ script counts only when it runs husky as a command. lefthook and the pre-commit framework are refused, with
444
553
  the stanza to add to their own config file. simple-git-hooks and yorkie are
445
554
  refused too, and recognised from the declaration as well as from the hook
446
555
  file, because the declaration is there on a fresh clone where the generated
@@ -497,7 +606,13 @@ proceeds normally without mentioning them.
497
606
  copy in a file would only duplicate it. A path that cannot be written is
498
607
  exit 2, like `--output`. See "The verdict token" below.
499
608
  - `--verbose` prints the full per-gate report even when the run is clean.
500
- Text output only; the SARIF log never changes shape with it.
609
+ Text output only; the SARIF log never changes shape with it. Without it a
610
+ gate prints its first 20 findings, blocking first, and one line saying how
611
+ many more there are; every count, the verdict and SARIF include all of
612
+ them. `--verbose` also lists the lockfiles behind an osv-scanner line
613
+ that groups one advisory across several ("lodash@4.17.20 2 lockfiles
614
+ fix 4.17.21"). A gitleaks finding shows its short commit and the
615
+ fingerprint `.gitleaksignore` takes.
501
616
  - `--compact-on-refusal` shrinks the report to the version, the verdict and
502
617
  the refusal reason when the trust base was refused and no gate ran,
503
618
  instead of the full per-gate report. Built for the pull-request-comment
@@ -530,9 +645,10 @@ proceeds normally without mentioning them.
530
645
  - **0** every enabled gate ran and none blocked.
531
646
  - **1** every enabled gate ran and at least one blocked.
532
647
  - **2** an enabled gate could not run: its binary is missing, it exited with
533
- its own could-not-run code, or it exited 1 with nothing parseable on
648
+ its own could-not-run code, it exited 1 with nothing parseable on
534
649
  stdout, which is what a rejected config file looks like from two of the
535
- three family gates.
650
+ three family gates, or conductor stopped it at its time limit
651
+ (`timed-out`, see `timeout-seconds` in the policy file).
536
652
 
537
653
  The external gates' exits are read per tool. gitleaks exits 1 for an error
538
654
  as well as for a leak, so the umbrella hands it `--exit-code 3`: 3 is a leak
@@ -540,17 +656,47 @@ as well as for a leak, so the umbrella hands it `--exit-code 3`: 3 is a leak
540
656
  when git itself fails (a base ref the checkout never fetched), so a clean
541
657
  exit that logged an `ERR` line is could-not-run too, never a pass. A
542
658
  gitleaks exit with no report file behind it is could-not-run. osv-scanner is
543
- handed every tracked lockfile by name (`package-lock.json`,
544
- `npm-shrinkwrap.json`, `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`, at any
545
- depth, never under `node_modules`); when the repository tracks none, it is
546
- not spawned at all and the gate is reported clean with a
547
- `conductor/nothing-to-scan` note, so a docs-only repository is not red on
548
- every pull request. Its 1 is blocked. Its own 128 ("no package sources
549
- found") on lockfiles it WAS handed means they parsed to no packages; that is
550
- clean too, with a distinct `conductor/lockfiles-empty` note naming the
551
- files. Only those npm-family names are handed over today: a repository
552
- whose only lockfile belongs to another ecosystem gets nothing-to-scan from
553
- this gate. Lockfiles inside git submodules are never listed. In a sparse
659
+ handed every tracked lockfile by name, at any depth, never under
660
+ `node_modules`: `package-lock.json`, `npm-shrinkwrap.json`,
661
+ `pnpm-lock.yaml`, `yarn.lock`, `bun.lock`, `go.mod`, `poetry.lock`,
662
+ `Pipfile.lock`, `uv.lock`, `pdm.lock`, `Cargo.lock`, `Gemfile.lock`,
663
+ `composer.lock`, `gradle.lockfile`, `packages.lock.json`, `mix.lock`,
664
+ `pubspec.lock`, `Package.resolved`, `conan.lock`, `renv.lock`,
665
+ `packages.config`, `buildscript-gradle.lockfile`, `gems.locked`,
666
+ `pylock.toml`, `cabal.project.freeze`, `stack.yaml.lock` and
667
+ `verification-metadata.xml` inside a `gradle` directory, and pip
668
+ requirements files (`requirements.txt`, `requirements-dev.txt`,
669
+ `requirements_test.txt`, `requirements.prod.txt`, `dev-requirements.txt`)
670
+ whose every requirement, includes followed, is pinned with `==`. `go.sum`
671
+ is never handed over: osv-scanner reads `go.mod` for Go. A requirements
672
+ file with an unpinned line, or an include that is missing, untracked or
673
+ outside the repository, is not scanned and is named in a
674
+ `conductor/requirements-not-scanned` note with the line that stopped it,
675
+ because any version osv-scanner reported for it would be a guess.
676
+ Requirements files are scanned with `--no-resolve`: direct requirements
677
+ only, as written, and the report says so per file. On a pull request a
678
+ requirements file that is pinned on the base stays scanned even when the
679
+ pull request adds an unpinned line to it. When the repository tracks none
680
+ of these, osv-scanner is not spawned at all and the gate is reported clean
681
+ with a `conductor/nothing-to-scan` note, so a docs-only repository is not
682
+ red on every pull request. The note says that nothing was scanned and names
683
+ the tracked manifests that were not handed to osv-scanner (a
684
+ `pyproject.toml`, a `go.sum`, a `Dockerfile`, a workflow, or a requirements
685
+ file the pin check left out), so a green gate is not read as a scan of
686
+ them. A `go.mod` or a pinned requirements file is handed over and so is
687
+ never on that list. It says nothing about what other gates read. When
688
+ other lockfiles WERE handed over, the same list (a `Podfile.lock` beside a
689
+ scanned `mix.lock`, say) is printed as a `conductor/manifests-not-handed`
690
+ note under the gate instead. Its 1 is
691
+ blocked. Its own 128 ("no package sources found") on lockfiles it WAS
692
+ handed means they parsed to no packages; that is clean too, with a distinct
693
+ `conductor/lockfiles-empty` note naming the files. When some handed
694
+ lockfiles had packages and one had none (a lockfile rewritten to `{}` beside
695
+ others), the same note names the empty one and the `lockfiles` line marks it
696
+ `[no packages read]`; the verdict over the other files is unchanged. That
697
+ naming reads osv-scanner's own per-file count, which it prints at its
698
+ default verbosity. Lockfiles inside git
699
+ submodules are never listed. In a sparse
554
700
  checkout a tracked lockfile that is not on disk is still handed over and
555
701
  osv-scanner exits 127 on it, a false could-not-run that fails closed. Any other osv-scanner exit
556
702
  (127 is its error code) is could-not-run. A gitleaks older than 8.19 or an
@@ -571,12 +717,19 @@ It decides nothing and never overrules a gate: it is derived from the exit
571
717
  code and the `enforce` flags the run already had.
572
718
 
573
719
  - `pass`: exit 0, and no gate, enforced or not, has a blocking finding or
574
- could not run.
575
- - `nothing-checked`: exit 0, but no gate ran at all (none is enabled, or
576
- every enabled one was deferred to a later stage, had nothing to judge, or
577
- was skipped). The exit status is unchanged, since nothing failed, but this
578
- is not a pass: nothing was verified. In the Action the `verdict` output
579
- carries this token, so a workflow can tell it apart from `pass`.
720
+ could not run. Under `present-on-base: report` a `pass` can carry known
721
+ vulnerabilities already on the base branch, reported and not blocking;
722
+ the report's third line then says `present-on-base: N reported, not
723
+ blocking`, the verdict sentence says the same, and the Action copies that
724
+ line to the job summary under the token.
725
+ - `nothing-checked`: exit 0, but nothing was checked. Either no gate ran at
726
+ all (none is enabled, or every enabled one was deferred to a later stage,
727
+ had nothing to judge, or was skipped), or every gate that ran examined
728
+ nothing: the vulnerabilities gate with no lockfile it reads, or the intent
729
+ gate with no contract to check against. The second case was `pass` in
730
+ 0.8.x. The exit status is unchanged, since nothing failed, but this is not
731
+ a pass: nothing was verified. In the Action the `verdict` output carries
732
+ this token, so a workflow can tell it apart from `pass`.
580
733
  - `advisory-blocked (N)`: the run would have exited 1, and `--advisory` made
581
734
  it exit 0. N is the blocking findings on enforced gates.
582
735
  - `unenforced-findings (N)`: exit 0, but a gate with `enforce: false` had
@@ -587,12 +740,13 @@ code and the `enforce` flags the run already had.
587
740
 
588
741
  When several apply the order is `could-not-run`, then `blocked` or
589
742
  `advisory-blocked`, then `unenforced-findings`, then `nothing-checked` (no gate
590
- ran) or `pass`. A run with
743
+ ran, or none that ran checked anything) or `pass`. A run with
591
744
  `--advisory` whose only blocking findings sit on an unenforced gate is
592
745
  `unenforced-findings`, not `advisory-blocked`, because the flag did nothing
593
746
  there. A gate skipped for want of a contract does not by itself move the token
594
- off `pass` when another gate ran; when no gate ran, the token is
595
- `nothing-checked` and the verdict sentence says "nothing was checked". A
747
+ off `pass` when another gate ran and checked something; when no gate ran, or
748
+ every gate that ran checked nothing, the token is `nothing-checked` and the
749
+ verdict sentence says "nothing was checked". A
596
750
  gate that exited non-zero with no finding marked blocking counts as one in N,
597
751
  so a state that is not a pass never prints a count of zero. The one-line
598
752
  summary of a clean, non-verbose run has no token line, since it is one line by
@@ -1204,8 +1358,7 @@ request being judged, and the version-pin protection described above
1204
1358
  "protects nothing" against a tree that controls its own judge (the
1205
1359
  validate step's own comment in `action.yml` says so in those words). A tag
1206
1360
  moves when someone pushes it. Name this action by owner and the full commit
1207
- SHA instead. The recipes in this README pin the v0.8.0 commit and are
1208
- updated to the v0.8.1 commit after that release is tagged.
1361
+ SHA instead. The recipes in this README name vaultcompasshq/conductor@v0.10.0.
1209
1362
 
1210
1363
  ```yaml
1211
1364
  name: guardrails
@@ -1227,7 +1380,7 @@ jobs:
1227
1380
  with:
1228
1381
  node-version: '22.11.0'
1229
1382
  - id: conductor
1230
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1383
+ uses: vaultcompasshq/conductor@v0.10.0
1231
1384
  with:
1232
1385
  output: conductor.sarif
1233
1386
  - uses: github/codeql-action/upload-sarif@v3
@@ -1302,7 +1455,7 @@ jobs:
1302
1455
  # installs those itself, globally. Leave conductor-version unset so the
1303
1456
  # umbrella is the default in the pinned action.yml.
1304
1457
  - id: conductor
1305
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1458
+ uses: vaultcompasshq/conductor@v0.10.0
1306
1459
  with:
1307
1460
  output: conductor.sarif
1308
1461
  # Exact versions, never a range and never "latest". These three
@@ -1313,9 +1466,9 @@ jobs:
1313
1466
  # request of their own. On a pull request the action refuses a pin
1314
1467
  # below what the pinned action.yml ships, and the three lines can
1315
1468
  # be left out entirely to take that action's own versions.
1316
- dep-guard-version: 0.10.0
1317
- vault-guard-version: 1.9.0
1318
- intent-guard-version: 1.8.0
1469
+ dep-guard-version: 0.13.0
1470
+ vault-guard-version: 1.11.0
1471
+ intent-guard-version: 1.8.1
1319
1472
  - uses: github/codeql-action/upload-sarif@v3
1320
1473
  # Always: the log is most worth having on the run that failed.
1321
1474
  if: always()
@@ -1411,6 +1564,61 @@ runs whatever its author pushes to it next. Pin every third-party action by
1411
1564
  commit digest in a workflow you actually run, the way this repository's own
1412
1565
  workflows do.
1413
1566
 
1567
+ ### What a history scan costs
1568
+
1569
+ What the history gate reads depends on the event. On a pull request it is
1570
+ `<base>..HEAD`, with first-parent diffs for merge commits; on a push, a
1571
+ schedule or a local run it is every commit reachable from HEAD. So a pull
1572
+ request's cost follows its own range, and a full run's cost follows the
1573
+ whole history and the size of every blob ever committed. Separately,
1574
+ `fetch-depth: 0` means the checkout fetches the whole history on every run,
1575
+ whatever the scan range.
1576
+
1577
+ The time limit is per gate. The defaults are 120 seconds for the three
1578
+ family gates, 600 for gitleaks and 300 for osv-scanner, and you change one
1579
+ with `timeout-seconds` beside `enforce`; on a pull request it comes from the
1580
+ base branch. Every spawn of a gate gets the full limit (the version probe,
1581
+ the scan, the intent gate's preparation steps, osv-scanner's base run), so
1582
+ a gate's wall time can be a multiple of it. A gate stopped at its limit is
1583
+ could-not-run (`timed-out`), never a pass.
1584
+
1585
+ - The limit is a SIGTERM deadline. A gate that ignores SIGTERM keeps the run
1586
+ waiting until it exits on its own; conductor does not escalate to SIGKILL.
1587
+ - A gate's own child processes are not stopped with it. A gate behind a
1588
+ shell-wrapper `command` can keep running after the report says
1589
+ `timed-out`.
1590
+ - On a hosted runner the six-hour job limit includes checkout, setup and
1591
+ every other gate, so a limit near the 21600 ceiling is cancelled with the
1592
+ job before it can fire. Keep it well under.
1593
+
1594
+ Measure your own full scan once, on the runner it will run on, and set the
1595
+ limit with headroom. The recommended split: every pull request scans its own
1596
+ range, and the full history is scanned on a schedule with a limit sized for
1597
+ it. Two existing ways to make it: by stage, since `secrets-history` defaults
1598
+ to stage `ci` and a push workflow run with the Action's `stage: push` input
1599
+ (or `conductor run --stage push`) leaves ci-stage gates out; or by trigger,
1600
+ running the workflow on pull requests and a schedule and not on push. With
1601
+ the CLI, `--gate secrets-history` on the scheduled job also works.
1602
+
1603
+ `max-target-megabytes`, passed under `options`, skips every file larger
1604
+ than the cap. Measured with gitleaks 8.30.1 in the mode conductor runs, at
1605
+ the log level conductor runs it at: a secret inside a file over the cap was
1606
+ not reported, no line in gitleaks' log named the skipped file, and the scan
1607
+ summary still reported the full byte count. It is a coverage decision, made
1608
+ in the policy file where a reviewer can see it, and conductor never applies
1609
+ it by default.
1610
+
1611
+ `options.timeout` on the secrets-history gate is gitleaks' own deadline,
1612
+ not conductor's. A `conductor/option-is-gate-own` note says so: always in
1613
+ the SARIF log, and in the text report under the gate header whenever the
1614
+ full report is printed (with `--verbose`, or on any run that is not fully
1615
+ clean; a clean run without `--verbose` prints only its one-line summary).
1616
+ When it fires
1617
+ gitleaks exits 1, whether or not it had found a leak, and the gate is
1618
+ could-not-run. Leaks it found before the deadline are not listed as
1619
+ findings; the echoed gitleaks log line ("N leaks found in partial scan") is
1620
+ the only mention of them.
1621
+
1414
1622
  ### Running the gates as an advisory check
1415
1623
 
1416
1624
  To run the gates without blocking a merge, set `advisory: true` on the
@@ -1453,7 +1661,7 @@ jobs:
1453
1661
  node-version: '22.11.0'
1454
1662
  - id: conductor
1455
1663
  timeout-minutes: 5
1456
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1664
+ uses: vaultcompasshq/conductor@v0.10.0
1457
1665
  with:
1458
1666
  pr-comment: true
1459
1667
  advisory: true
@@ -1589,7 +1797,7 @@ step and add `pull-requests: write` to the job's `permissions`:
1589
1797
  # the pull request runs before the action in this job: no install, build
1590
1798
  # or test step here; those belong in a separate job. ...
1591
1799
  - id: conductor
1592
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1800
+ uses: vaultcompasshq/conductor@v0.10.0
1593
1801
  with:
1594
1802
  output: conductor.sarif
1595
1803
  pr-comment: true
@@ -1651,6 +1859,13 @@ the comment was authored by the GitHub Actions bot; a marker in anyone
1651
1859
  else's comment is never adopted, and conductor creates its own comment
1652
1860
  instead, exactly as if no marked comment existed.
1653
1861
 
1862
+ **The poster runs the `node` and `gh` that were on `PATH` when the Action
1863
+ started**, resolved by the Action's first step before any gate package is
1864
+ installed, and never a binary from the gate install directory. The gate
1865
+ install goes on `PATH` only after its signature audit passes. GitHub-hosted
1866
+ runners carry both; on a runner that has neither on `PATH` at that point the
1867
+ comment is skipped with a warning and the verdict is unaffected.
1868
+
1654
1869
  **Running this Action more than once against the same pull request** (for
1655
1870
  example, once per package in a monorepo) needs its own marker per run, or
1656
1871
  those runs fight over one shared comment. Set `pr-comment-marker` to a
@@ -1661,12 +1876,12 @@ per pull request.
1661
1876
 
1662
1877
  ```yaml
1663
1878
  - id: conductor-package-a
1664
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1879
+ uses: vaultcompasshq/conductor@v0.10.0
1665
1880
  with:
1666
1881
  pr-comment: true
1667
1882
  pr-comment-marker: 'package-a'
1668
1883
  - id: conductor-package-b
1669
- uses: vaultcompasshq/conductor@566c7604b60137a7370a42a161f59b934aa1ad6d # v0.8.0
1884
+ uses: vaultcompasshq/conductor@v0.10.0
1670
1885
  with:
1671
1886
  pr-comment: true
1672
1887
  pr-comment-marker: 'package-b'
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
+ /**
4
+ * Whether the text report is rendered for a terminal: only when it goes to
5
+ * stdout (no --output) and stdout is a TTY. A file, a pipe and the
6
+ * --text-report copy never are, so they stay byte for byte as before.
7
+ */
8
+ export declare function rendersToTerminal(output: string | undefined, stdoutIsTTY: boolean | undefined): boolean;
3
9
  export declare function buildProgram(): Command;
package/dist/cli.js CHANGED
@@ -195,6 +195,14 @@ const PROJECT_OPTION_HELP = 'run against this directory instead of the current o
195
195
  function applyAdvisory(exitCode, advisory) {
196
196
  return advisory && exitCode === EXIT_BLOCKED ? EXIT_OK : exitCode;
197
197
  }
198
+ /**
199
+ * Whether the text report is rendered for a terminal: only when it goes to
200
+ * stdout (no --output) and stdout is a TTY. A file, a pipe and the
201
+ * --text-report copy never are, so they stay byte for byte as before.
202
+ */
203
+ export function rendersToTerminal(output, stdoutIsTTY) {
204
+ return output === undefined && stdoutIsTTY === true;
205
+ }
198
206
  /**
199
207
  * Reads the policy for one run, from the base ref in pull-request mode.
200
208
  *
@@ -566,7 +574,7 @@ export function buildProgram() {
566
574
  .option('--base <ref>', 'measure the intent gate against what this branch changed since <ref>, rather than against the index. In Actions this defaults to the base branch (refs/conductor/trust-base, else refs/remotes/origin/<GITHUB_BASE_REF>, as a commit id) when GITHUB_BASE_REF is set.')
567
575
  .option('--trust-base <ref>', 'pull-request mode: read .guardrails.yaml from this ref instead of from the tree being judged, and pass the same ref to every gate that supports it. A policy change in the pull request is reported as a proposal and never takes effect for the run, so a pull request cannot change the rules it is judged by. In Actions the composite action fetches the base branch and passes its full commit id on a pull_request event.')
568
576
  .option('--output <path>', 'write the report to this file instead of to stdout, for a CI step that uploads it')
569
- .option('--text-report <path>', 'with --format sarif, also write the text report to this file, from the same run: exactly what --format text would have rendered for this result, --verbose, --compact-on-refusal and --advisory respected, and no gate is run a second time. In a full report (any run that is not fully clean, or any run with --verbose) the second line is "verdict-token: <token>"; the one-line summary of a clean run without --verbose has none. The token is a label for this run\'s own exit decision: pass, nothing-checked (exit 0 but no gate ran), advisory-blocked (N), unenforced-findings (N), blocked (N) or could-not-run. Only meaningful with --format sarif: with --format text the text report is already the output, so the combination is a usage error (exit 2).')
577
+ .option('--text-report <path>', 'with --format sarif, also write the text report to this file, from the same run: exactly what --format text would have rendered for this result, --verbose, --compact-on-refusal and --advisory respected, and no gate is run a second time. In a full report (any run that is not fully clean, or any run with --verbose) the second line is "verdict-token: <token>"; the one-line summary of a clean run without --verbose has none. The token is a label for this run\'s own exit decision: pass, nothing-checked (exit 0 but nothing was checked: no gate ran, or every gate that ran had nothing to scan, read no packages, or had no contract), advisory-blocked (N), unenforced-findings (N), blocked (N) or could-not-run. Only meaningful with --format sarif: with --format text the text report is already the output, so the combination is a usage error (exit 2).')
570
578
  .option('--spec <path>', 'the spec the intent gate imports its contract from, outranking a Spec: line in the pull request body and the branch-name convention. On a pull-request run (--trust-base) the spec is read from the base ref, and a frozen contract on the base takes precedence over it')
571
579
  .option('--verbose', 'print the full per-gate report even when the run is clean. A clean run prints one summary line by default, because a pre-commit hook that prints a screenful on every commit is a hook a team switches off. Text output only; SARIF is unaffected.')
572
580
  .option('--compact-on-refusal', 'when the trust base was refused and no gate ran, print a short body instead of the full refusal report: the version, the verdict, and the refusal reason (with its remedy, when one applies), never the full per-gate report. Built for the pull-request-comment step; every other run is unaffected, whatever --verbose says. Text output only; SARIF is unaffected.')
@@ -636,16 +644,20 @@ export function buildProgram() {
636
644
  // there: each finding's `properties.blocking` is the gate's own
637
645
  // decision (see output-sarif.ts) and is unaffected by this flag,
638
646
  // exactly as the text report's per-finding BLOCKING marker is.
639
- const renderTextReport = () => renderText(result, {
647
+ const renderTextReport = (terminal) => renderText(result, {
640
648
  verbose: Boolean(options.verbose),
641
649
  version: pkg.version,
642
650
  compact: Boolean(options.compactOnRefusal),
643
651
  advisory,
652
+ ...(terminal ? { terminal: true } : {}),
644
653
  });
645
- const rendered = format === 'sarif' ? `${renderSarif(result, pkg.version)}\n` : renderTextReport();
654
+ // Only a report printed straight to a terminal is told so; a file,
655
+ // a pipe and the --text-report copy render exactly as before.
656
+ const toTerminal = rendersToTerminal(options.output, process.stdout.isTTY);
657
+ const rendered = format === 'sarif' ? `${renderSarif(result, pkg.version)}\n` : renderTextReport(toTerminal);
646
658
  // The SAME result, rendered a second time, never a second run: the
647
659
  // token in this file is for the run that set the exit code below.
648
- const textReport = options.textReport === undefined ? undefined : renderTextReport();
660
+ const textReport = options.textReport === undefined ? undefined : renderTextReport(false);
649
661
  if (options.output === undefined) {
650
662
  process.stdout.write(rendered);
651
663
  }
@@ -689,7 +701,10 @@ export function buildProgram() {
689
701
  // Written after the report file, so a failure above still takes the
690
702
  // catch below and these lines never describe a run that then exits 2
691
703
  // for an unwritable file.
692
- const logLines = [...gateLogLines(result), ...versionSkewWarnings(result)];
704
+ const logLines = [
705
+ ...gateLogLines(result, process.stderr.isTTY === true ? { terminal: true } : {}),
706
+ ...versionSkewWarnings(result),
707
+ ];
693
708
  if (logLines.length > 0) {
694
709
  process.stderr.write(`${logLines.join('\n')}\n`);
695
710
  }
@@ -111,6 +111,14 @@ export interface NormalizedGateOutput {
111
111
  /** One line per control input the head proposes to change. */
112
112
  proposals: string[];
113
113
  };
114
+ /**
115
+ * osv-scanner only: every package that carried a verdict which is not an
116
+ * advisory, one line each ("license_violations (click@8.1.7)"). osv-scanner
117
+ * exits 1 for those as well as for an advisory, and none of them is a
118
+ * finding here, so the exit-code exception for present-on-base findings
119
+ * (src/exit-codes.ts, gateExitBlocks, condition f) reads this instead.
120
+ */
121
+ otherVerdicts?: string[];
114
122
  }
115
123
  export declare class NormalizeError extends Error {
116
124
  constructor(message: string);
@@ -1,3 +1,48 @@
1
+ /**
2
+ * The fields of a gate's outcome `gateExitBlocks` reads. A structural type
3
+ * rather than an import of GateOutcome, so this file stays free of the
4
+ * runner and any caller with these fields can ask.
5
+ */
6
+ export interface ExitBlocksInput {
7
+ role: string;
8
+ product: string;
9
+ /** The child's own exit code, or null when there was no child. */
10
+ exitCode: number | null;
11
+ couldNotRun: unknown;
12
+ findings: ReadonlyArray<{
13
+ details: Record<string, unknown>;
14
+ }>;
15
+ baseComparison?: {
16
+ policy: 'block' | 'report';
17
+ otherVerdicts: readonly string[];
18
+ };
19
+ }
20
+ /**
21
+ * Whether this gate's own child exit blocks the run.
22
+ *
23
+ * Every "the child exited non-zero" decision goes through here: the composed
24
+ * exit code, the verdict token's count, the verdict sentence, the
25
+ * not-enforced note and the SARIF gate-not-enforced notification. A reader
26
+ * that compares the raw exit with 0 instead would say "blocked" on a run
27
+ * that exits 0 (tests/osv-exit.test.ts holds every reader to this).
28
+ *
29
+ * False for an exit of 0 (or no child). For a non-zero exit, true unless ALL
30
+ * of these hold:
31
+ * (a) the gate is the vulnerabilities gate, osv-scanner in that role;
32
+ * (b) its base policy said present-on-base: report;
33
+ * (c) a base comparison ran (it is carried on the outcome only then);
34
+ * (d) at least one finding was parsed, since exit 1 with nothing parsed
35
+ * is a verdict this umbrella cannot read;
36
+ * (e) every finding is labelled present-on-base. Redundant by
37
+ * construction: under report an introduced finding stays blocking,
38
+ * which blocks the run through `hasBlockingFinding` whatever this
39
+ * returns. Kept so the predicate states the whole rule;
40
+ * (f) the head output carried no verdict that is not an advisory: no
41
+ * license_violations, no deprecated package, no other unmapped
42
+ * package-level field. osv-scanner exits 1 for those too, and none of
43
+ * them is a finding here.
44
+ */
45
+ export declare function gateExitBlocks(gate: ExitBlocksInput): boolean;
1
46
  export declare const EXIT_OK = 0;
2
47
  export declare const EXIT_BLOCKED = 1;
3
48
  export declare const EXIT_COULD_NOT_RUN = 2;
@@ -6,8 +51,13 @@ export interface ExitInput {
6
51
  couldNotRun: {
7
52
  reason: string;
8
53
  } | null;
9
- /** The child's own exit code, or null when there was no child. */
10
- exitCode: number | null;
54
+ /**
55
+ * Whether the child's own exit blocks: `gateExitBlocks(outcome)`, never the
56
+ * raw exit code compared with 0. REQUIRED, like `enforce`, so a caller
57
+ * that has not thought about the present-on-base exception does not
58
+ * compile.
59
+ */
60
+ exitBlocks: boolean;
11
61
  /** Whether any finding from this gate is one the gate itself blocks on. */
12
62
  hasBlockingFinding: boolean;
13
63
  /**