Repository navigation
fix(gix-config): reject extra tokens after implicit values - #3203
Merged
Merged
Conversation
Sebastian Thiel (Byron)
force-pushed
the
fix-config-parsing
branch
from
November 14, 2026 18:48
4333e81 to
d542690
Compare
This removes a long-standing 'leniency' that I thought was a feature. But probably it can always be turned into something surprising that better doesn't exist. <!-- agent --> GitPython's native gix backend exposed submodule settings from malformed `.gitmodules` files that Git refuses to read. In particular, a line such as `x url = ../evil` could override an earlier URL and make a consumer clone from that location. This work was motivated by gitpython-developers/GitPython#2345. Require an implicit value to end at EOF, LF, or CRLF after the existing space/tab handling. Extra names, attached or spaced comments, and section headers are errors unless the key has an explicit `=`. Keep valid header-line settings, implicit booleans, quoting, and continuations. Add a read-only, 25-case baseline generated by `git config --file - --list`, including winning URLs for accepted files. Compare the public event and file parsers, including filtered events, and add a public `gix-submodule::File::from_bytes()` regression. Both new regressions failed before the fix. Update the old permissive comment expectation, diagnostics, and malformed fuzz fixtures while retaining the memory budget check. Reference: Git 2.54.0 (Apple Git-157); local Git source `6de20f6092dcf9bdb1c8efe03db4b70c82b423dd`, `config.c:get_value()` and `t/t1300-config.sh`'s same-line section-setting test. Git also rejects both affected fuzz fixtures with exit 128. Assisted-by: GPT 6.1 Sol Co-authored-by: GPT 6.1 Sol <codex@openai.com>
Sebastian Thiel (Byron)
force-pushed
the
fix-config-parsing
branch
from
November 14, 2026 20:50
d542690 to
3d3aa94
Compare
Sebastian Thiel (Byron)
marked this pull request as ready for review
November 14, 2026 20:50
Contributor
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Malformed config lines such as
x url = ../evilwere parsed as an implicitxand another URL setting. In.gitmodules, that could expose a URL that Git refuses to read and direct a downstream consumer to clone from it. This work was motivated by GitPython PR #2345, which adds a fallback around this mismatch in its native gix backend.gix-confignow requires implicit values to end at EOF, LF, or CRLF after spaces/tabs. Extra settings, comments, and headers after bare keys are rejected. Valid header-line settings, implicit booleans, quoting, and continuations retain their behavior.A read-only fixture establishes a 25-case Git baseline, checking acceptance and the winning URL through the public config parsers. A
gix-submodule::File::from_bytes()regression checks the sensitive consumer directly. Both regressions failed before the fix. Existing fuzz tests now expect rejection for malformed inputs, while retaining the memory budget check.The config writer now puts comments after implicit values on the following line, so it produces valid config too. Round-trip tests cover LF, CRLF, and CLI overrides while preserving implicit boolean semantics.
Git baseline
Git 2.54.0 (Apple Git-157), with behavior checked against the local Git source at
6de20f6092dcf9bdb1c8efe03db4b70c82b423dd:config.c:get_value()andt/t1300-config.sh's header-line setting test. The fixture runsgit config --file - --listand records URLs for accepted inputs. Both affected fuzz inputs are also rejected by Git with exit 128.Validation
.gitmodulesregression.gixconfig/submodule tests: 182 passed.CI follow-up
Required CI is green on
d542690, including Linux, macOS, Windows, feature tests/builds, docs, journey tests, CIFuzz, CodeQL, and zizmor. The final Codex commit review found no introduced bug, and there are no pending review threads.Nine advisory consumer jobs fail on API changes already present in the base, rather than this parser fix:
5647da5466).1d94b9dd14).029c5971cdand the existing shallow query API).Outcome::identitytocredentialsrename (f7cbe2793b).These jobs are explicitly advisory in the workflow; the required
Tests passcheck succeeds. CI also caught the new fixture's missing executable bit, which is corrected in this commit and passes the housekeeping check.Reported issue