docs: apply the #272 review notes on the apm 0.39 docs
- Name kyberforge's SessionStart hook as a lock writer that can write the bad lock in a 0.28-populated checkout, with the recovery steps (README, AGENTS.md, gates.md). - AGENTS.md: put the pinned-invocation rule above the lock-churn rule, make the bare-apm remark conditional on what PATH holds, and replace the two 0.28 migration notes with one pointer to gates.md "apm-audit-ci". - Use one wording for the offline guarantee: a synced .venv/ and a populated apm_modules/. - Say the #204 leak was not re-tested on 0.39.3, and narrow the claim to git_subprocess_env (gates.md, LESSONS.md, git-env test header). - State the apm-audit-ci timing as 70-90 s, drop a duplicate README sentence, give the 0.39.3 shorthand error, reflow gates.md to about 100 columns, and move the ADR-0033 note into amendment blockquote form. Refs #272 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
1 parent
66443e7458
commit
db34dfa728
7 files changed
+71
-64
No files matched your search
+1
-1
@@ -154,4 +154,4 @@ Under the `run-tests` pre-push hook, git exported `GIT_DIR` to the hook, so a ba
|
||||
|
||||
## 2026-11-26 — A hook's GIT_DIR leaks through any tool that runs git
|
||||
|
||||
#204: pushing from a linked worktree left the shared `.git/config` with `core.bare=true` and the worktree on a detached HEAD at the lock-pinned commit. git exports an absolute `GIT_DIR` to hooks run from a linked worktree. `apm-audit-ci` ran `apm audit --ci`, and its drift replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an env copied from `os.environ`. The inherited `GIT_DIR` won, so both operations hit this repo instead of the temp dir. The 2026-11-13 fix did not cover this: it scrubbed the env only inside `tests/run-tests.sh`, and the apm hooks never pass through that file. Fix: `scripts/lib/clean-git-env.sh` unsets the repo-locating vars, and both `scripts/apm-audit-ci.sh` and the new `scripts/apm-pack-check-clean.sh` source it before calling apm. `tests/test-apm-hooks-git-env.sh` reproduces the leak with a stub `apm`. Rule: any hook that shells out to a tool that runs git must scrub `GIT_*` first. Scrubbing one entry point does not protect the others. *2026-12-02 (#272):* apm 0.39.3 strips `GIT_DIR` and the other repo-locating vars from its own git calls (`git_subprocess_env` in `apm_cli/utils/git_env.py`). The leak was not reproduced again on 0.39.3, and the scrub stays, because the rule is about the hook, not about one tool version.
|
||||
#204: pushing from a linked worktree left the shared `.git/config` with `core.bare=true` and the worktree on a detached HEAD at the lock-pinned commit. git exports an absolute `GIT_DIR` to hooks run from a linked worktree. `apm-audit-ci` ran `apm audit --ci`, and its drift replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an env copied from `os.environ`. The inherited `GIT_DIR` won, so both operations hit this repo instead of the temp dir. The 2026-11-13 fix did not cover this: it scrubbed the env only inside `tests/run-tests.sh`, and the apm hooks never pass through that file. Fix: `scripts/lib/clean-git-env.sh` unsets the repo-locating vars, and both `scripts/apm-audit-ci.sh` and the new `scripts/apm-pack-check-clean.sh` source it before calling apm. `tests/test-apm-hooks-git-env.sh` reproduces the leak with a stub `apm`. Rule: any hook that shells out to a tool that runs git must scrub `GIT_*` first. Scrubbing one entry point does not protect the others. *2026-12-02 (#272):* apm 0.39.3's `apm_cli/utils/git_env.py` provides `git_subprocess_env`, which strips `GIT_DIR` and the other repo-locating vars. The leak was not re-tested on 0.39.3, and the scrub stays, because the rule is about the hook, not about one tool version.
|
||||
Reference in new issue
Block a user