GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tag): split tag object headers at line feeds only by Keerthana-64 · Pull Request #2290 · gitpython-developers/GitPython

Conversation

@Keerthana-64

@Keerthana-64 Keerthana-64 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

TagObject._set_cache_ split the decoded tag object with str.splitlines() and then read the headers by position, taking lines[3] as the tagger. str.splitlines() also breaks at \r, \v, \f, \x1c-\x1e, \x85, U+2028 and U+2029, but git ends a header only at a line feed. A U+2028 inside the tag header of an untrusted tag object therefore shifts every later header by one line in GitPython only. With tag v1<U+2028>tagger Linus Torvalds <[email protected]> 1700000000 +0000 followed by a real tagger Mallory <[email protected]> ... line, git cat-file tag, git show and git for-each-ref --format=%(taggername) report Mallory, while GitPython reported tag == "v1" and Linus Torvalds as the tagger. The object passes git fsck --strict and a clone with transfer.fsckObjects=true, because git only warns badTagName.

The fix splits at "\n" and drops the trailing empty element, so tags that only use line feeds parse exactly as before. A \r or U+2028 inside the message is now kept, as git shows it. The new test in test/test_refs.py fails before the change and passes after it. ruff, ruff format --check and mypy are clean. On my machine the full suite has 3 failures (test_empty_repo, test_rebasing, test_diff_with_staged_file), and all 3 also fail without this change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Keerthana-64
fix(tag): split tag object headers at line feeds only
add9920
`TagObject._set_cache_` split the decoded tag object with `str.splitlines()` and then read the headers by position, taking `lines[3]` as the tagger. `str.splitlines()` also breaks at `\r`, `\v`, `\f`, `\x1c`-`\x1e`, `\x85`, U+2028 and U+2029, but git ends a header only at a line feed. A U+2028 inside the `tag` header of an untrusted tag object therefore shifts every later header by one line in GitPython only. With `tag v1<U+2028>tagger Linus Torvalds <[email protected]> 1700000000 +0000` followed by a real `tagger Mallory <[email protected]> ...` line, `git cat-file tag`, `git show` and `git for-each-ref --format=%(taggername)` report Mallory, while GitPython reported `tag == "v1"` and Linus Torvalds as the tagger. The object passes `git fsck --strict` and a clone with `transfer.fsckObjects=true`, because git only warns `badTagName`.

The fix splits at `"\n"` and drops the trailing empty element, so tags that only use line feeds parse exactly as before. A `\r` or U+2028 inside the message is now kept, as git shows it. The new test in `test/test_refs.py` fails before the change and passes after it. `ruff`, `ruff format --check` and `mypy` are clean. On my machine the full suite has 3 failures (`test_empty_repo`, `test_rebasing`, `test_diff_with_staged_file`), and all 3 also fail without this change.
@Byron

Byron commented Oct 17, 2026

Copy link
Copy Markdown
Member

LGTM!

Merging, also knowing this is mostly good for the test with #2274 pending.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron merged commit c6cb407 into gitpython-developers:main Oct 17, 2026
47 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Keerthana-64

Keerthana-64 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging this, and noted that the test really pays off once #2274 lands.

This comment was written and posted by an AI agent on behalf of @Keerthana-64.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Keerthana-64 Keerthana-64 mentioned this pull request Oct 22, 2026
fix(repo): split git blame porcelain output at line feeds only #2300
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Keerthana-64 @Byron
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.