Repository navigation
fix(ci): stage only flake.nix in the vendorHash bot's PR, and ignore nix out-links - #467
Merged
Merged
Conversation
…nix out-links The `bump-flake-vendorhash` bot committed a build artifact into its own PR. #450 changed two things: the legitimate `vendorHash` bump, and a NEW `result` symlink pointing at `/nix/store/kkfnywjq…-civitai-4e35eaa-dirty`. All 13 CI checks were green on it — nothing in this repo detects the artifact. Mechanism, in `.github/workflows/bump-flake-vendorhash.yml`: - the two validate steps run `nix build .#default` and `./result/bin/civitai version`, and a SUCCESSFUL `nix build` drops a `result` out-link symlink into the invocation cwd (the repo root); - `result` is not in `.gitignore`; - the `open PR if vendorHash changed` step uses peter-evans/create-pull-request without `add-paths`, and that action runs `git add -A` in that case (verified in the action's own `create-or-update-branch.ts` at the pinned SHA c5a7806) — so it stages every change in the tree, untracked files included. The ordering is why this hid: `detect changes` runs BEFORE the validate steps, so its `git status --porcelain` gate never sees `result` and the changed=true/false decision is unaffected. The symlink exists only in the window between validation and the PR step. Two independent guards: 1. `add-paths: flake.nix` on the create-pull-request step — the authoritative fix. It stages exactly the file the workflow is allowed to change, so no future artifact can ride along regardless of what a later step leaves in the workspace. Audited against every step that writes to the working tree: the recompute step's two `sed -i`s and its `git checkout --` restore touch flake.nix and nothing else, and its nix log goes to `$RUNNER_TEMP`. flake.nix is the complete write set. 2. `/result` + `/result-*` in `.gitignore` — defence in depth, covering nix's numbered/named out-link variants. Anchored to the repo root so a legitimately named file deeper in the tree is unaffected. Also applies the vendorHash bump itself (#450's legitimate half), independently re-derived here rather than copied: with `vendorHash` set to the workflow's own fake, `nix build .#default` reported `got: sha256-l0RyxhS7+tdL9FngitiUhrciQbZfyDmTp5tP3Kd6NGQ=`, matching #450 exactly. `go.mod`/`go.sum` are byte-identical between #450's head and `main`. With the real hash written back, `nix build .#default` succeeds and `./result/bin/civitai version` runs. The two sibling drift-bots that share this token and this action — `bump-scaffold-pins` and `revendor-canonical-schema` — were audited for the same defect and do NOT have it, so they keep `git add -A` and gain only a comment recording the audit and what would change that. Neither writes anything into the workspace except the file it means to commit: `bump-pins` writes only under its `--dir` (default `internal/scaffold`), the re-vendor script `cp`s to one path and downloads via `mktemp`, `go test` writes nothing, and the scaffold build validation deliberately runs in `$RUNNER_TEMP`. Measured, not just read: `git status --porcelain` was clean of artifacts after the full test suite and after a `civitai app init --dir "$RUNNER_TEMP/…"`. Supersedes #450, which should not be merged as-is.
This was referenced Aug 17, 2026
ZacxDev
added a commit
that referenced
this pull request
Aug 18, 2026
…te is measured but whose TP rate is not (#477) Cut from main at e7be70f. Predicts 9 commits in the notes and 11 excluded, with the caveat that the count has moved between drafting and tagging on every recent release — the doc gives the command to re-derive it at tag time. Records three things a reader of the changelog alone would get wrong: - the release ships TWO threads' work (the pkgzip exclusion-rule arc plus the concurrent listing/provenance thread), and nothing is flag-gated, so publishing ships all of it; - #467 matches the `fix(` filter and will appear in the notes, but it is CI-internal and changes nothing an author can observe; - the credential warning's 0.41% false-positive rate is measured while its true-positive rate is NOT — the corpus holds no real credential, so detection is evidenced only against planted fixtures. The feature is justified by consequence, not by demonstrated catch-rate. Also restates the two instruments that lied in the reassuring direction on earlier releases (the cached raw.githubusercontent cask, and a URL check that constructed URLs instead of reading them out of the cask).
ZacxDev
added a commit
that referenced
this pull request
Aug 18, 2026
…fix rounds broke things at the rate implementations did (#478) Replaces a doc that still said "Nothing is in flight, main @ 01d6692" while six PRs, three filed issues and a release had landed on top of it. Records the arc: #458 drop-messaging, #460 antipattern consolidation, #461 root-scoped allow-list, #467 the vendorHash bot's nix out-link, #468 depth-aware exclusion, #470 the credential warning. #464/#465/#466 closed, #450 superseded, #435 left open on Row B alone (bloat and VCS plumbing, not credentials). The part worth carrying forward is not the feature list. Every audit round after the first found a defect the previous round had certified clean, and each was CREATED by the fix for the previous finding — a re-approved golden contradicting the PR's own test, an 830x quadratic scan, a threshold tolerating a 1024x change, and a hostname-substring hole silencing real credentials. That is the argument for resetting the verification gate on every fix instead of trusting it. Also records three instrument traps that each returned a confident wrong answer in one session despite being documented rules: mutating the first of two identically-shaped functions, a -run filter that excluded the killing test, and `go build | head && echo OK` reporting success on a compile failure. The cure that held every time was a build gate before any verdict, no -run filter, and counted output rather than exit codes. And the standing gate on any future detector change: 244 project dirs / 3,917 packaged files / 1 firing = 0.41%, re-measured every time — a URL pattern once took it to 5.33% on a single starter-template README line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #450 — do not merge that one as-is; it carries the artifact this PR exists to prevent. Leaving it open is a decision for a human; see "What to do with #450" below.
The defect
The
bump-flake-vendorhashbot commits a nix build artifact into its own PR. #450 changed two things:flake.nix—vendorHash→sha256-l0RyxhS7+tdL9FngitiUhrciQbZfyDmTp5tP3Kd6NGQ=(legitimate)result— a new symlink to/nix/store/kkfnywjqbl2gmgnghrcxynxz07i8p4v2-civitai-4e35eaa-dirty(must never land)All 13 CI checks were green on #450. Nothing in this repo detects the artifact, so the guard has to be that it is never staged.
Mechanism
In
.github/workflows/bump-flake-vendorhash.yml:nix build .#defaultand./result/bin/civitai version. A successfulnix builddrops aresultout-link symlink into the invocation cwd — the repo root.resultwas not in.gitignore(git check-ignore resultfound nothing).open PR if vendorHash changedstep usespeter-evans/create-pull-requestwith noadd-paths, and in that case the action runsgit add -A, staging every change in the tree including untracked files.That last point is read from the action's own source at the SHA this repo pins (
c5a7806), not from memory —src/create-or-update-branch.ts:The ordering is why this hid.
detect changesruns before the validate steps, so itsgit status --porcelaingate never seesresultand the changed=true/false decision is unaffected. The symlink exists only in the window between validation and the PR step — which is exactly the window the action reads.The fix — two independent guards
1.
add-paths: flake.nixon the create-pull-request step. The authoritative fix: the action stages exactly the file the workflow is allowed to change, so no future artifact can ride along regardless of what a later step leaves in the workspace. A comment on the step records why it is there and what changing it costs.I audited every step in the job that writes to the working tree, because an unlisted path is silently dropped from the commit and a bot that opens an incomplete PR is worse than the artifact:
actions/checkout/install-nix-actionrecompute flake vendorHashflake.nixonly — twosed -is and agit checkout -- flake.nixrestore. Its nix log goes to$RUNNER_TEMP/nix-build.logdetect changesgit statusonlyvalidate — flake buildsresultout-link (the artifact)validate — the built binary runsclassify the outcome$GITHUB_OUTPUTflake.nixis the complete set of files this job may commit.2.
/result+/result-*in.gitignore. Defence in depth, covering nix's numbered/named out-link variants (result-1,result-bin). Anchored to the repo root so a legitimately named file deeper in the tree is unaffected — verified thatflake.nixandschema/app-block.manifest.schema.jsonare still not ignored, so neither this bot nor its siblings can be broken by the rule.3. The vendorHash bump itself, so the flake is correct on
maineven though the superseded PR never lands.Sibling drift-bot audit
Three workflows use
peter-evans/create-pull-request; none hadadd-paths. Only one is actually exposed.add-pathsbeforebump-flake-vendorhashnix builddropsresultin the repo root, and it is not ignoredadd-paths: flake.nix+.gitignore)bump-scaffold-pinsbump-pinswrites only under its--dir(defaultinternal/scaffold) to three constant sites;go testwrites nothing;validate — scaffold buildsdeliberately scaffolds and runsnpm install/typecheck/buildin$RUNNER_TEMP(its own comment says "so the generated app never pollutes the auto-PR diff")internal/scaffoldas the write root to use if a future step changes thisrevendor-canonical-schemascripts/revendor-canonical-schema.shdownloads to amktempoutside the tree andcps to one path it computes from its own location (schema/app-block.manifest.schema.json);go test ./...writes nothingBoth "safe" verdicts are measured, not only read:
git status --porcelainwas clean of artifacts after the fullgo test ./...suite and after a realgo run ./cmd/civitai app init … --dir "$RUNNER_TEMP/…" --template page-money.I deliberately did not add
add-pathsto the two safe bots. It would be a reflex rather than a fix: neither can currently leak, and a path that is written but not listed is silently dropped from the commit. The comments say what to do if that changes.What I verified, and what I did not
Verified by execution:
vendorHashset to the workflow's own fake,nix build .#defaultreportedgot: sha256-l0RyxhS7+tdL9FngitiUhrciQbZfyDmTp5tP3Kd6NGQ=, matching chore(nix): bump flake vendorHash to match go.sum #450 exactly.go.mod/go.sumare byte-identical between chore(nix): bump flake vendorHash to match go.sum #450's head andmain.nix build .#defaultsucceeds and./result/bin/civitai versionruns (civitai a3720f6-dirty, go1.26.4).git status --porcelainshowedM flake.nixand?? result— the exact pair the action would have staged..gitignorerule works, with both controls:git check-ignore -vmatchesresult(.gitignore:19) andresult-1(.gitignore:20);git status --untracked-files=allno longer surfaces either; and as a negative controlflake.nixand the schema file are still not ignored.add-pathsis a real input at the pinned SHA (c5a7806) — checked against the action'saction.yml, because an unrecognizedwith:key is only a warning in Actions and would have silently done nothing.add-paths: flake.nixis attached to the intended step (asserted programmatically), with noadd-pathsanywhere in the two sibling files.go build ./...clean,go vet ./...clean,gofmt -s -l .empty,golangci-lint run→0 issues., andgo test ./... -count=1 -v→ 4416=== RUN, 4412--- PASS, 0--- FAIL, 4--- SKIP(the four skips are the network/env-gated ones), nopanic: test timed out. The FAIL counter was positive-controlled against a synthetic--- FAILline so a zero means zero rather than a broken pattern.NOT verified — stated plainly:
add-pathschange is unexercised. The honest claim is: the value names the only file this job writes, confirmed by reading every step that touches the working tree, and the action's own source at the pinned SHA showsadd-pathsselectsgit add -- <paths>instead ofgit add -A. I am not claiming "the artifact can no longer leak" — that becomes a verified statement on the bot's next real run.add-pathswould make it open none), and that the PR touchesflake.nixonly.What to do with #450
My recommendation: close it, do not fix it in place. This PR carries #450's entire legitimate payload (the identical one-line hash change, independently re-derived), so there is nothing left in it to salvage. Fixing it in place would mean pushing to
automation/bump-flake-vendorhash, a branch the bot owns and recreates — anddelete-branch: truemeans the next run will churn it anyway. Once this merges, the bot's next run recomputes the same hash, finds no drift, and opens nothing.Not closing it automatically from here, and no close keyword is used anywhere in this body — that is deliberate.