Skip to content

Improve git protocol parsing and error handling#14

Merged
pjbgf merged 10 commits into
mainfrom
pkt-err
Apr 29, 2026
Merged

Improve git protocol parsing and error handling#14
pjbgf merged 10 commits into
mainfrom
pkt-err

Conversation

@pjbgf

@pjbgf pjbgf commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Surface remote ERR packets during v2 fetch and validate the acknowledgment flow (delimiter, packfile section, premature flush) so transport failures aren't silently swallowed.
  • Tighten pkt-line framing: accept empty data packets (length 0004) per spec, and reject packets exceeding the 65520-byte limit.
  • Validate smart HTTP responses by normalizing endpoint paths and checking the info/refs advertisement Content-Type before parsing.
  • Skip unborn entries in ls-refs output rather than treating them as refs.
  • Rename the README "limits" section for clarity.

Note

Medium Risk
Medium risk because it changes low-level Git protocol parsing/validation (pkt-line framing, v2 fetch negotiation, smart HTTP discovery), which can affect interoperability with servers and error handling paths.

Overview
Improves robustness of Git protocol v2 handling by surfacing remote ERR packets and validating the v2 fetch acknowledgment flow (including enforcing readypackfile sequencing and rejecting premature flush/invalid sections).

Tightens pkt-line decoding to accept empty data packets (0004) while rejecting lengths beyond the pkt-line max, skips unborn entries in v2 ls-refs, and strengthens smart-HTTP discovery by normalizing trailing slashes in endpoint paths and requiring the expected info/refs advertisement Content-Type before parsing. Documentation renames README “Limits” to “Limitations”.

Reviewed by Cursor Bugbot for commit 5890a3d. Configure here.

pjbgf added 9 commits April 29, 2026 13:10
Entire-Checkpoint: 89bcc035b159
Entire-Checkpoint: 41aca0b5f5b0
Entire-Checkpoint: 7d979c09650c
Entire-Checkpoint: f746128ca448
Entire-Checkpoint: 5452c36ad228
Entire-Checkpoint: 16f246b22b9b
Entire-Checkpoint: 739bc9f1ff64
Entire-Checkpoint: b6f015148701
Entire-Checkpoint: bc317c95b880

@Soph Soph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

Comment thread internal/gitproto/fetch.go Outdated
Co-authored-by: Stefan Haubold <stefan.haubold@hait.de>
@pjbgf pjbgf merged commit c10ec48 into main Apr 29, 2026
2 of 3 checks passed
@pjbgf pjbgf deleted the pkt-err branch April 29, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants