Skip to content

fix: add checkHiddenCommits to tag push chain - #1893

Merged
jescalada merged 8 commits into
mainfrom
check-hidden-commits-on-tag-pushes
Nov 23, 2026
Merged

jescalada merged 8 commits into
mainfrom
check-hidden-commits-on-tag-pushes

Conversation

@jescalada

Copy link
Copy Markdown
Contributor

Description

Adds checkHiddenCommits to tag push chain, and regression tests. Tag pushes were added in 2.1 but were missing this processor. Although this appears to be a regression from GHSA-v98g-8rqx-g93g, I'm not aware of any other orgs actively using tag pushes (and even then it's hard to exploit despite the risk score).

Checklist

General

Documentation

  • Documentation has been added/updated for any new features

Tests

  • Tests have been added/updated for new functionality
  • Unit tests pass (npm test)
  • Linting and formatting pass (npm run lint and npm run format:check)
  • Type checks pass (npm run check-types)

@jescalada
jescalada requested a review from a team as a code owner November 14, 2026 08:52
@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 01057e4
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6b040e4fe31c92a7dbbe401e

@github-actions github-actions Bot added the fix label Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.98%. Comparing base (99299d0) to head (01057e4).

Files with missing lines Patch % Lines
...proxy/processors/push-action/checkHiddenCommits.ts 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1893      +/-   ##
==========================================
+ Coverage   88.97%   88.98%   +0.01%     
==========================================
  Files         132      132              
  Lines        7273     7281       +8     
  Branches     1362     1365       +3     
==========================================
+ Hits         6471     6479       +8     
  Misses        494      494              
  Partials      308      308              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcoric dcoric 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.

One ordering issue: in tagPushChainElements, checkIfWaitingAuth still runs before pullRemote, writePack and checkHiddenCommits. Once a tag push is approved, the re-push finds the approval, sets allowPush and leaves the chain before the new check. That re-push is the one forwarded upstream, so its pack is never checked for hidden commits.

The branch chain runs checkHiddenCommits before checkIfWaitingAuth. Could we move checkIfWaitingAuth after checkHiddenCommits here too, and extend the chain-order test to cover it? Everything else looks good.

@jescalada

Copy link
Copy Markdown
Contributor Author

@dcoric You're right, I didn't notice that 👍🏼 Should be good for a final look!

@jescalada

Copy link
Copy Markdown
Contributor Author

CI is failing from a Docker image fetch failure... Should be good to merge otherwise

@jescalada
jescalada requested a review from dcoric November 17, 2026 04:53

@dcoric dcoric 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.

Ordering fix looks good. Two problems showed up running the check against real clones:

1. Hidden commits pass when the tag target is outside the shallow clone.
Tag HEAD~1 with an extra unreferenced commit in the pack: local receive-pack rejects the pack, writePack ignores that, newIdxFiles is empty, and the check passes with "Total commits in the pack: 0". The branch chain catches this later in getDiff; the tag chain has nothing after it.

Fix: in checkHiddenCommits, fail closed for tag pushes when nothing was indexed and the pack holds more than tag objects.

const packMeta = action.steps.find((s) => s.stepName === 'parsePackFile')?.content?.meta;
const onlyTagObjects = packMeta?.entries === (action.tagData?.length ?? 0);
if (action.actionType === PushType.TAG && !action.newIdxFiles?.length && !onlyTagObjects) {
  step.setError('Unable to verify the pushed pack. Push the commits on a branch first, then push the tag.');
  action.error = true;
  return action;
}

2. Force-moving a tag over SSH to a new commit is falsely rejected.
The single-branch clone lacks the old tag object, so rev-list old..new fails silently and the new commit is reported as unreferenced.

Fix: for tags, use the new OID alone.

const revRange =
  oldOid === EMPTY_COMMIT_HASH || action.actionType === PushType.TAG ? newOid : `${oldOid}..${newOid}`;

Please add a test for each.

@jescalada
jescalada requested a review from dcoric November 23, 2026 10:00
@jescalada

Copy link
Copy Markdown
Contributor Author

@dcoric Thanks for catching that! Ready for another look. 👍🏼

@dcoric dcoric 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.

LGTM 🚀

@jescalada
jescalada merged commit ceb88d2 into main Nov 23, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants