Repository navigation
860 lines (820 loc) · 60.2 KB
/
Copy pathci.yml
File metadata and controls
860 lines (820 loc) · 60.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
name: gates
# Enforce the standards this repo documents. The skill it ships now flags
# "standards documented but no gate enforces them" as a finding — so this repo
# wires its own documented gates (CLAUDE.md pre-commit block + definition of done)
# into CI rather than leaving them advisory. The gate logic lives in one place,
# scripts/ci-gates.sh, exercised by scripts/test-ci-gates.sh; CI runs that same
# helper against the real repo so the enforced check and its tests never diverge.
# PR-only: branch protection requires `gates` with strict up-to-date branches,
# so a PR's run already tested the exact tree that lands on main; a second run
# on the post-merge push would repeat it and burn runner minutes. Superseded
# runs on the same PR are cancelled.
on:
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: gates-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read # least privilege (OWASP Scorecard: Token-Permissions)
jobs:
# Heavy steps run as parallel jobs (wall time = slowest job, not the sum); the aggregate `gates` job below keeps the
# required check name. scripts/test-ci-gates.sh shards its cases by SHARD=i/N; `perpr` shards scripts/ci-tests.d with the same SHARD=i/N spelling.
selftests:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
# SHA-pinned, not a mutable tag (the skill's own K rule for CI actions).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # fix-class gate diffs base..head; a depth-1 clone cannot resolve the range
persist-credentials: false # no later step pushes or fetches a private ref; GH_TOKEN env covers gh
# Derived files (SHA256SUMS, size-budgets.tsv rows, INDEX.md, INDEX-scripts.md) are not committed by lane PRs, so two
# PRs never conflict on them. Rebuild them here, before any gate reads them; a land commit (VERSION
# moved) is skipped, so there the committed files are checked byte-for-byte.
- name: Regenerate derived files (unlanded PR)
if: github.event_name == 'pull_request'
run: bash scripts/regen-unlanded.sh origin/main
# Prove the gate helper against its own fixtures (routing/version/privacy
# + the real install path) before trusting it on this repo.
- name: Gate helper self-tests
env:
SHARD: ${{ matrix.shard }}/3
run: bash scripts/test-ci-gates.sh
enforce:
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
# SHA-pinned, not a mutable tag (the skill's own K rule for CI actions).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # fix-class gate diffs base..head; a depth-1 clone cannot resolve the range
persist-credentials: false # no later step pushes or fetches a private ref; GH_TOKEN env covers gh
# Derived files (SHA256SUMS, size-budgets.tsv rows, INDEX.md, INDEX-scripts.md) are not committed by lane PRs, so two
# PRs never conflict on them. Rebuild them here, before any gate reads them; a land commit (VERSION
# moved) is skipped, so there the committed files are checked byte-for-byte.
- name: Regenerate derived files (unlanded PR)
if: github.event_name == 'pull_request'
run: bash scripts/regen-unlanded.sh origin/main
# Enforce the documented gates on the real repo via the same helper the
# self-tests pin — one authoritative implementation, no inline copies.
- name: Enforce documented gates
run: |
set -euo pipefail
# Routing runs on every shipped skill dir — a reference under an overlay
# cannot ship unrouted (dogfoods "documented but unenforced is a finding").
# Globbed, not enumerated: a new skill adds no line here, so PRs on different skills never conflict.
for d in .claude/skills/*/; do
bash scripts/ci-gates.sh routing --max-bytes 24000 "$d"
done
bash scripts/ci-gates.sh version .
bash scripts/ci-gates.sh privacy --banlist .banlist.txt .
bash scripts/ci-gates.sh enumeration .
bash scripts/check-leader-doc.sh --selftest && bash scripts/check-leader-doc.sh
# Frozen per-file byte-count budgets (scripts/size-budgets.tsv):
# every shipped SKILL.md/references/*.md must stay within its
# budget, which only ratchets down via consolidation, never up.
# A raise is enforced by the "Size budgets ratchet down" step below.
bash scripts/ci-gates.sh size --config scripts/size-budgets.tsv .
# No git-tracked file at a banned image/media/archive/build-output
# extension (scripts/binaries-allowlist.tsv): stops the
# committed-screenshot/artifact bloat class; extension-scoped, not
# size-scoped, so a legitimately large text fixture never trips it.
bash scripts/ci-gates.sh binaries .
# Frozen per-archetype MUST-LOAD token-est ceilings
# (scripts/mustload-budgets.tsv), parsed from SKILL.md's own
# "Archetype -> load map" table: makes the always-paid must-load
# read cost per archetype visible and ratchets it down, never up.
bash scripts/ci-gates.sh mustload --config scripts/mustload-budgets.tsv .
# Rule-enforcement lint: a MUST/NEVER/ALWAYS rule in a SKILL.md must
# name a mechanism or be marked advisory. Existing debt is frozen in
# scripts/rule-enforcement-baseline.tsv; only NEW unenforced rules
# fail. Baseline growth vs the PR base is the next step below.
bash scripts/ci-gates.sh rules --baseline scripts/rule-enforcement-baseline.tsv .
# Four legs, SHARD=i/4 (the i/N spelling selftests uses): each runs only the scripts/ci-tests.d registrations that scripts/ci-tests-shard.sh lists
# for it, so the job takes as long as its slowest slice, not the sum. `gates` needs `perpr`, so it fails unless every leg passes.
perpr:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
# SHA-pinned, not a mutable tag (the skill's own K rule for CI actions).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # fix-class gate diffs base..head; a depth-1 clone cannot resolve the range
persist-credentials: false # no later step pushes or fetches a private ref; GH_TOKEN env covers gh
# Derived files (SHA256SUMS, size-budgets.tsv rows, INDEX.md, INDEX-scripts.md) are not committed by lane PRs, so two
# PRs never conflict on them. Rebuild them here, before any gate reads them; a land commit (VERSION
# moved) is skipped, so there the committed files are checked byte-for-byte.
- name: Regenerate derived files (unlanded PR)
if: github.event_name == 'pull_request'
run: bash scripts/regen-unlanded.sh origin/main
# A slow per-PR test registers as scripts/ci-tests.d/<slug>.bg.sh: it starts here, runs alongside this leg's serial
# tests, and the "Per-PR tests" step waits for it and fails on its exit code (a hang is killed after 15 minutes), so it adds no serial time.
# This leg's registrations (serial and background) are listed once, here, into $RUNNER_TEMP/bg/leg; both steps read that list.
- name: Start background per-PR tests (scripts/ci-tests.d/*.bg.sh)
env:
SHARD: ${{ matrix.shard }}/4
run: |
mkdir -p "$RUNNER_TEMP/bg"
date +%s >"$RUNNER_TEMP/bg/started"
bash scripts/ci-tests-shard.sh >"$RUNNER_TEMP/bg/leg"
unset SHARD # the tests must not inherit it: scripts/test-ci-gates.sh reads SHARD as its own slice
for t in scripts/ci-tests.d/*.bg.sh; do
[ -e "$t" ] || continue
grep -qxF "$t" "$RUNNER_TEMP/bg/leg" || continue
f="$RUNNER_TEMP/bg/$(basename "$t")"
: >"$f.log"
# shellcheck disable=SC2016 # $1 and $2 expand in the child shell, on purpose
nohup bash -c 'timeout 900 bash -e "$1" >"$2.log" 2>&1; echo $? >"$2.rc.tmp"; date +%s >"$2.end"; mv "$2.rc.tmp" "$2.rc"' _ "$t" "$f" >/dev/null 2>&1 &
done
# Per-PR tests: a PR registers its test by adding scripts/ci-tests.d/<slug>.sh (one command line),
# not by appending a line to the step above, so PRs never conflict on this file.
# pyyaml: scripts/test_workflow_persist_credentials.py fails closed without it.
- name: Install hypothesis for the property tests
run: python3 -m pip install hypothesis==6.170.12 pyyaml==6.0.3
- name: Per-PR tests (scripts/ci-tests.d)
run: |
set -euo pipefail
[ -s "$RUNNER_TEMP/bg/leg" ] || { echo "FAIL: the start step wrote no test list for this leg"; exit 1; } # else grep fails and every test is skipped
for t in scripts/ci-tests.d/*.sh; do
case "$t" in *.bg.sh) continue ;; esac
grep -qxF "$t" "$RUNNER_TEMP/bg/leg" || continue # another leg runs it
echo "== $t"
bash -e "$t"
done
for t in scripts/ci-tests.d/*.bg.sh; do
[ -e "$t" ] || continue
grep -qxF "$t" "$RUNNER_TEMP/bg/leg" || continue
f="$RUNNER_TEMP/bg/$(basename "$t")"
echo "== $t (started in the background)"
[ -f "$f.log" ] || { echo "FAIL: $t was never started"; exit 1; }
end=$(($(cat "$RUNNER_TEMP/bg/started") + ${BG_WAIT_S:-960})) # counted from the background start, not from here
while [ ! -f "$f.rc" ] && [ "$(date +%s)" -lt "$end" ]; do sleep 1; done
cat "$f.log"
took='?'; [ -f "$f.end" ] && took=$(($(cat "$f.end") - $(cat "$RUNNER_TEMP/bg/started")))
echo "bg elapsed: ${f##*/} $took s"
[ -f "$f.rc" ] || { echo "FAIL: $t did not finish in time"; exit 1; }
[ "$(cat "$f.rc")" = 0 ]
done
evals:
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
# SHA-pinned, not a mutable tag (the skill's own K rule for CI actions).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # fix-class gate diffs base..head; a depth-1 clone cannot resolve the range
persist-credentials: false # no later step pushes or fetches a private ref; GH_TOKEN env covers gh
# Derived files (SHA256SUMS, size-budgets.tsv rows, INDEX.md, INDEX-scripts.md) are not committed by lane PRs, so two
# PRs never conflict on them. Rebuild them here, before any gate reads them; a land commit (VERSION
# moved) is skipped, so there the committed files are checked byte-for-byte.
- name: Regenerate derived files (unlanded PR)
if: github.event_name == 'pull_request'
run: bash scripts/regen-unlanded.sh origin/main
# Live harness (stub HTTP server, no key, no spend) and the review-scoring
# instrument (canaries, FP budget, fixture integrity).
- name: Live eval harness and review scorer tests (offline)
run: |
python3 scripts/test_live_evals.py
python3 scripts/test_score_review.py
python3 scripts/test_issue1418.py
python3 scripts/test_install_commands.py
python3 scripts/test_spend_report.py
python3 scripts/test_field_learnings.py
python3 scripts/test_terse_scope_checks.py
python3 scripts/test_reply_budget_prevention.py
python3 scripts/test_handback_copypaste_exempt.py
python3 scripts/test_lane_guard_banlist_seed.py
python3 scripts/test_lane_guard_hotfiles.py
python3 scripts/test_sandbox_preflight.py
python3 scripts/test_learning_to_pr.py
python3 scripts/test_wire_defaults.py
python3 scripts/test_weekly_receipt.py
python3 scripts/test_token_ratchet.py
python3 scripts/test_destructive_fp.py
python3 scripts/test_repeat_poll_and_brief_lint.py
python3 scripts/test_token_report_rollup.py
python3 scripts/test_tokens_per_pr_parity.py
python3 scripts/test_bench_corpus.py
python3 scripts/test_bench_run_isolation.py
python3 scripts/test_resource_policy.py
python3 scripts/test_council.py
python3 scripts/test_veche.py
python3 scripts/test_veche_timebox.py
python3 scripts/test_roadmap_rank.py
python3 scripts/test_policy_ux.py
bash scripts/test-resource-policy-train.sh
python3 scripts/test_review_feedback.py
python3 scripts/test_learned_rules.py
python3 scripts/test_review_lean.py
bash scripts/test-post-review.sh
python3 scripts/test_eval_predicates_defended.py
python3 scripts/test_perun_doctor.py
python3 scripts/test_install_ux.py
python3 scripts/test_extra_hosts_install.py
python3 scripts/test_hosts_parity.py
python3 scripts/test_host_safety_rows.py
python3 scripts/test_auto_update.py
python3 scripts/test_auto_update_global.py
python3 scripts/test_auto_update_pr.py
python3 scripts/test_fleet_hooks.py
python3 scripts/test_field_mos_1009.py
bash scripts/test-land-release-tag.sh
bash scripts/test-host-manifests.sh
bash scripts/test-land-release-publish.sh
python3 scripts/test_scan_tracked_only.py
python3 scripts/test_review_gate.py
python3 scripts/test_max_pace_no_waste.py
cheap:
runs-on: ubuntu-latest
timeout-minutes: 35
steps:
# SHA-pinned, not a mutable tag (the skill's own K rule for CI actions).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # fix-class gate diffs base..head; a depth-1 clone cannot resolve the range
persist-credentials: false # no later step pushes or fetches a private ref; GH_TOKEN env covers gh
# Derived files (SHA256SUMS, size-budgets.tsv rows, INDEX.md, INDEX-scripts.md) are not committed by lane PRs, so two
# PRs never conflict on them. Rebuild them here, before any gate reads them; a land commit (VERSION
# moved) is skipped, so there the committed files are checked byte-for-byte.
- name: Regenerate derived files (unlanded PR)
if: github.event_name == 'pull_request'
run: bash scripts/regen-unlanded.sh origin/main
- name: review_checks self-test
run: bash scripts/test-review-checks.sh
- name: mktemp TMPDIR regression
run: bash scripts/test-mktemp-tmpdir.sh
# Shipped gate scripts prove they FIRE on planted violations before any
# result of theirs is trusted (independent oracle per script).
# Strict: a new script nothing calls, or that no registered CI test runs, was built but never wired (field learning, #1380).
- name: New scripts are wired and run
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
cat scripts/ci-tests.d/*.sh scripts/test_*.py scripts/test-*.sh > "$RUNNER_TEMP/runs.txt"
python3 .claude/skills/agentic-delivery/scripts/wired_check.py "$BASE_SHA" "$HEAD_SHA" --strict --runs "$RUNNER_TEMP/runs.txt"
- name: Shipped script self-tests
run: |
set -euo pipefail
python3 .claude/skills/deep-code-review/scripts/parity_differ.py --selftest
python3 .claude/skills/deep-code-review/scripts/token_differ.py --selftest
python3 .claude/skills/deep-code-review/scripts/fix_class_gate.py --selftest
python3 .claude/skills/deep-code-review/scripts/closes_lint.py --selftest
python3 .claude/skills/deep-code-review/scripts/binaries_gate.py --selftest
python3 .claude/skills/deep-code-review/scripts/reaper_lint.py --selftest
python3 .claude/skills/deep-code-review/scripts/source_scan_tests.py --selftest
python3 .claude/skills/deep-code-review/scripts/ci_cost_lint.py --selftest
bash .claude/skills/deep-code-review/templates/integrator-gate.sh --selftest
python3 scripts/eval_citation_lint.py --selftest
python3 .claude/skills/agentic-delivery/scripts/serial_gate.py --selftest
python3 .claude/skills/agentic-delivery/scripts/handback_cap.py --selftest
python3 .claude/skills/agentic-delivery/scripts/lane_guard.py --selftest
python3 scripts/test_done_means_verified.py
python3 .claude/skills/agentic-delivery/scripts/clock_lint.py --selftest
python3 scripts/test_clock_lint.py
python3 scripts/test_clock_lint_bombs.py
python3 .claude/skills/agentic-delivery/scripts/env_lint.py --selftest
python3 scripts/test_env_lint.py
python3 scripts/test_vacuous_static.py
python3 scripts/test_mutation_changed.py
bash scripts/test-peer-pains-4.sh
python3 .claude/skills/agentic-delivery/scripts/board_common.py --selftest
python3 .claude/skills/agentic-delivery/scripts/board_sync.py --selftest
python3 .claude/skills/agentic-delivery/scripts/board_post.py --selftest
python3 .claude/skills/agentic-delivery/scripts/board_state.py --selftest
python3 .claude/skills/agentic-delivery/scripts/claim_probe.py --selftest
python3 .claude/skills/agentic-delivery/scripts/refix_gate.py --selftest
python3 .claude/skills/agentic-delivery/scripts/priority_gate.py --selftest
python3 .claude/skills/agentic-delivery/scripts/queue_guard.py --selftest
python3 .claude/skills/agentic-delivery/scripts/focus_gate.py --selftest
python3 .claude/skills/agentic-delivery/scripts/surface_check.py --selftest
python3 .claude/skills/agentic-delivery/scripts/restore_ledger.py --selftest
python3 .claude/skills/agentic-delivery/scripts/lane_liveness.py --selftest
python3 .claude/skills/agentic-delivery/scripts/review_digest.py --selftest
python3 .claude/skills/agentic-ceo/scripts/task_ledger.py --selftest
python3 .claude/skills/agentic-delivery/scripts/union_overlap.py --selftest
python3 .claude/skills/agentic-ceo/scripts/stop_reminder.py --selftest
python3 .claude/skills/agentic-ceo/scripts/token_report.py --selftest
python3 .claude/skills/agentic-delivery/scripts/feedback_ledger.py --selftest
python3 .claude/skills/agentic-delivery/scripts/merge_train.py --selftest
python3 .claude/skills/agentic-delivery/scripts/tier_gate.py --selftest
python3 .claude/skills/agentic-delivery/scripts/lane_cap.py --selftest
python3 .claude/skills/agentic-delivery/scripts/escaped_defects.py --selftest
python3 .claude/skills/agentic-delivery/scripts/destructive_guard.py --selftest
python3 .claude/skills/agentic-delivery/scripts/outcome_claim_guard.py --selftest
python3 scripts/trigger_lint.py --selftest
# scripts/skill_index.py generates the per-skill and repo-level INDEX.md
# lookup tables (which file answers which trigger, without opening every
# references/*.md or scripts/*.py blindly). Self-test proves the parser
# on synthetic fixtures (never the real repo's prose); --check proves the
# committed INDEX.md files are byte-identical to what the generator
# would write today, so a routed reference added without regenerating
# goes stale loudly instead of silently.
- name: Skill index (INDEX.md lookup tables) selftest and freshness
run: |
set -euo pipefail
python3 scripts/skill_index.py --selftest
python3 scripts/skill_index.py --check
# A "`<file>.md` **<Section>**" pointer must resolve in that file, so a split or
# rename of a reference cannot silently orphan the pointers to it.
- name: Skill section pointers resolve
run: |
set -euo pipefail
python3 scripts/check_section_pointers.py --selftest
python3 scripts/check_section_pointers.py
# A doc number bound to a source command with `<!-- derived: CMD -->N`
# must equal the command's output, so a stale count fails here.
- name: Derived doc numbers match their source commands
run: |
set -euo pipefail
python3 scripts/test_derived_numbers.py
python3 .claude/skills/deep-code-review/scripts/derived_numbers.py .
# Every fix(...) commit in the pushed/PR range must touch a test surface
# or carry a non-empty No-Test-Reason: trailer. Fails closed on an
# unresolvable range (e.g. the all-zeros before-SHA of a new branch).
# A shipped script is deliberately NOT its own test surface: editing the
# script under test would satisfy the gate by itself (fail-open). Known
# limitation: touching ANY skill's evals/evals.json satisfies it, not
# only the fixed skill's.
- name: Fix commits carry a pinned test
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
set -euo pipefail
python3 .claude/skills/deep-code-review/scripts/fix_class_gate.py \
--base "$BASE_SHA" --head "$HEAD_SHA" \
--test-glob '.claude/skills/*/evals/evals.json' \
--test-glob 'scripts/test-ci-gates.sh' \
--test-glob 'scripts/test_*.py' \
--test-glob 'scripts/test-mktemp-tmpdir.sh'
# Review tiers (agentic-delivery/templates/review-tiers.tsv): a tier-1
# commit needs `Model: opus` plus an independent, receipted
# `Reviewed-By: <id> receipt:<sha|path|url>` trailer. ADVISORY here: it
# prints every finding (merge commits on the first-parent line
# included) and never fails the build, because this repo's history
# predates the trailers and one shared account cannot prove reviewer
# independence. Release squash commits carry both trailers.
- name: Review tiers (advisory)
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: python3 .claude/skills/agentic-delivery/scripts/tier_gate.py --advisory "$BASE_SHA..$HEAD_SHA"
# Lesson -> mechanism: a commit that edits skill prose (a SKILL.md or a
# references/*.md) must also land an executable mechanism (an eval, a
# shipped script, or a gate self-test case) or carry a non-empty
# No-Mechanism-Reason: trailer, so a filed lesson cannot stay prose that
# never fires. Same gate implementation, range, and fail-closed exits as
# the fix-class step above, except that merge commits are judged by their
# own changes and a SKILL.md version-stamp-only bump is not a trigger.
# Here a shipped script DOES count: in this mode the script is the
# mechanism being added, not the code under test.
# Known limitation: it proves a mechanism path was touched, not that the
# mechanism pins the lesson (review judges that).
- name: Prose lessons carry a mechanism
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
set -euo pipefail
python3 .claude/skills/deep-code-review/scripts/fix_class_gate.py \
--base "$BASE_SHA" --head "$HEAD_SHA" \
--trigger-glob '.claude/skills/*/references/*.md' \
--trigger-glob '.claude/skills/*/SKILL.md' \
--test-glob '.claude/skills/*/evals/evals.json' \
--test-glob '.claude/skills/*/scripts/*' \
--test-glob 'scripts/test-ci-gates.sh' \
--test-glob 'scripts/test-*.sh' \
--test-glob 'scripts/test_*.py'
# Lesson replay (ADVISORY signal, not proof): the step above proves a
# mechanism path was touched; this one looks for a tie between the
# mechanism and the lesson. Each prose-lesson commit prints REPLAYS (a
# changed eval case names a term the lesson newly added, or reverting a
# changed script hunk fails an assertion in its selftest), VACUOUS (no
# tie found), or COULD_NOT_CHECK with a reason. Token overlap is
# gameable; a reviewer judges every line. It exits 0 on VACUOUS and
# fails closed (exit 2) only on an unresolvable range, like the gate
# above. Adding `--gate` makes VACUOUS (only VACUOUS) exit 1;
# COULD_NOT_CHECK never blocks.
- name: Lesson mechanisms replay (advisory)
timeout-minutes: 15
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
set -euo pipefail
python3 scripts/lesson_replay.py --selftest
python3 scripts/lesson_replay.py --base "$BASE_SHA" --head "$HEAD_SHA"
# A size-budget row may only rise with a `size-budget-raise:` marker
# (commit range or CHANGELOG) — budgets ratchet down by default.
- name: Size budgets ratchet down
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: bash scripts/ci-gates.sh size-ratchet --base "$BASE_SHA" --config scripts/size-budgets.tsv .
# The rule-enforcement baseline may only grow with a
# `rule-baseline-raise: <reason>` commit-message line.
- name: Rule baseline ratchets down
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: bash scripts/ci-gates.sh rules --baseline scripts/rule-enforcement-baseline.tsv --base "$BASE_SHA" .
- name: SKILL.md name matches its directory
run: |
set -euo pipefail
# Every shipped skill's frontmatter name must equal its directory (not
# just deep-code-review) — an overlay cannot ship with a mismatched
# name that the routing/version gates would miss.
for d in .claude/skills/*/; do
skill="$(basename "$d")"
grep -qE "^name: ${skill}\$" "${d}SKILL.md" \
|| { echo "name: does not match directory for ${skill}"; exit 1; }
done
- name: install.sh parses
run: bash -n install.sh
# Execute the fabrication-refusal evals offline: each deterministic
# predicate must separate a fabricated answer (red fixture) from a refusal
# (good fixture). No model, no network, no spend — the discrimination is
# the property under test. The same gate the self-tests pin above.
- name: Fabrication-refusal predicates discriminate (offline, no model)
run: python3 scripts/eval_predicates.py --selftest
# Prove the split-rubric eval RUNNER's own guards, offline: dry-run
# enumerates + classifies every eval (hard = a deterministic predicate is
# bound; soft = needs the live judge), the decorrelation guard aborts on an
# equal-or-missing model id, and the live path refuses without configuration
# (its model-call site is an un-built stub). No model, no network, no spend —
# the guards are the property under test. The live judge itself is owner-gated.
- name: Eval runner guards hold (offline, no model)
run: python3 scripts/run-evals.py --selftest
# Guards .gitleaks.toml: the fixture allowlist must not blind the scanner (full history needed for the history scan).
gitleaks:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install gitleaks 8.30.1 (pinned sha256)
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks_8.30.1_linux_x64.tar.gz" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf gitleaks_8.30.1_linux_x64.tar.gz -C "$RUNNER_TEMP/bin" gitleaks
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Allowlist guard
run: REQUIRE_GITLEAKS=1 bash scripts/test_gitleaks_allowlist.sh
# The review_checks.sh stub tests never run a real scanner. This job installs the real tfsec, ansible-lint, rubocop, cfn-lint, pmd, solhint, hadolint, bandit, ruff, actionlint, zizmor, gosec, staticcheck, kube-linter, flawfinder, detect-secrets, gitleaks, trufflehog, checkov, kube-score, kubescape, semgrep, njsscan, tflint, kics, cppcheck, devskim, govulncheck, grype, trivy, osv-scanner, shellcheck and guarddog
# (pinned, hash-locked where the ecosystem allows; no advisory-DB download, except govulncheck, grype, trivy and osv-scanner, which fetch their vulnerability DB online: trivy by pinned digest, the rest live) and checks each is RAN with its rule id on one canary. bundler-audit and retire need a downloaded DB or rule set, so they stay stub-only; syft is an inventory the hub never counts as ran.
real-hub:
runs-on: ubuntu-24.04 # pinned: the cppcheck .deb below is the noble build and its runtime deps come from noble
timeout-minutes: 35
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install tfsec 1.28.11 (pinned sha256)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -o "$RUNNER_TEMP/bin/tfsec" https://github.com/aquasecurity/tfsec/releases/download/v1.28.11/tfsec-linux-amd64
echo "18e2f947a4f0ec74bf6db07245fc81f83930835ef1b5d51d2d5152a6548b5e45 $RUNNER_TEMP/bin/tfsec" | sha256sum -c -
chmod +x "$RUNNER_TEMP/bin/tfsec"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.13"
- name: Install ansible-lint, ansible-core, cfn-lint, bandit, ruff, zizmor, flawfinder and detect-secrets (hash-locked, venv)
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/venv"
"$RUNNER_TEMP/venv/bin/pip" install --quiet --require-hashes --only-binary=:all: -r scripts/real-hub-requirements.txt
echo "$RUNNER_TEMP/venv/bin" >> "$GITHUB_PATH"
# upstream detect-secrets, not the bc-detect-secrets fork that checkov pulls in (same module name)
"$RUNNER_TEMP/venv/bin/detect-secrets" --version | grep -qx 1.5.0
- name: Install checkov (hash-locked, own venv so bc-detect-secrets cannot shadow detect-secrets)
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/venv-checkov"
"$RUNNER_TEMP/venv-checkov/bin/pip" install --quiet --require-hashes --only-binary=:all: -r scripts/real-hub-requirements-checkov.txt
mkdir -p "$RUNNER_TEMP/bin"
ln -s "$RUNNER_TEMP/venv-checkov/bin/checkov" "$RUNNER_TEMP/bin/checkov"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Install semgrep and njsscan (hash-locked, own venv so their older click, jsonschema and wcmatch pins stay off the other tools)
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/venv-semgrep"
"$RUNNER_TEMP/venv-semgrep/bin/pip" install --quiet --require-hashes --only-binary=:all: -r scripts/real-hub-requirements-semgrep.txt
mkdir -p "$RUNNER_TEMP/bin"
for t in semgrep pysemgrep njsscan; do ln -s "$RUNNER_TEMP/venv-semgrep/bin/$t" "$RUNNER_TEMP/bin/$t"; done
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Run insecure-defaults semgrep fixtures (fail on SKIP, so the live check cannot silently skip)
run: |
set -euo pipefail
PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" python3 scripts/test_semgrep_defaults.py | tee "$RUNNER_TEMP/semgrep-defaults.log"
if grep -q SKIP "$RUNNER_TEMP/semgrep-defaults.log"; then echo "semgrep fixture check skipped; failing"; exit 1; fi
- name: Run Go and JS path-traversal, Python SSTI and audit-class semgrep fixtures (REQUIRE_SEMGREP=1, fails if semgrep missing)
run: PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_go_pathtrav.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_js_pathconfine.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_py_ssti.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_js_proto_pollution.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_rb_yaml_load.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_audit_classes.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_llm_context.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_input_exposure.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_inventory.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_logging.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 scripts/test_semgrep_webhook.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_semgrep_upload.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_semgrep_llm_rules.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_semgrep_raw_sql_allowlist.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_semgrep_taint.py && PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_semgrep_js_parser_express4.py
- name: Install rubocop 1.69.2 (pinned, private GEM_HOME)
run: |
set -euo pipefail
gem install --no-document --install-dir "$RUNNER_TEMP/gems" --bindir "$RUNNER_TEMP/gems/bin" rubocop -v 1.69.2
echo "GEM_HOME=$RUNNER_TEMP/gems" >> "$GITHUB_ENV"
echo "$RUNNER_TEMP/gems/bin" >> "$GITHUB_PATH"
- name: Install solhint 6.2.5, eslint 9.39.5 and eslint-plugin-security 4.2.1 (package-lock integrity hashes)
run: |
set -euo pipefail
npm ci --ignore-scripts --silent --no-audit --no-fund --prefix scripts/real-hub-npm
echo "$GITHUB_WORKSPACE/scripts/real-hub-npm/node_modules/.bin" >> "$GITHUB_PATH"
- name: Install hadolint 2.15.1 (pinned sha256)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -o "$RUNNER_TEMP/bin/hadolint" https://github.com/hadolint/hadolint/releases/download/v2.15.1/hadolint-linux-x86_64
echo "c7187db94eeeeca956519a6af171adc31453941a1e777961f6e680f697c8c507 $RUNNER_TEMP/bin/hadolint" | sha256sum -c -
chmod +x "$RUNNER_TEMP/bin/hadolint"
- name: Install actionlint 1.7.12 (pinned sha256)
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 actionlint_1.7.12_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf actionlint_1.7.12_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" actionlint
- name: Install PMD 7.29.0 (pinned sha256; the runner's preinstalled Java)
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.29.0/pmd-dist-7.29.0-bin.zip
echo "d27177c185b837fa57f097e482d1253468aa035379c5eb2671fa0a279109b179 pmd-dist-7.29.0-bin.zip" | sha256sum -c -
unzip -q pmd-dist-7.29.0-bin.zip
echo "$RUNNER_TEMP/pmd-bin-7.29.0/bin" >> "$GITHUB_PATH"
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26.11"
- name: Install gosec 2.30.0, staticcheck 2026.2.2 and kube-linter 0.8.3 (pinned sha256)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/securego/gosec/releases/download/v2.30.0/gosec_2.30.0_linux_amd64.tar.gz
echo "3fcce2c4e802ff4169217874602a7df355e9a37bcb6ffaa34b08f3d5f336cdfb gosec_2.30.0_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf gosec_2.30.0_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" gosec
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/dominikh/go-tools/releases/download/2026.2.2/staticcheck_linux_amd64.tar.gz
echo "14c081e0f0d05b5a4d4c53fd3d357d4a5af9d20501465fefc9024ee828d3aa5c staticcheck_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf staticcheck_linux_amd64.tar.gz --strip-components=1 -C "$RUNNER_TEMP/bin" staticcheck/staticcheck
# kube-linter sha256 = the `digest` field of release asset kube-linter-linux.tar.gz on the v0.8.3 GitHub release (GitHub API, checked 2026-11-13)
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/stackrox/kube-linter/releases/download/v0.8.3/kube-linter-linux.tar.gz
echo "1a6d8419b11971372971fdbc22682b684ebfb7cf1c39591662d1b6ca736c41df kube-linter-linux.tar.gz" | sha256sum -c -
tar -xzf kube-linter-linux.tar.gz -C "$RUNNER_TEMP/bin" kube-linter
- name: Install gitleaks 8.30.1, trufflehog 3.99.9 and kube-score 1.20.0 (pinned sha256 from each upstream checksums file)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks_8.30.1_linux_x64.tar.gz" | sha256sum -c -
tar -xzf gitleaks_8.30.1_linux_x64.tar.gz -C "$RUNNER_TEMP/bin" gitleaks
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/trufflesecurity/trufflehog/releases/download/v3.99.9/trufflehog_3.99.9_linux_amd64.tar.gz
echo "12050095c8063bf4d34f9f6cbce6ba9fa8d0deea9d503d0570364feba093658e trufflehog_3.99.9_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf trufflehog_3.99.9_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" trufflehog
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/zegl/kube-score/releases/download/v1.20.0/kube-score_1.20.0_linux_amd64.tar.gz
echo "ff777b4b3f45905b2d22c69e93c57a7a170e61529a79d54e59cb95cca4bc2a55 kube-score_1.20.0_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf kube-score_1.20.0_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" kube-score
- name: Install kubescape 3.0.48 and its offline frameworks (pinned sha256; the frameworks are regolibrary v1.0.316 assets, which publish no checksums, so their hashes were recorded at pin time)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin" "$RUNNER_TEMP/kubescape-artifacts"
cd "$RUNNER_TEMP"
f() { curl --proto '=https' --tlsv1.2 -fsSL --retry 3 --retry-delay 5 --retry-all-errors -o "$1" "$2"; }
f kubescape_3.0.48_linux_amd64.tar.gz https://github.com/kubescape/kubescape/releases/download/v3.0.48/kubescape_3.0.48_linux_amd64.tar.gz
echo "d7bb9a8faf4f943835c31573f015b0c03386fc038107a53bece9cc4750ddb401 kubescape_3.0.48_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf kubescape_3.0.48_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" kubescape
f kubescape-artifacts/nsa.json https://github.com/kubescape/regolibrary/releases/download/v1.0.316/nsa
f kubescape-artifacts/cis-v1.23-t1.0.1.json https://github.com/kubescape/regolibrary/releases/download/v1.0.316/cis-v1.23-t1.0.1
echo "9f927eba6d9bca745dff7cf107f0633e2c25da907e9c1d46edf92f5aa88b9986 kubescape-artifacts/nsa.json" | sha256sum -c -
echo "24b84094cb34e644a547e386f1aadd9af49e34bb0853c946bcfc970d30373c4b kubescape-artifacts/cis-v1.23-t1.0.1.json" | sha256sum -c -
echo "KUBESCAPE_ARTIFACTS=$RUNNER_TEMP/kubescape-artifacts" >> "$GITHUB_ENV"
- name: Install tflint 0.66.0 (pinned sha256 from the release checksums.txt; the bundled terraform ruleset, no plugin download)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/terraform-linters/tflint/releases/download/v0.66.0/tflint_linux_amd64.zip
echo "22be11cadc25cd02401e94c0ccc91aa63467debb8485c2a755d98f4c0a9d1e2e tflint_linux_amd64.zip" | sha256sum -c -
unzip -q -o tflint_linux_amd64.zip tflint -d "$RUNNER_TEMP/bin"
- name: Install kics 2.1.20 (pinned sha256 from the release checksums.txt; queries from the release's pinned commit)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/Checkmarx/kics/releases/download/v2.1.20/kics_2.1.20_linux_amd64.tar.gz
echo "8a5aa375ccfdc0ddd1114eddf1f9638ad7f6122e98d12a592207509dbe6d81f8 kics_2.1.20_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf kics_2.1.20_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" kics
# the release tarball ships no queries: fetch the v2.1.20 commit by its full sha (content-addressed) and check it
git init -q kics-src
git -C kics-src fetch -q --depth 1 https://github.com/Checkmarx/kics.git e1f23cad9640f55b963f22a116b04906b8c16ac6
test "$(git -C kics-src rev-parse FETCH_HEAD)" = e1f23cad9640f55b963f22a116b04906b8c16ac6
git -C kics-src checkout -q --detach FETCH_HEAD
echo "KICS_QUERIES_PATH=$RUNNER_TEMP/kics-src/assets/queries" >> "$GITHUB_ENV"
echo "KICS_LIBRARIES_PATH=$RUNNER_TEMP/kics-src/assets/libraries" >> "$GITHUB_ENV"
- name: Install cppcheck 2.13.0-2ubuntu3 (pinned .deb sha256 from Launchpad's published-binary record; runtime deps via apt)
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://launchpad.net/ubuntu/+archive/primary/+files/cppcheck_2.13.0-2ubuntu3_amd64.deb
echo "c84251e17148b6b4ff3698bb71ceec0f445896d97888bedad8bba471c00aeadf cppcheck_2.13.0-2ubuntu3_amd64.deb" | sha256sum -c -
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends "$RUNNER_TEMP/cppcheck_2.13.0-2ubuntu3_amd64.deb"
- name: Install DevSkim CLI 1.0.100 (nupkg pinned sha512 = the nuget.org catalog packageHash; installed from the local file)
env:
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
DOTNET_NOLOGO: "1"
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/nupkg"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -o "$RUNNER_TEMP/nupkg/microsoft.cst.devskim.cli.1.0.100.nupkg" https://api.nuget.org/v3-flatcontainer/microsoft.cst.devskim.cli/1.0.100/microsoft.cst.devskim.cli.1.0.100.nupkg
test "$(openssl dgst -sha512 -binary "$RUNNER_TEMP/nupkg/microsoft.cst.devskim.cli.1.0.100.nupkg" | base64 -w0)" = "WSAI8ReSrSF6BdM1ZWe2uupS7PrjSr9/1c0eor9kCPL6e6pt8t3OfCo8fqrWvzlutgSb7kbozg4wFPjvpqRTPA=="
# package signature check only where the runner's dotnet ships the verb
if dotnet nuget verify --help >/dev/null 2>&1; then dotnet nuget verify "$RUNNER_TEMP/nupkg/microsoft.cst.devskim.cli.1.0.100.nupkg"; fi
dotnet tool install Microsoft.CST.DevSkim.CLI --version 1.0.100 --tool-path "$RUNNER_TEMP/devskim" --add-source "$RUNNER_TEMP/nupkg"
echo "$RUNNER_TEMP/devskim" >> "$GITHUB_PATH"
- name: Install govulncheck 1.9.0 (source build on the pinned Go 1.26.11; module hash pinned, checksum DB verified; the vuln DB vuln.go.dev is fetched online at run time, not pinned)
env:
GOTOOLCHAIN: local
GOBIN: ${{ runner.temp }}/bin
run: |
set -euo pipefail
# bounded retry (3 tries, 10s then 20s backoff) for a transient proxy error
for i in 1 2 3; do if go install golang.org/x/vuln/cmd/govulncheck@v1.9.0; then break; fi; [ "$i" -lt 3 ] || exit 1; sleep $((i * 10)); done
go version -m "$RUNNER_TEMP/bin/govulncheck" | grep -qE "golang.org/x/vuln[[:space:]]+v1.9.0[[:space:]]+h1:12VaqnI9kJfqwRoPptxoqsUhQtdfrSbdksT7X/KY/sc="
- name: Install grype 0.121.3 (pinned sha256 from the release checksums file; vulnerability DB fetched online, checksum-verified by grype, not pinned)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/anchore/grype/releases/download/v0.121.3/grype_0.121.3_checksums.txt
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/anchore/grype/releases/download/v0.121.3/grype_0.121.3_linux_amd64.tar.gz
test "$(grep -cF ' grype_0.121.3_linux_amd64.tar.gz' grype_0.121.3_checksums.txt)" = 1
grep -F ' grype_0.121.3_linux_amd64.tar.gz' grype_0.121.3_checksums.txt | sha256sum -c -
echo "e9da18cc1429e786722e32161288103600efffd8e483c90761f90485bd1bec85 grype_0.121.3_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf grype_0.121.3_linux_amd64.tar.gz -C "$RUNNER_TEMP/bin" grype
for i in 1 2 3; do if GRYPE_CHECK_FOR_APP_UPDATE=false "$RUNNER_TEMP/bin/grype" db update; then break; fi; [ "$i" -lt 3 ] || exit 1; sleep $((i * 10)); done
- name: Install trivy 0.76.2 (pinned sha256 from the release checksums file; vuln DB pulled by OCI digest; misconfig checks = the bundle embedded in the pinned binary)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/aquasecurity/trivy/releases/download/v0.76.2/trivy_0.76.2_checksums.txt
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/aquasecurity/trivy/releases/download/v0.76.2/trivy_0.76.2_checksums.txt.sigstore.json
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -O https://github.com/aquasecurity/trivy/releases/download/v0.76.2/trivy_0.76.2_Linux-64bit.tar.gz
# cosign 3.1.4 pinned by sha256 (the release asset digest); it verifies the checksums file's sigstore bundle against the trivy release workflow identity
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL -o cosign https://github.com/sigstore/cosign/releases/download/v3.1.4/cosign-linux-amd64
echo "424e2c97d0b45fd7a6b608a87f090f35633f4c23ece5f092d48bba11aaf4bbfa cosign" | sha256sum -c -
chmod +x cosign
./cosign verify-blob --bundle trivy_0.76.2_checksums.txt.sigstore.json \
--certificate-identity "https://github.com/aquasecurity/trivy/.github/workflows/reusable-release.yaml@refs/tags/v0.76.2" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" trivy_0.76.2_checksums.txt
grep -F ' trivy_0.76.2_Linux-64bit.tar.gz' trivy_0.76.2_checksums.txt | sha256sum -c -
echo "bc0fc726e017b8927a62b2d3531d7a84ee01769daf5c99ed866dced54089fdbf trivy_0.76.2_Linux-64bit.tar.gz" | sha256sum -c -
tar -xzf trivy_0.76.2_Linux-64bit.tar.gz -C "$RUNNER_TEMP/bin" trivy
# vuln DB: the ghcr trivy-db:2 manifest digest recorded 2026-11-13 (the tag moves daily; a digest the registry later garbage-collects fails this step loudly, bump it then). The hub run itself is offline.
export TRIVY_DISABLE_TELEMETRY=true
dg=ghcr.io/aquasecurity/trivy-db@sha256:f3fc0ea9b0d550c458eff73a503f206a861256dff2a2e4e0513419a3d79fbe7c
for i in 1 2 3; do if "$RUNNER_TEMP/bin/trivy" --cache-dir "$RUNNER_TEMP/trivy-cache" image --download-db-only --db-repository "$dg" >"$RUNNER_TEMP/dbdl.log" 2>&1; then break; fi; cat "$RUNNER_TEMP/dbdl.log"; [ "$i" -lt 3 ] || exit 1; sleep $((i * 10)); done
cat "$RUNNER_TEMP/dbdl.log"
# the cache stores no digest, so assert trivy fetched the pinned digest reference (a digest form it ignored would log the default tag) and wrote a DB
grep -qF "repo=\"$dg\"" "$RUNNER_TEMP/dbdl.log"
test -s "$RUNNER_TEMP/trivy-cache/db/trivy.db"
echo "REVIEW_TRIVY_CACHE=$RUNNER_TEMP/trivy-cache" >> "$GITHUB_ENV"
- name: Install osv-scanner 2.7.1 (pinned sha256 from the release SHA256SUMS) and seed its offline DB
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin" "$RUNNER_TEMP/osv-seed"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/google/osv-scanner/releases/download/v2.7.1/osv-scanner_SHA256SUMS
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/google/osv-scanner/releases/download/v2.7.1/osv-scanner_linux_amd64
test "$(grep -cF ' osv-scanner_linux_amd64' osv-scanner_SHA256SUMS)" = 1
grep -F ' osv-scanner_linux_amd64' osv-scanner_SHA256SUMS | sha256sum -c -
echo "fb7dab19a8bd9bbe5c3189f09d4b7ee1820c9553a23bac202648a56efd2f6ee8 osv-scanner_linux_amd64" | sha256sum -c -
install -m 0755 osv-scanner_linux_amd64 "$RUNNER_TEMP/bin/osv-scanner"
# the offline DB, pre-seeded the way the hub's own NOT CHECKED message says (the DB is the live OSV npm dump, not pinned); osv-scanner exits 1 when it finds vulnerabilities, so success is a non-empty zip
printf '{"name":"acme-seed","lockfileVersion":3,"requires":true,"packages":{"":{"name":"acme-seed","version":"1.0.0"},"node_modules/lodash":{"version":"4.17.15"}}}\n' > osv-seed/package-lock.json
# a Cargo.lock too: the cargo canary's lockfile is also scanned by osv-scanner, and an ecosystem with no offline DB reads as not run
printf 'version = 3\n\n[[package]]\nname = "acme-seed"\nversion = "1.0.0"\ndependencies = [\n "time",\n]\n\n[[package]]\nname = "time"\nversion = "0.1.45"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\n' > osv-seed/Cargo.lock
# a go.mod too: the govulncheck canary's go.mod is also scanned by osv-scanner, and an ecosystem with no offline DB reads as not run
printf 'module example.com/acmeseed\n\ngo 1.22\n\nrequire golang.org/x/text v0.3.7\n' > osv-seed/go.mod
# a requirements.txt too: the a03-deps class seed is a PyPI requirements.txt scanned by osv-scanner, and an ecosystem with no offline DB reads as not run
printf 'flask==0.12.2\n' > osv-seed/requirements.txt
for i in 1 2 3; do
(cd osv-seed && OSV_SCANNER_LOCAL_DB_CACHE_DIRECTORY="$RUNNER_TEMP/osv-db" "$RUNNER_TEMP/bin/osv-scanner" --offline-vulnerabilities --download-offline-databases .) || true
# one verified zip per seeded ecosystem (npm, crates.io, Go, PyPI)
if zs=$(find "$RUNNER_TEMP/osv-db" -type f -name '*.zip' -size +0 2>/dev/null) && [ "$(printf '%s\n' "$zs" | grep -c .)" -ge 4 ] && printf '%s\n' "$zs" | while IFS= read -r z; do unzip -tq "$z" >/dev/null || exit 1; done; then break; fi
[ "$i" -lt 3 ] || { echo "osv-scanner offline DB download failed (need an npm, a crates.io, a Go and a PyPI zip)"; exit 1; }
sleep $((i * 10))
done
echo "REVIEW_OSV_DB_DIR=$RUNNER_TEMP/osv-db" >> "$GITHUB_ENV"
- name: Install shellcheck 0.11.0 (pinned sha256; the release publishes no checksums file, so the pin is the asset digest from the release API, re-verified against a fresh download)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.x86_64.tar.xz
echo "8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 shellcheck-v0.11.0.linux.x86_64.tar.xz" | sha256sum -c -
tar -xJf shellcheck-v0.11.0.linux.x86_64.tar.xz --strip-components=1 -C "$RUNNER_TEMP/bin" shellcheck-v0.11.0/shellcheck
test "$("$RUNNER_TEMP/bin/shellcheck" --version | sed -n 's/^version: //p')" = 0.11.0
- name: Install guarddog 3.2.0 (hash-locked, own venv, so its boto3, cryptography, pygit2, pydantic and yara-python pins stay off the other venvs)
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/venv-guarddog"
"$RUNNER_TEMP/venv-guarddog/bin/pip" install --quiet --retries 5 --require-hashes --only-binary=:all: -r scripts/real-hub-requirements-guarddog.txt
mkdir -p "$RUNNER_TEMP/bin"
ln -s "$RUNNER_TEMP/venv-guarddog/bin/guarddog" "$RUNNER_TEMP/bin/guarddog"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: Install cargo-audit 0.23.0 and cargo-deny 0.20.2 (pinned sha256) and the RustSec advisory DB (pinned commit)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
cargo --version
# cargo-audit publishes no checksums file: the pin is the release asset digest from the release API, re-verified against a fresh download
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/rustsec/rustsec/releases/download/cargo-audit%2Fv0.23.0/cargo-audit-x86_64-unknown-linux-gnu-v0.23.0.tgz
echo "b77993532b253fcbf550996d7716465ec3d734d4e74e7f87bfb65a19add0fb59 cargo-audit-x86_64-unknown-linux-gnu-v0.23.0.tgz" | sha256sum -c -
tar -xzf cargo-audit-x86_64-unknown-linux-gnu-v0.23.0.tgz --strip-components=1 -C "$RUNNER_TEMP/bin" cargo-audit-x86_64-unknown-linux-gnu-v0.23.0/cargo-audit
# cargo-deny publishes a .sha256 per asset: check the tarball against it and against the literal pin
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/EmbarkStudios/cargo-deny/releases/download/0.20.2/cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://github.com/EmbarkStudios/cargo-deny/releases/download/0.20.2/cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz.sha256
echo "$(cat cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz.sha256) cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz" | sha256sum -c -
echo "9f12ed4c49936e09b48bf862b595cde2fe64fcbd9d74dfacac6131ca824c8d5f cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz" | sha256sum -c -
tar -xzf cargo-deny-0.20.2-x86_64-unknown-linux-musl.tar.gz --strip-components=1 -C "$RUNNER_TEMP/bin" cargo-deny-0.20.2-x86_64-unknown-linux-musl/cargo-deny
"$RUNNER_TEMP/bin/cargo-deny" --version | grep -qF 0.20.2
# advisory DB at the path the hub reads: the RustSec/advisory-db commit recorded 2026-11-13, fetched by its full sha (content-addressed, so a changed object cannot match); the hub run is --no-fetch --stale
db="${CARGO_HOME:-$HOME/.cargo}/advisory-db"
sha=4ef2df8e806a65e2f1ecc14f56f51249062b23d6
mkdir -p "$db"
git init -q "$db"
for i in 1 2 3; do if git -C "$db" fetch -q --depth 1 https://github.com/RustSec/advisory-db.git "$sha"; then break; fi; [ "$i" -lt 3 ] || exit 1; sleep $((i * 10)); done
test "$(git -C "$db" rev-parse FETCH_HEAD)" = "$sha"
git -C "$db" checkout -q --detach FETCH_HEAD
test -f "$db/crates/time/RUSTSEC-2020-0071.md"
- name: Install brakeman 8.1.0 (pinned .gem sha256 from the rubygems.org versions API; private GEM_HOME; racc comes from Ruby's own default or bundled gems)
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 --retry-all-errors -fsSL -O https://rubygems.org/downloads/brakeman-8.1.0.gem
echo "cfa9e5214e4925842f4bc849a64f8a7e6c5d0425fe98eac8d7b7bc60fdc17e07 brakeman-8.1.0.gem" | sha256sum -c -
gem install --local --no-document --ignore-dependencies --install-dir "$RUNNER_TEMP/gems" --bindir "$RUNNER_TEMP/gems/bin" ./brakeman-8.1.0.gem
GEM_HOME="$RUNNER_TEMP/gems" "$RUNNER_TEMP/gems/bin/brakeman" --version | grep -qF 8.1.0
- name: Install mobsfscan 1.1.0 (hash-locked, own venv, a wrapper puts it first on PATH so mobsfscan runs its pinned semgrep 1.172.0 and not the njsscan venv one)
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/venv-mobsfscan"
"$RUNNER_TEMP/venv-mobsfscan/bin/pip" install --quiet --retries 5 --require-hashes --only-binary=:all: -r scripts/real-hub-requirements-mobsfscan.txt
mkdir -p "$RUNNER_TEMP/bin"
cat > "$RUNNER_TEMP/bin/mobsfscan" <<EOF
#!/bin/sh
PATH="$RUNNER_TEMP/venv-mobsfscan/bin:\$PATH" exec "$RUNNER_TEMP/venv-mobsfscan/bin/mobsfscan" "\$@"
EOF
chmod +x "$RUNNER_TEMP/bin/mobsfscan"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
"$RUNNER_TEMP/venv-mobsfscan/bin/python" -c "import importlib.metadata as m; assert m.version('semgrep') == '1.172.0', m.version('semgrep')"
- name: Install nuclei 3.11.1 and nuclei-templates v10.5.2 (pinned sha256; the binary hash is the upstream checksums-file entry, the templates hash is of the GitHub tag archive)
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/bin"
cd "$RUNNER_TEMP"
curl --proto '=https' --tlsv1.2 -fsSL --retry 3 --max-time 300 -O https://github.com/projectdiscovery/nuclei/releases/download/v3.11.1/nuclei_3.11.1_linux_amd64.zip
echo "ea63d4ae232808cd7c6bc00d0142428e231fab59dae01042246097d195835ab6 nuclei_3.11.1_linux_amd64.zip" | sha256sum -c -
unzip -q nuclei_3.11.1_linux_amd64.zip nuclei -d "$RUNNER_TEMP/bin"
curl --proto '=https' --tlsv1.2 -fsSL --retry 3 --max-time 300 -o nuclei-templates.tar.gz https://github.com/projectdiscovery/nuclei-templates/archive/refs/tags/v10.5.2.tar.gz
echo "016b7abbf931d4d1a851a5a568e44510dc61691dc8a5202e3b24e701515ec574 nuclei-templates.tar.gz" | sha256sum -c -
mkdir -p "$HOME/nuclei-templates"
tar -xzf nuclei-templates.tar.gz --strip-components=1 -C "$HOME/nuclei-templates"
- name: Class seeds with every tool installed (REQUIRE_SEMGREP=1, so no seed may skip)
run: PATH="$RUNNER_TEMP/venv-semgrep/bin:$PATH" REQUIRE_SEMGREP=1 python3 -I scripts/test_class_seeds.py
- name: Real-tool canaries
run: REQUIRE_REAL_HUB=1 bash scripts/test-review-checks-real-hub.sh
- name: Tool-only bench (frozen recall floor and false-positive ceiling, no model spend)
run: REQUIRE_REAL_HUB=1 python3 scripts/bench_tool_only.py
# Branch protection requires a check named exactly `gates`: it passes only when every shard job succeeded.
gates:
needs: [selftests, enforce, perpr, evals, cheap, gitleaks, real-hub]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- run: |
[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" = false ]