Skip to content

Revert "[INS-397] Fix git version parser panic on non-numeric patch versions"#4903

Merged
trufflesteeeve merged 1 commit into
mainfrom
revert-4882-INS-397-fix-git-version-parsing
Apr 21, 2026
Merged

Revert "[INS-397] Fix git version parser panic on non-numeric patch versions"#4903
trufflesteeeve merged 1 commit into
mainfrom
revert-4882-INS-397-fix-git-version-parsing

Conversation

@trufflesteeeve

@trufflesteeeve trufflesteeeve commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Reverts #4882

This is a good change overall, but there are a lot of downstream dependency effects that we're running into. So we're going to revert for now and take another pass at this.


Note

Medium Risk
Changes the git binary/version validation used by multiple sources and removes the previously-tested parser, which could reintroduce parsing/compatibility issues across environments with nonstandard git --version output.

Overview
Reverts the shared pkg/gitcmd git version parsing helper (and its unit tests) and replaces call sites to use a new git.CmdCheck() under pkg/sources/git.

Adds a separate, detector-local gitCmdCheck() in the Azure APIM repository key verifier, and updates Git/GitHub/GitLab/HuggingFace sources to call the new check before running git commands.

Reviewed by Cursor Bugbot for commit f136645. Bugbot is set up for automated code reviews on this repo. Configure here.

@trufflesteeeve trufflesteeeve requested review from a team April 21, 2026 20:16
@trufflesteeeve trufflesteeeve requested review from a team as code owners April 21, 2026 20:16

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f136645. Configure here.


// Parse version numbers
major, _ := strconv.Atoi(versionParts[0])
minor, _ := strconv.Atoi(versionParts[1])

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.

Panic on non-numeric git patch versions re-introduced

High Severity

The regex \d+\.\d+\.\d+ requires three numeric dot-separated segments, but git built from source can report versions like 2.52.gaea8cc3 (non-numeric patch) or 2.20 (no patch). When the regex doesn't match, FindString returns "", then strings.Split("", ".") yields a single-element slice, and accessing versionParts[1] causes an index-out-of-range panic. The deleted pkg/gitcmd/gitcmd.go had fixed this with a (\d+)\.(\d+) regex and proper error handling.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f136645. Configure here.

@trufflesteeeve

Copy link
Copy Markdown
Contributor Author

Bypassing rules because this is a revert, and there are time sensitive requirements.

@trufflesteeeve trufflesteeeve merged commit 17456f8 into main Apr 21, 2026
15 checks passed
@trufflesteeeve trufflesteeeve deleted the revert-4882-INS-397-fix-git-version-parsing branch April 21, 2026 20:27
MuneebUllahKhan222 pushed a commit that referenced this pull request May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants