Skip to content

fix(signing): validate release ancestry against protected main - #1207

Merged
qnbs merged 4 commits into
mainfrom
fix/release-tag-verifier-bootstrap-20261108
Nov 8, 2026
Merged

qnbs merged 4 commits into
mainfrom
fix/release-tag-verifier-bootstrap-20261108

Conversation

@qnbs

@qnbs qnbs commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

User description

Purpose

Correct the release-tag verifier's ancestry check to use the GitHub Compare API fields that the endpoint actually returns. The old check depended on a nonexistent head_commit field and could reject a valid signed release tag.

Changes

  • Accept only ahead or identical comparisons whose base and merge-base SHAs both equal the signed release target.
  • Require the target to match the push event SHA and GitHub context SHA, then recheck the annotated tag ref after verification.
  • Read protected main before and after the ancestry request; fail closed if its SHA moves or protection disappears during verification.
  • Preserve the existing PR/push signature-verification paths. No release workflow or publishing behavior is changed here; PR fix(release): require verified version-tag pushes for GHCR #1205 will pin the protected-main result after this precursor merges.

Validation

  • tests/unit/tooling/verifyRemoteTag.test.ts: 20/20 passed, including realistic Compare API responses, malformed/divergent ancestry, unprotected or moving main, tag mismatch/retargeting, and API failures.
  • tests/unit/signing.test.ts: 72/72 passed.
  • pnpm run pr:budget --base origin/main: 7 files, 404 meaningful lines, 3 commits; within hard limits.
  • PR_BUDGET_BASE=origin/main pnpm run ci:prepush: passed. Hosted exact-head checks and independent reviews are still required.

Security and release status

This PR does not create or publish a tag, GitHub Release, GHCR image, or Tauri artifact. v1.29.3 remains on HOLD. PR #1205 must use the resulting protected-main commit as its immutable verifier pin after this PR merges and the new main checks are verified.

Related: #1205, #1201, #1206.

Summary by Sourcery

Harden signed release-tag verification against invalid ancestry, mutable refs, and inconsistent GitHub event state.

Bug Fixes:

  • Correct release-tag ancestry validation to use GitHub Compare API results and reject tags whose targets do not match the triggering event commit.

Enhancements:

  • Harden release verification by validating annotated tag identity, checking protected main stability throughout ancestry verification, and rechecking the tag ref before completion.

Documentation:

  • Update changelog and README test-count metrics.

Tests:

  • Add comprehensive coverage for valid and invalid ancestry, tag retargeting, protected-main changes, API failures, and event SHA mismatches.

CodeAnt-AI Description

Bind signed release tags to the pushed commit and protected main

What Changed

  • Release tags are accepted only when their signed commit matches both the push event and GitHub’s commit context.
  • Release commits must be contained in protected main; verification rejects changes to main or the tag while checks are running.
  • Ancestry checks use GitHub’s comparison results to accept valid release commits and reject divergent ones.

Impact

✅ Valid release tags pass ancestry checks
✅ Mismatched or retargeted release tags are rejected
✅ Releases are rejected if protected main changes during verification

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Chores
    • Release tags are now checked against the commit associated with the tag push and verified against protected main before being accepted.
  • Documentation
    • Updated the documented test totals to reflect 8,705+ tests across 656 files.

Bind version-tag verification to the push event SHA and check protected-main ancestry using the compare response's base_commit and merge_base_commit fields. Recheck the annotated tag ref before returning the verified target SHA.\n\nAdd regressions for real-shaped ahead and identical responses, malformed or divergent comparisons, and preserve the existing pull-request signature path.
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
worldscript-studio Ignored Ignored Preview Nov 8, 2026 10:04pm UTC

@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Sorry @qnbs, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 hours and 19 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #05ecf Reviewed your PR 3d38186 Nov 08, 2026 · 22:04 22:07
✅  #e3cba Reviewed your PR ea8d1f3 Nov 08, 2026 · 21:51 21:54

@codeant-ai

codeant-ai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The tag-push verification now binds the tag target to the event SHA. It verifies tag and commit signatures, checks ancestry against protected main through the GitHub Compare API, and confirms that the tag and branch refs remain unchanged during verification.

Changes: Release Tag Verification

Layer / File(s) Summary
Expected commit SHA binding
scripts/signing/verify-remote.d.mts, scripts/signing/verify-remote.mjs, scripts/signing/verify-github-signatures.mjs, tests/unit/signing.test.ts
The verifier adds an expected-SHA helper and a result type with an optional verifiedTagSha. The tag-push path validates the event ref and tag name, then passes the expected SHA to remote verification. The signing test asserts the returned verified SHA.
Remote tag and ancestry checks
scripts/signing/verify-remote.mjs
Remote verification validates the expected SHA and annotated tag name, rejects a tag target that differs from the expected SHA, checks protected-main ancestry through the Compare API, and confirms that main and the tag ref remain unchanged.
Verification tests and release notes
tests/unit/tooling/verifyRemoteTag.test.ts, CHANGELOG.md, README.md
Unit tests cover accepted and rejected verification cases, including signature, ancestry, and ref-stability checks. The changelog describes the verification, and the README test totals are updated.
Merge Risk: Minimal · up to 3d381

The change tightens release-tag verification, with ancestry checks and tag binding that fail closed. No concrete merge-blocking defect was established in the supplied evidence.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d9c02fc and 3d38186.

Files selected for processing: 7

  • CHANGELOG.md
  • README.md
  • scripts/signing/verify-github-signatures.mjs
  • scripts/signing/verify-remote.d.mts
  • scripts/signing/verify-remote.mjs
  • tests/unit/signing.test.ts
  • tests/unit/tooling/verifyRemoteTag.test.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Expose the expected tag target input and the verified target SHA in the remote verification type declarations.

  • scripts/signing/verify-remote.d.mts L25-28, L51, L58-61

Implementation

Bind release-tag verification to the push event and GitHub context SHAs, verify annotated-tag identity and protected-main ancestry using Compare API fields, and recheck main and the tag ref before accepting the target.

  • scripts/signing/verify-remote.mjs L37-69, L113-127, L153-167 (+3 small edits)

Require a version-tag push event whose ref matches the requested tag, derive its expected target from the event payload and GitHub SHA, and pass that target to remote verification.

  • scripts/signing/verify-github-signatures.mjs L6, L52-61

Documentation

Update the changelog and README test-count metrics to reflect the added coverage, and document the release-tag verification change.

  • CHANGELOG.md L10-11
  • README.md L23-1032 (4 small edits)

Tests

Add regressions for event-SHA binding, tag identity and retargeting, protected-main ancestry and stability, API failures, and signature verification outcomes.

  • tests/unit/signing.test.ts L883-896, L903-907 (+2 small edits)
  • tests/unit/tooling/verifyRemoteTag.test.ts L1-266

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T22:05:27.491145Z 3d38186 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Nov 8, 2026
@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

View results CodeAnt  CodeAnt Quality Gate Results

Commit 3d381860 · Scanned Nov 08, 2026 at 22:04 UTC

✅  Overall Status: PASSED

Quality Gate Status Details
New code coverage ⚪  Not applicable Not applicable — no applicable code changes
Secrets ✅  Passed 0 secrets found
Duplicate code ✅  Passed 0.0% duplicated
SAST ✅  Passed No security issues
Bugs ✅  Passed Rating S · No bugs
IaC ✅  Passed No IAC issues

@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

View results CodeAnt  CodeAnt Coverage Report

Commit 3d381860 · Scanned Nov 08, 2026 at 22:04 UTC

⚪  Overall Status: Not applicable

Coverage Status Details
New Code Coverage ⚪  Not applicable Not applicable — no applicable code changes

New-code coverage threshold not configured; coverage is reported but not enforced.

codescene-access[bot]

This comment was marked as outdated.

Comment thread scripts/signing/verify-remote.mjs Resolved
@codeant-ai

codeant-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge.
  • Tag verification rechecks that main remains protected and at the same commit after the ancestry comparison.

Assessed commit: 3d3818600c69

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

[check-pr-size] PR size is over the target tier (normal profile): 7 files, 404 meaningful lines, 4 commits — limit ≤8 files / ≤400 lines / ≤6 commits. Consider splitting into smaller, independently reviewable PRs.

@qnbs

qnbs commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI review

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Absence of Expected Change Pattern

  • WorldScript-Studio/tests/unit/signing.test.ts is usually changed with: WorldScript-Studio/scripts/signing/signing-core.mjs

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@qnbs
qnbs merged commit 1474706 into main Nov 8, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant