Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
199e902
test(guardrails): make jq output CR-free on Windows in four suites
kyle-sexton Sep 30, 2026
ee7699d
test(guardrails): open hooks.json through cygpath in run-guards.test.sh
kyle-sexton Sep 30, 2026
14f80f3
test(guardrails): make block-hook-bypass symlink fixtures real or cou…
kyle-sexton Sep 30, 2026
251e661
fix(hook-utils): add cygpath drive spellings to the temp-root candidates
kyle-sexton Sep 30, 2026
7d19eca
test(hook-utils): count stub cygpath calls with builtins
kyle-sexton Sep 30, 2026
aa6042b
ci(test-windows): temporary run-guards diagnosis step
kyle-sexton Sep 30, 2026
2041e9f
test(guardrails): scope MSYS_NO_PATHCONV to jq and build the 70 KB pa…
kyle-sexton Sep 30, 2026
3a8c380
fix(guardrails): block-windows-drive-tmp skips its cygpath probe for …
kyle-sexton Sep 30, 2026
02af3d4
ci(test-windows): remove the temporary run-guards diagnosis step
kyle-sexton Sep 30, 2026
9670cbe
ci(test-windows): run the block-hook-bypass, secret-pattern-detection…
kyle-sexton Sep 30, 2026
fb65d50
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
8d70e8e
chore(plugins): bump versions for the hook-utils temp-root sync and g…
kyle-sexton Sep 30, 2026
9d7e73d
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
708ab8a
ci(test-windows): run coverage-manifest in the Windows lane
kyle-sexton Sep 30, 2026
cfcb432
fix(guardrails): probe for a jq-less PATH with type -P in the block-h…
kyle-sexton Sep 30, 2026
b57af5f
fix(guardrails): keep secret-pattern-detection's non-temp Windows wri…
kyle-sexton Sep 30, 2026
ee8f42a
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
1bd3336
ci(test-windows): run the guardrails suites in a Windows job of their…
kyle-sexton Sep 30, 2026
56fd1ed
ci(test-windows): state the measured margin that puts the guardrails …
kyle-sexton Sep 30, 2026
205b622
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
3509d81
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
dff8c6b
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
d408b23
test(guardrails): skip the POSIX-spelled PowerShell exempt-root rows …
kyle-sexton Sep 30, 2026
f858f22
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
1d5f1a9
test(guardrails): print the PowerShell POSIX-row skip without the sym…
kyle-sexton Sep 30, 2026
172e3cf
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
3fd492f
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
fc833ac
test(guardrails): rename the no-drive result variable so typos accept…
kyle-sexton Sep 30, 2026
4ef2df0
fix(guardrails): secret-pattern-detection reaches a custom temp root …
kyle-sexton Sep 30, 2026
2e07d28
Merge remote-tracking branch 'origin/main' into fix/4527-guardrails-w…
kyle-sexton Sep 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 46 additions & 23 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ jobs:
**/*.psm1
**/*.psd1

