Repository navigation
Description
Outside the plan: Pascal assigned this card on 2026-11-03, through the grooming of Epic 16. Its pull request says that it is outside the plan.
Problem
just update starts git, uv, and Copier through updateRun and updateOutput in sdk/extensionrepo/update.go (lines 243-254). These commands have no Env, so each program gets the full environment of the caller. Copier also starts git. Under a git hook or git rebase --exec, the caller has GIT_DIR, GIT_INDEX_FILE, or GIT_WORK_TREE. Then git can read or write the wrong repository.
The analyzer callerenv (sdk/analysis/callerenv/callerenv.go lines 33-37) checks three exact package paths only. It does not check packages under those paths.
Goal
The programs of just update never get the GIT_* variables of the caller, and callerenv checks every package under the paths that it owns.
Acceptance rules
updateRunandupdateOutputgive each command an explicit environment. One function builds it from the caller's environment and removes eachGIT_*variable.callerenvnames that function as the allowed reader.callerenvmatches an owned path when the package path is equal to it, or starts with it followed by/.sdk/extensiontestxdoes not matchsdk/extensiontest.sdk/extensiontest/guard/guard_linux.goline 137 andsdk/extensiontest/fake/main.goline 64 read the environment on purpose. The owners map allows each of them by exact package and function, with a comment that gives the reason.- No SSA analyzer is added.
Examples
- Success: a test sets
GIT_DIRandGIT_INDEX_FILEto a second repository, then runs the update. The second repository does not change, and the update changes the right repository. A stub program in place of Copier sees noGIT_*variable. - Failure: the second repository gets a new commit, index, or ref, or the stub sees a
GIT_*variable.
Check
These tests pass in just check:
- The poisoned
GIT_*test of the update, with the stub of Copier - A
callerenvtest where a call toos.Environin a package under an owned path fails - A
callerenvtest where a package with a similar prefix is not matched - A
callerenvtest where the two allowed readers pass, and another function in the same package fails
by Opus-5.5 via Claude Code
Activity