hooks/tests: the credential clone-URL guard test failed once with no hook change #501
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#759 epic: code and supply-chain security hardening
sixfold-space/madtea
Reference
sixfold-space/madtea#501
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
CI run 203 (
b924051f) failed thehook-testsstep:The same test passed on run 212 (
4c6f88cc). Between those commits onlyREADME.mdand two files indocs/decisions/changed, and nothing underhooks/orscripts/changed. So the hook or the test gives different results on the same code.This guard stops a clone URL that carries a credential. A guard that sometimes allows is a security gap, and a flaky test hides it.
Ask
clone cred url with | in passwordcan return allow.Acceptance
A second case, in a different hook. CI run 216 (push,
05eb2ac9) failedhook-testsinhooks/tests/check-git-commit.test.sh:check-git-local.shexited 0 with no deny forgit add -A. The local full gate on the same commit passedhook-tests.Both failures (run 203 and run 216) ran while the PR run of the same commit was still running on the runner (201: 20:47:56-20:55:41 against 203: 20:49:14-20:52:40; 214: from 21:27:13 against 216: 21:28:31-21:31:56). Most push runs overlap their PR run and pass, so overlap alone does not explain it.
One candidate to test, not yet proven: the hooks run under
set -o pipefailand classify each form withecho "$stripped" | grep -qP .... If that pipeline ever returns non-zero on timing, the form stays empty and the hook falls through to allow.Parked for now. What I tested, so the next attempt does not repeat it:
The
pipefailcandidate. Ifgrep -qexits beforeechofinishes writing,echogets SIGPIPE and the pipeline fails with 141. That would turn a match into "allow", both in the hooks and in the test'srun_in, which doesecho "$out" | grep -q '"decision": "block"' && got="block". I ran the exact pattern on a 650-byte block payload 45,000 times, idle and with 8 copies in parallel:0 misses. A payload this small goes out in one
write, beforegrepcan read it, so SIGPIPE cannot happen here. This does not explain the failure.A direct reproduction. I ran
hooks/tests/check-git-remote.test.sh400 times, 8 suites at a time on one host: 66,000 case results, 0 failures.clone cred url with | in passwordblocked on all 400 runs.The hook scripts have no timeouts, clock reads, or shared temp files.
One difference is still untested: CI runs the suite inside its container image, so the bash, grep, and coreutils versions there may differ. The next step is the same repeated-load run inside that digest-pinned image, or the full logs of runs 203 and 216.