# The ONLY job on a Windows runner in this repository, and deliberately so.
# Every other suite is platform-agnostic bash string logic that a Linux runner
# One of the only two jobs on a Windows runner in this repository, and
# deliberately so; `test-windows-guardrails` below is the other. Every other
# suite is platform-agnostic bash string logic that a Linux runner
# exercises identically — `lib/powershell/ps-command.sh`, for instance,
# carries zero `OSTYPE`/`cygpath`/`uname` branches despite classifying
# PowerShell commands, so Linux tests it faithfully.
Expand All @@ -178,21 +179,7 @@ jobs:
# Keep this job SMALL. Adding a platform-agnostic suite here buys no coverage
# and pays Windows' process-creation cost (~140ms/spawn vs ~3ms on Linux).
#
# GUARDRAILS (#4527). Six suites failed on a Windows 11 Git Bash host and
# none of them ran here. Triage, against this job's 20-minute timeout:
# block-windows-drive-tmp — OSTYPE/cygpath writer lane. Runs here.
# hardcoded-path-check — cygpath repo-relative telemetry. Runs here.
# run-guards — NOT here yet. The git.exe shim fixes the post-verify count,
# but the Windows run still fails its hooks.json dispatch-table, BASHPID
# and post-lane merge cases; each needs its own triage.
# secret-pattern-detection, block-hook-bypass — NOT here yet. Their temp
# exemptions need hook::physical_path_to to follow symlinks, and Git Bash
# offers no resolver it can trust, so on this host the exemption fails
# closed and the D1 / `windows temp:` cases block. A cygpath fallback was
# rejected: cygpath does not follow symlinks, which reopens #3727.
# coverage-manifest — README/permissions sync. It passes on Linux and has
# no OSTYPE branch, so it stays on the Linux lane.
# A host-gated case that cannot run must print a counted SKIP line.
# The guardrails suites run in `test-windows-guardrails`, not here.
#
# HOST-SKIP SUITES (#3683). Three suites probe the host at run time and two
# print a SKIP line when they cannot pin their cases, so their Windows
Expand Down Expand Up @@ -263,12 +250,6 @@ jobs:
# discovered.
- name: Test the file-name rename executor on Windows
run: bash plugins/docs-hygiene/skills/realign-file-names/scripts/apply-rename.test.sh
# Guardrails suites whose guards branch on OSTYPE, cygpath, or MSYS
# (#4527). coverage-manifest is a README sync check and stays on Linux.
- name: Test block-windows-drive-tmp on Windows
run: bash plugins/guardrails/hooks/block-windows-drive-tmp.test.sh
- name: Test hardcoded-path-check on Windows
run: bash plugins/guardrails/hooks/hardcoded-path-check.test.sh
# The host-skip suites of #3683, named explicitly: each probes the host at
# run time, so a green step is only evidence once its log shows whether
# the probe fired or the cases ran.
Expand Down Expand Up @@ -325,3 +306,45 @@ jobs:
run: node --test lib/exec-bash.resolver.test.mjs
- name: Test the guardrails exec-bash launcher on Windows
run: bash plugins/guardrails/hooks/exec-bash.test.sh

# GUARDRAILS (#4527). The guardrails suites whose guards branch on OSTYPE,
# cygpath or MSYS run here: block-windows-drive-tmp, hardcoded-path-check,
# block-hook-bypass, secret-pattern-detection, run-guards and
# coverage-manifest. coverage-manifest has no OSTYPE branch, but the native
# `jq.exe` on a Windows host writes CRLF after every line, so its family and
# README lookups miss there and only a Windows run exercises that. Each suite
# is a step of its own so its log shows its own duration. They are a job of
# their own because added to `test-windows`'s steps they leave under a minute
# of margin below its 20-minute timeout. A host-gated case that cannot run
# must print a counted SKIP line.
test-windows-guardrails:
needs:
- changes
# `test-windows`'s gate, verbatim.
if: ${{ !(github.event.pull_request.head.repo.full_name == github.repository && (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || (github.event.action == 'edited' && !github.event.changes.base))) && needs.changes.outputs.run_windows == 'true' }}
runs-on: windows-2025
timeout-minutes: 20
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: .python-version
- name: Test block-windows-drive-tmp on Windows
run: bash plugins/guardrails/hooks/block-windows-drive-tmp.test.sh
- name: Test hardcoded-path-check on Windows
run: bash plugins/guardrails/hooks/hardcoded-path-check.test.sh
- name: Test block-hook-bypass on Windows
run: bash plugins/guardrails/hooks/block-hook-bypass.test.sh
- name: Test secret-pattern-detection on Windows
run: bash plugins/guardrails/hooks/secret-pattern-detection.test.sh
- name: Test run-guards on Windows
run: bash plugins/guardrails/hooks/run-guards.test.sh
- name: Test coverage-manifest on Windows
run: bash plugins/guardrails/hooks/coverage-manifest.test.sh
84 changes: 81 additions & 3 deletions lib/hook-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,22 @@ hook::_physical_prime() {
# environment's own answer (TMPDIR/TMP/TEMP) plus the POSIX defaults, never a
# hardcoded platform assumption. Existing directories only, each spelling
# once, in _HOOK_TEMP_CANDS.
#
# On a Windows bash (msys, cygwin, win32) with cygpath, the drive spellings of
# those candidates follow them: Cygwin bash reports TEMP and TMP as `/tmp`, so
# without cygpath no candidate is spelled `C:/...` and a drive-spelled target
# never matches. The POSIX spellings stay, because a `/tmp/...` target must
# still match. The long form (`cygpath -l -m`) comes before the mixed form
# (`cygpath -m`) when the two differ, so a long target matches without
# resolving an 8.3 spelling. The drive spellings are looked up once per process
# for a given candidate list: one cygpath process, plus a second only when a
# mixed answer carries an 8.3 `~`. A cygpath that fails, or answers with the
# wrong number of lines, adds nothing, which leaves the POSIX candidates as
# they were. `--no-drive` stops after the environment and POSIX spellings, so a
# caller's lexical pre-match spawns no process.
_HOOK_TEMP_CANDS=()
_HOOK_TEMP_WIN_KEY=""
_HOOK_TEMP_WIN=()
hook::_temp_root_candidates() {
local __hu_cand __hu_seen=""
_HOOK_TEMP_CANDS=()
Expand All @@ -760,14 +775,77 @@ hook::_temp_root_candidates() {
__hu_seen="$__hu_seen|$__hu_cand|"
_HOOK_TEMP_CANDS+=("$__hu_cand")
done
[[ "${1:-}" == --no-drive ]] && return 0
case "${OSTYPE:-}" in
msys* | cygwin* | win32) ;;
*) return 0 ;; # POSIX hosts: the candidates above are the whole set
esac
((${#_HOOK_TEMP_CANDS[@]})) || return 0
if [[ "$_HOOK_TEMP_WIN_KEY" != "$__hu_seen" ]]; then
hook::_temp_win_spellings "${_HOOK_TEMP_CANDS[@]}" || return 0
_HOOK_TEMP_WIN_KEY=$__hu_seen
fi
for __hu_cand in ${_HOOK_TEMP_WIN[@]+"${_HOOK_TEMP_WIN[@]}"}; do
[[ -n "$__hu_cand" && -d "$__hu_cand" ]] || continue
case "$__hu_seen" in
*"|$__hu_cand|"*) continue ;;
*) ;; # first sighting of this spelling
esac
__hu_seen="$__hu_seen|$__hu_cand|"
_HOOK_TEMP_CANDS+=("$__hu_cand")
done
}

# hook::_split_lines <text> <count>: <text> split on newlines into the
# caller's __hu_lines array. Returns 1 unless it held exactly <count> non-empty
# lines.
hook::_split_lines() {
local __hu_glob=0 IFS=$'\n'
[[ $- == *f* ]] || __hu_glob=1
set -f
# shellcheck disable=SC2206 # splitting one-line-per-operand output is the intent
__hu_lines=($1)
((__hu_glob)) && set +f
((${#__hu_lines[@]} == $2))
}

# hook::_temp_win_spellings <candidate>...: the drive spellings of every
# candidate in _HOOK_TEMP_WIN, long forms first. Returns 1, storing nothing,
# when there is no cygpath or the mixed-form answer cannot be trusted.
hook::_temp_win_spellings() {
local __hu_out __hu_i
local -a __hu_lines=() __hu_mixed=() __hu_tilde=()
command -v cygpath >/dev/null 2>&1 || return 1
for __hu_out in "$@"; do
[[ "$__hu_out" == *$'\n'* ]] && return 1
done
__hu_out=$(cygpath -m -- "$@" 2>/dev/null) || return 1
hook::_split_lines "$__hu_out" "$#" || return 1
__hu_mixed=("${__hu_lines[@]}")
_HOOK_TEMP_WIN=()
for __hu_out in "${__hu_mixed[@]}"; do
if [[ "$__hu_out" == *~* ]]; then __hu_tilde+=("$__hu_out"); fi
done
if ((${#__hu_tilde[@]})) &&
__hu_out=$(cygpath -l -m -- "${__hu_tilde[@]}" 2>/dev/null) &&
hook::_split_lines "$__hu_out" "${#__hu_tilde[@]}"; then
for ((__hu_i = 0; __hu_i < ${#__hu_tilde[@]}; __hu_i++)); do
if [[ "${__hu_lines[__hu_i]}" != "${__hu_tilde[__hu_i]}" ]]; then
_HOOK_TEMP_WIN+=("${__hu_lines[__hu_i]}")
fi
done
fi
_HOOK_TEMP_WIN+=("${__hu_mixed[@]}")
}

# True when <normalized-path> sits inside one of this host's temp trees.
# Both arguments and candidates go through the same canonicalize+normalize
# pipeline as the membership comparison, because the same directory has several
# spellings: on Git Bash `TMPDIR=/tmp` while `TEMP`/`TMP` carry the Windows form
# of the identical directory, and `realpath` resolves the Windows form to a
# drive path while leaving `/tmp` as `/tmp`. Neither form alone matches a
# spellings: on a Windows bash the temp tree is `/tmp` and also a `C:/...`
# path, and `realpath` resolves the drive form to a drive path while leaving
# `/tmp` as `/tmp`. The environment does not reliably carry the drive form
# (Cygwin bash reports TEMP and TMP as `/tmp`), so the candidate list adds it
# through cygpath (see hook::_temp_root_candidates). Neither form alone matches a
# `file_path` that could arrive in either, so every candidate is compared and a
# match on any one is a match. Duplicates are resolved once, and each
# candidate's physical form is remembered for the process (see the cache
Expand Down
114 changes: 114 additions & 0 deletions lib/hook-utils.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,120 @@ else
ok "under_temp_root: Windows drive-spelling case SKIPPED (not a Windows host with cygpath and a TEMP directory; no coverage here, not a pass)"
fi

# --- Test 12f: temp-root candidates gain cygpath drive spellings -------------
# Cygwin bash reports TEMP and TMP as /tmp, so on a Windows bash the drive
# spellings come from cygpath. A stub cygpath maps the POSIX candidate to real
# directories outside every temp tree and logs each call, so this runs on any
# host. Each case is a fresh bash, so no case inherits another's cache.
TW_DIR="$(cd "$HOOK_DIR/.." && pwd -P)/.work/hu-tempwin-$$"
case "$TW_DIR" in
/tmp/* | /var/tmp/*)
ok "temp_root_candidates: cygpath drive spellings SKIPPED (the checkout sits under temp at $TW_DIR; no coverage here, not a pass)"
;;
*)
mkdir -p "$TW_DIR/bin" "$TW_DIR/posix" "$TW_DIR/long" "$TW_DIR/short~1" "$TW_DIR/mixed"
{
printf '#!%s\n' "$BASH"
cat <<'TWEOF'
printf '%s\n' "$*" >>"$TW_LOG"
[[ -z "${TW_FAIL:-}" ]] || exit 1
long=0
for a in "$@"; do
case "$a" in
-l) long=1 ;;
-m | --) ;;
*)
if ((long)); then
[[ "$a" == "$TW_SHORT" ]] && a=$TW_LONG
else
[[ "$a" == "$TW_FROM" ]] && a=$TW_TO
fi
printf '%s\n' "$a"
;;
esac
done
TWEOF
} >"$TW_DIR/bin/cygpath"
chmod +x "$TW_DIR/bin/cygpath"
TW_POSIX="$TW_DIR/posix|/tmp"
[[ -d /var/tmp ]] && TW_POSIX="$TW_POSIX|/var/tmp"
# tw_run <ostype> [NAME=value...]: prints the candidates of two calls in one
# shell, then the number of cygpath calls, one per line.
tw_run() {
local ostype="$1"
shift
: >"$TW_DIR/log"
# shellcheck disable=SC2016 # $1..$3 are the child's own positional parameters
env TMPDIR="$TW_DIR/posix" TMP="" TEMP="" TW_LOG="$TW_DIR/log" \
TW_SHORT="$TW_DIR/short~1" TW_LONG="$TW_DIR/long" "$@" \
PATH="$TW_DIR/bin:$PATH" "$BASH" -c '
OSTYPE="$1"
source "$2"
hook::_temp_root_candidates
(IFS="|"; printf "%s\n" "${_HOOK_TEMP_CANDS[*]}")
hook::_temp_root_candidates
(IFS="|"; printf "%s\n" "${_HOOK_TEMP_CANDS[*]}")
_HOOK_UTR_TARGET_PHYSICAL=0
if hook::under_temp_root "$3"; then echo in; else echo out; fi
' _ "$ostype" "$HOOK_DIR/hook-utils.sh" "$TW_DIR/long/f"
local calls=0 line
while IFS= read -r line; do calls=$((calls + 1)); done <"$TW_DIR/log"
printf '%s\n' "$calls"
}
tw_case() {
local label="$1" want="$2" got
shift 2
got=$(tw_run "$@")
got=${got//$'\n'/ }
if [[ "$got" == "$want" ]]; then
ok "temp_root_candidates: $label"
else
fail "temp_root_candidates: $label: want '$want', got '$got'"
fi
}
# 8.3 answer: the long form comes first, two cygpath calls, none on the second
# call, and a target under the long form is under a temp root.
TW_83="$TW_POSIX|$TW_DIR/long|$TW_DIR/short~1"
tw_case "8.3 mixed answer adds long then short, 2 calls then 0" \
"$TW_83 $TW_83 in 2" msys TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/short~1"
tw_case "cygwin OSTYPE takes the same arm" \
"$TW_83 $TW_83 in 2" cygwin TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/short~1"
# No `~` in the answer: one call.
tw_case "mixed answer without ~ adds it with 1 call" \
"$TW_POSIX|$TW_DIR/mixed $TW_POSIX|$TW_DIR/mixed out 1" msys TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/mixed"
# A spelling already in the list is not added twice.
tw_case "a spelling equal to a POSIX candidate is deduped" \
"$TW_POSIX $TW_POSIX out 1" msys TW_FROM="$TW_DIR/posix" TW_TO=/tmp
# A spelling that is not a directory is dropped, like any candidate.
tw_case "a spelling that is not a directory is dropped" \
"$TW_POSIX $TW_POSIX out 1" msys TW_FROM="$TW_DIR/posix" TW_TO="C:/no/such/dir"
# A failing cygpath leaves the POSIX candidates. The failure is not cached, so
# each of the three candidate lookups (two direct, one in under_temp_root)
# asks again, one call each.
tw_case "a failing cygpath adds nothing" \
"$TW_POSIX $TW_POSIX out 3" msys TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/long" TW_FAIL=1
# POSIX hosts never call cygpath, even with one on PATH.
tw_case "a Linux OSTYPE never calls cygpath" \
"$TW_POSIX $TW_POSIX out 0" linux-gnu TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/long"
# --no-drive stops before cygpath even on a Windows OSTYPE.
: >"$TW_DIR/log"
# shellcheck disable=SC2016 # $1 is the child's own positional parameter
tw_nodrive=$(env TMPDIR="$TW_DIR/posix" TMP="" TEMP="" TW_LOG="$TW_DIR/log" TW_FROM="$TW_DIR/posix" TW_TO="$TW_DIR/long" \
PATH="$TW_DIR/bin:$PATH" "$BASH" -c '
OSTYPE=msys
source "$1"
hook::_temp_root_candidates --no-drive
(IFS="|"; printf "%s" "${_HOOK_TEMP_CANDS[*]}")
' _ "$HOOK_DIR/hook-utils.sh")
if [[ "$tw_nodrive" == "$TW_POSIX" && ! -s "$TW_DIR/log" ]]; then
ok "temp_root_candidates: --no-drive adds no spelling and calls no cygpath"
else
fail "temp_root_candidates: --no-drive: want '$TW_POSIX' and no call, got '$tw_nodrive' and '$(<"$TW_DIR/log")'"
fi
rm -rf "$TW_DIR"
;;
esac

# --- Test 13: hook::telemetry_enabled — cheap sink-presence probe -------------
# Producers gate telemetry-payload construction on this, so its verdict must
# track HOOK_TELEMETRY_SINK exactly: unset and empty are disabled, any
Expand Down
2 changes: 1 addition & 1 deletion plugins/actionlint/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "actionlint",
"version": "0.11.2",
"version": "0.11.3",
"description": "Lint GitHub Actions workflow files on edit via actionlint, surfacing findings as advisory context.",
"author": {
"name": "Melodic Software",
Expand Down
6 changes: 6 additions & 0 deletions plugins/actionlint/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to the `actionlint` plugin are documented here. Format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning.

## [0.11.3] - 2026-09-30

### Changed

- **Shared library sync: `hook-utils.sh` now adds cygpath spellings of the temp root on Windows shells.** No behavior change off Windows.

## [0.11.2] - 2026-09-30

### Changed
Expand Down
Loading