Skip to content

[WRONG BRANCH] fix(ci): invalidate maintainer-sponsored on synchronize (treat sponsorship as head-specific) - #46

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-with-maintainer-sponsored-label
Draft

[WRONG BRANCH] fix(ci): invalidate maintainer-sponsored on synchronize (treat sponsorship as head-specific)#46
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-with-maintainer-sponsored-label

Conversation

@luvs01

@luvs01 luvs01 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A security gap allowed the maintainer-sponsored label to survive a synchronize event, letting stale sponsorship authorize new, unreviewed changes to sensitive surfaces like auth, workflows, release automation, and dependency files.
  • The intent is to ensure sponsorship is tied to the reviewed revision so that new commits require a fresh maintainer review before the hygiene gate is cleared.

Description

  • Introduce HEAD_SPECIFIC_APPROVAL_LABELS (includes maintainer-sponsored) in .github/scripts/pr-sponsored-surface.cjs and export it so the hygiene job can treat those approvals as head-specific.
  • Update .github/workflows/pr-hygiene.yml to remove every label in HEAD_SPECIFIC_APPROVAL_LABELS on a synchronize event before re-evaluating the PR, preventing stale approvals from suppressing unsponsored_surface.
  • Add a small regression test in .github/scripts/pr-sponsored-surface.test.cjs asserting the sponsorship label is included among head-specific approvals.

Testing

  • Ran node --test .github/scripts/pr-sponsored-surface.test.cjs, which passed.
  • Ran bun run privacy:scan, git diff --check, bun run typecheck, and bun run lint:gui, which passed.
  • Ran bun run prepush and the prepush driver completed typecheck and lint steps, but the full-suite push encountered unrelated environment-sensitive failures/timeouts in some tests.
  • Running bun test tests/ci-workflows.test.ts failed in this environment due to the runtime lacking Bun.YAML.parse (an environment/runtime mismatch), so full workflow tests could not be completed here.

Codex Task

Summary by CodeRabbit

  • Bug Fixes
    • Improved pull request approval-label handling after updates.
    • Added support for maintainer-sponsored approvals alongside other revision-specific exceptions.
  • Tests
    • Added coverage to verify maintainer-sponsored approvals are treated as revision-specific labels.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change exports a shared list of head-specific approval labels, tests the list, and updates the PR hygiene workflow to use it during synchronization cleanup.

Changes

Head-specific approval label handling

Layer / File(s) Summary
Approval label contract and test
.github/scripts/pr-sponsored-surface.cjs, .github/scripts/pr-sponsored-surface.test.cjs
The script exports five head-specific approval labels. The test verifies that "maintainer-sponsored" is included.
Synchronization cleanup integration
.github/workflows/pr-hygiene.yml
The workflow imports the shared label list and uses it instead of an inline label list after PR synchronization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes invalidating the maintainer-sponsored label on synchronize events because sponsorship is specific to the PR head.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-vulnerability-with-maintainer-sponsored-label

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@github-actions github-actions Bot changed the title fix(ci): invalidate maintainer-sponsored on synchronize (treat sponsorship as head-specific) [WRONG BRANCH] fix(ci): invalidate maintainer-sponsored on synchronize (treat sponsorship as head-specific) Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev. UI screenshot required.

What to do

  • Retarget this PR to dev — all contributions go to dev.
  • Add a screenshot of the UI change to the PR description.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 11:13

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/pr-sponsored-surface.test.cjs:
- Around line 11-14: Update the HEAD_SPECIFIC_APPROVAL_LABELS test to assert the
exact five-label contract, rather than only checking that "maintainer-sponsored"
is included. Use the complete expected label set defined by
HEAD_SPECIFIC_APPROVAL_LABELS and preserve the existing test’s purpose of
validating all labels cleared when the reviewed revision changes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8ef84b0a-e33f-4ab5-bd61-76df065a10c0

📥 Commits

Reviewing files that changed from the base of the PR and between 2468502 and f4fd87a.

📒 Files selected for processing (3)
  • .github/scripts/pr-sponsored-surface.cjs
  • .github/scripts/pr-sponsored-surface.test.cjs
  • .github/workflows/pr-hygiene.yml

Comment on lines +11 to +14
describe("HEAD_SPECIFIC_APPROVAL_LABELS", () => {
it("invalidates maintainer sponsorship when the reviewed revision changes", () => {
assert.ok(HEAD_SPECIFIC_APPROVAL_LABELS.includes("maintainer-sponsored"));
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Assert the complete head-specific approval-label contract.

Line 13 checks only maintainer-sponsored. The test still passes if any of the other four labels are removed or renamed. The synchronization workflow would then stop clearing that approval after a new commit.

Assert the exact five-label set.

Proposed assertion
-    assert.ok(HEAD_SPECIFIC_APPROVAL_LABELS.includes("maintainer-sponsored"));
+    assert.deepStrictEqual([...HEAD_SPECIFIC_APPROVAL_LABELS].sort(), [
+      "dependency-change-approved",
+      "generated-change-approved",
+      "maintainer-sponsored",
+      "suppression-approved",
+      "test-exception-approved",
+    ].sort());

As per path instructions, .github/** is a security boundary, and workflow changes require explicit security review per MAINTAINERS.md.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
describe("HEAD_SPECIFIC_APPROVAL_LABELS", () => {
it("invalidates maintainer sponsorship when the reviewed revision changes", () => {
assert.ok(HEAD_SPECIFIC_APPROVAL_LABELS.includes("maintainer-sponsored"));
});
describe("HEAD_SPECIFIC_APPROVAL_LABELS", () => {
it("invalidates maintainer sponsorship when the reviewed revision changes", () => {
assert.deepStrictEqual([...HEAD_SPECIFIC_APPROVAL_LABELS].sort(), [
"dependency-change-approved",
"generated-change-approved",
"maintainer-sponsored",
"suppression-approved",
"test-exception-approved",
].sort());
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/pr-sponsored-surface.test.cjs around lines 11 - 14, Update
the HEAD_SPECIFIC_APPROVAL_LABELS test to assert the exact five-label contract,
rather than only checking that "maintainer-sponsored" is included. Use the
complete expected label set defined by HEAD_SPECIFIC_APPROVAL_LABELS and
preserve the existing test’s purpose of validating all labels cleared when the
reviewed revision changes.

Source: Path instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant