Support SHA-256 Git object hashes (64-char OIDs)#3872
Draft
Conversation
Agent-Logs-Url: https://github.com/github/codeql-action/sessions/e39d1fb6-4ce3-47c3-9113-e41b111fc8fb Co-authored-by: oscarsj <1410188+oscarsj@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix regex to support SHA-256 Git object hashes
Support SHA-256 Git object hashes (64-char OIDs)
May 4, 2026
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.
Git is transitioning to SHA-256 as the default object hash (64 hex chars vs SHA-1's 40). Two production code paths hard-coded assumptions about 40-char OIDs, causing silent failures or errors in SHA-256 repositories.
Production fixes (
src/git-utils.ts)getFileOidsUnderPath(): Regex{40}→{40,64}— previously all entries failed to match in SHA-256 repos, causing an error throw.determineBaseBranchHeadCommitOid(): Length checks=== 40→(=== 40 || === 64)— previously the condition was always false for 64-char OIDs, causing silentundefinedreturn and fallback to server-side base SHA calculation.Test coverage (
src/git-utils.test.ts,src/upload-lib.test.ts,src/testing-utils.ts)SHA256_GITHUB_SHA = "0".repeat(64)constant totesting-utils.tsgetRef()tests (merge PR ref, checkout@v1 path, head PR ref, explicit input)determineBaseBranchHeadCommitOidreturning the correct base OID from a 64-char merge commitgetFileOidsUnderPath(pure 64-char OIDs and mixed SHA-1/SHA-256)upload-lib.test.tsRisk assessment
Which use cases does this change impact?
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.upload-sarifaction.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist