Skip to content

fix: harden pre-push against GIT_DIR-leak core.bare corruption (#2984) - #18

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jul 29, 2026
Merged

fix: harden pre-push against GIT_DIR-leak core.bare corruption (#2984)#18
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

* [wip] claim work on fix-core-bare-gitdir-leak

* fix: gate the GIT_DIR-leak core.bare corruption class at pre-push

Scrub hook-exported GIT_* in both pre-push hooks before any step runs,
heal a pre-existing core.bare=true loudly at hook start, and fail the
push (restoring the config) when core.bare flips mid-run. Fix the live
writer (select-beta-to-promote.test.mjs fixture helper, introduced by
PR 2957) with gitCleanEnv, widen gitCleanEnv to the root 8-var scrub
list, and scrub the latent sites (guard-branch-switch and
resolve-subtree-dirs shell fixtures, sync-open-knowledge-upstream,
lume-patch apply.sh, visimer bridge fork). Add check:git-env-scrub, a
zero-dep gate over hook-reachable script trees that also pins the hook
scrub lines, with bidirectional self-tests, and Fixture D behavioral
tests running the real hooks under a poisoned GIT_DIR. Document the
symptom playbook in CI_RUNBOOK and the incident audit in
public/open-knowledge/reports/core-bare-corruption-audit.

* review: fix scrub comments, warn on unreadable scan dirs

Correct the lume-patch scrub comment (clone, not init), enumerate all
scrub-helper copies from the authoritative GIT_SCRUB_VARS comment, and
make the scanner warn on non-ENOENT directory read errors instead of
silently skipping.

* review: mirror git-clean-env.mjs, fix guard comment, merge caller env

Add git-clean-env.mjs to the public-open-knowledge Copybara allowlist
(the mirrored release scripts now import it; without the entry the
public repo's promote-stable and select-beta workflows would fail at
module load) and regenerate the config. Correct the core_bare_is_true
guard comment (the missing-config branch is deliberately not-corrupt,
not fail-closed), merge caller env before the scrub in cc-task
runChild, and fix a stale fixture count in the gate self-test docs.

* review: verify steps fire after heal, enumerate bridge scrub copies

Fixture D's heal test now asserts all six step sentinels fired after the
repair (healing must let the run proceed), and the GIT_SCRUB_VARS sync
comment enumerates the two bridge-script inline destructures alongside
the four named helpers.

GitOrigin-RevId: 05cc8f04e8311cfbe93fd73909b8bfe09f31334a
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit 2453e62 into main Jul 29, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch July 29, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant