Repository navigation
network: refuse a GIT_CONFIG_COUNT that isn't a plain decimal up to 1000, so no TLS key gets past the strip (#1001) - #1082
Merged
Conversation
… to 1000 (#1001) withoutRedirectGitConfig read the count with Number(). A count git refuses ("1 ", "0x1", "1e0") was rewritten into one git reads, and a count over 1000 was left untouched with its pairs unstripped, so a TLS key such as http.sslVerify=false reached git. Any count but empty or a plain decimal from 0 to 1000 now becomes one git refuses. Signed-off-by: Jayden Vasquez <jaydenvasquez1711@gmail.com>
Owner
Author
|
Independent adversarial review (R82b), posted by the coordinator. VERDICT: PASS @bf038f1d0e607c17f9a138e3eb2264bacd8add06 (adversarial) Reviewer R82b, adversarial. Head confirmed via Findings on what the PR claims
MutantsI edited the compiled Caught:
Survived:
Follow-ups (adjacent gaps, not claimed by this PR, all exist on main too)
What I ran |
Owner
Author
|
Independent final check (R82a), posted by the coordinator. VERDICT: PASS @bf038f1d0e607c17f9a138e3eb2264bacd8add06 (final check) PR #1082 (issue #1001). Reviewer r82a, own detached worktree at , TMPDIR= The head was confirmed with Findings
None of these is a FAIL under the brief. Follow-ups (not blocking)
|
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.
Part of #1001 (item 1 on main; item 2 deferred, see below).
What changed
withoutRedirectGitConfig(src/network.ts, run byoutboundEnvon every child environment the engine builds) strips TLS, proxy and URL-rewrite keys from git config carried inGIT_CONFIG_COUNT/KEY_n/VALUE_n. It read the count withNumber():1,0x1,1e0,1.0,1\n) was rewritten as1, a count git reads, so the caller'sGIT_CONFIG_KEY_0pair was applied though git would have refused it;http.sslVerify=false(or aurl.*.insteadOf) among 1001 pairs reached git. This bypasses the TLS guard.Now only an empty count or a plain decimal from 0 to 1000 is read. Any other count (including git-accepted forms
+1,01,1,\t1) becomesrefused, which git refuses ("bogus count"), so that git fails instead of running. This is fail-closed, the same rule #927'sgitEnvuses for its own parse (CANONICAL_CONFIG_COUNT, there with a 9999 bound). Counts the engine writes (String(n), inagentEnv,runAsEnv,projectCommandandinstanceEnv) are unchanged.Why this file and not
src/os/git.tsThe issue names
gitEnvinsrc/os/git.ts. That module isn't on main: it is in open PR #927 (head021f6f18), and its head already reads only a canonical count and replaces any other with a refused value (commit550323cf, #927 rounds 8 and 9). Measured:git show 021f6f18:src/os/git.tsshowsCANONICAL_CONFIG_COUNTandREFUSED_CONFIG_COUNT, andgit log origin/main -- src/os/git.tsis empty. I don't own #927's branch, so I didn't touch it. The sameNumber()parse exists on main inwithoutRedirectGitConfig, which #927 doesn't change (measured:git diff origin/main 021f6f18 -- src/network.tsis empty), so that is what this PR fixes.Item 2:
GIT_NO_LAZY_FETCH(not done, follow-up)Not implemented. Reasons:
GIT_FIXED_ENVin git: one runner for every engine git call, with replace refs and grafts off (#807) [PROTECTED: owner merges] #927'ssrc/os/git.ts), which isn't on main and isn't mine to edit. Putting it inoutboundEnvwould set it for every child, agents included, and change agents' git in a partial clone. That is a behaviour change for agents, not a hardening of the engine's own git.git --version), which ignores the variable (inferred from the issue and git's 2.44 release notes; not measured here). So I can't show a fail-before/pass-after test for it on this machine or on CI's Ubuntu git without pinning a newer git.Proposed follow-up, once #927 lands: add
GIT_NO_LAZY_FETCH: '1'toGIT_FIXED_ENV, and a test that skips with a named reason whengit --version< 2.44 (or makes a partial-clone lazy fetch fail on >= 2.44). As the issue says, the decisions index re-checks every object's hash, so this is not a gap in what it accepts (inferred).Evidence
Fail before (src at
origin/main, new tests added), measured:Pass after (this head), same command, measured:
The tests run the real git (
git config --get) on the envoutboundEnvreturns, so they check what git reads, not only the string. git 2.43 behaviour on the counts, measured withGIT_CONFIG_COUNT=<c> GIT_CONFIG_KEY_0=x.y GIT_CONFIG_VALUE_0=z git config --get x.y:1,01,+1,1,\t1read the pair;1,0x1,1e0,abc,1\nare "bogus count";-1is "too many entries"; empty and-0/00read none.Tests run (measured)
npm run typecheck: clean.npm run check:denylist:denylist: 1657 files clean.network-tls,network,runner-golden,child-env-sites,separate-users,project-command-isolation,project-env,push-guard,push-hook-guard: 98 tests, 95 pass, 0 fail, 3 skipped.flock /var/tmp/wl-coord/fulltest.lock nice -n 15 ionice -c3 npm test): 5842 tests, 5716 pass, 17 fail, 69 skipped. The 17 failures are incoordinator.test.js(a sandbox pip cache env),desktop-removed.test.js(node_modules is a symlink to the main checkout's) andmachine-sudoers-{closed,narrow,removal}.test.js. Withsrc/network.tsand the test file reset toorigin/main, the same five files give the same 17 failures (measured, 113 tests, 17 fail). So they come from this host, not from this change. CI is the authoritative run.Critical set: yes
outboundEnvis the redirect and TLS-trust guard for every child environment (claude, gh, git, project commands), and this PR changes how it treats git config in that environment.src/network.tsisn't matched bySELF_MODIFICATION_PARTSor.worklane/review.yaml(measured:rg networkover both finds nothing). But it is a guard, and the rule is "when unsure, in", so it needs two independent reviews. What a reviewer should check: (1) no count git reads can get past stripping. The only counts kept are''and0–1000in plain decimal, whichNumber()reads as git does. (2) A refused count leaves the old pairs in place, unstripped. That is safe only because git refuses the whole count; non-git children don't read these variables (inferred). (3) No engine path writes a count over 1000 or a non-canonical one (inferred from the four writers listed above).Skipped / follow-ups
GIT_NO_LAZY_FETCH(above).gitEnv's with a 9999 bound, and this one with 1000). They could share one constant. Not done here because git: one runner for every engine git call, with replace refs and grafts off (#807) [PROTECTED: owner merges] #927's module isn't on main.