Skip to content

fix: fail CLA allowlist step on API errors - #251

Open
alexisrolland wants to merge 1 commit into
mainfrom
fix/cla-api-failure-handling
Open

fix: fail CLA allowlist step on API errors#251
alexisrolland wants to merge 1 commit into
mainfrom
fix/cla-api-failure-handling

Conversation

@alexisrolland

Copy link
Copy Markdown
Member

Summary

Make the CLA author allowlist step fail when its GitHub API request fails instead of silently continuing with only the base allowlist.

Changes

  • Capture the pull request commit API response before filtering authors.
  • Fail explicitly when the API request or pagination fails.
  • Preserve the valid author-only case where filtering produces no co-authors.

Verification

The shared implementation was validated for author-only, co-author, and simulated API-failure scenarios in Comfy-Org/comfy-cla.

Propagates Comfy-Org/comfy-cla#1 and addresses Comfy-Org/ComfyUI_frontend#15555.

@alexisrolland
alexisrolland requested a review from a team as a code owner August 21, 2026 18:57
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1916b9f7-1eff-486e-9047-b1d8a4aa0bfb

📥 Commits

Reviewing files that changed from the base of the PR and between 5a1da17 and 129cba8.

📒 Files selected for processing (1)
  • .github/workflows/cla.yml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The CLA workflow now checks the GitHub API result when it retrieves pull-request commits. It logs an error and exits on failure. Successful requests retain the existing author extraction, deduplication, and pull-request author exclusion.

Changes

CLA workflow

Layer / File(s) Summary
Commit-fetch validation
.github/workflows/cla.yml
The workflow checks the commit-fetch result, logs an error, and stops before constructing the non-author allowlist. Successful requests retain the existing processing.

Suggested reviewers: annehe9, bigcat88, christian-byrne

Merge Risk: ⚪ Minimal · up to 129cb

The PR makes the CLA allowlist workflow fail explicitly on GitHub API errors while preserving valid author-only behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cla-api-failure-handling
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/cla-api-failure-handling

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions 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.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 6 finding(s).

Severity Count
🟠 High 1
🟡 Medium 2
🟢 Low 2
⚪ Nit 1

Panel: 8/8 reviewers contributed findings.

Comment thread .github/workflows/cla.yml
echo "Failed to fetch pull request commits" >&2
exit 1
fi
others=$(printf '%s\n' "$commit_authors" | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High — The .commit.author.name fallback is fully contributor-controlled (any commit can set git config user.name, and an email with no matching GitHub account forces the fallback), and nothing strips commas or wildcards before the value is joined with paste -sd, into allowlist=${BASE_ALLOWLIST},${others}. A commit authored as Hacker,admin injects an extra allowlist entry, and since contributor-assistant treats the list as globs (the base list relies on *[bot]), an author name of * exempts every contributor from signing the CLA. Filter out or reject entries containing ,/* before joining. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max adversarial, gemini-3.1-pro adversarial, claude-opus-5-thinking-max edge-case).

Comment thread .github/workflows/cla.yml
echo "Failed to fetch pull request commits" >&2
exit 1
fi
others=$(printf '%s\n' "$commit_authors" | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium — The "only the PR author must sign" invariant rests on grep -vix "${PR_AUTHOR}", but the jq fallback can emit an arbitrary raw git name for that same person, and the login is interpreted as a regex rather than a fixed string. A PR author can push a commit whose author name is a near-miss of their login (e.g. alic*, or the login with a trailing space) so it survives the filter, lands in the allowlist, and then matches them in the CLA action — self-exempting. Use grep -vixF and normalize/trim entries. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k2.7-code adversarial).

Comment thread .github/workflows/cla.yml
echo "Failed to fetch pull request commits" >&2
exit 1
fi
others=$(printf '%s\n' "$commit_authors" | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Mediumgrep -vix exits 1 when the PR author is the only committer — the common case — and the new if ! guard covers only the gh call, not this pipeline. Today the step stays green solely because the default step shell is bash -e {0} without pipefail and the assignment takes only paste's status; adding an explicit shell: bash (which is -eo pipefail) or set -o pipefail would break every single-author PR. Append || true to the grep so the intent is explicit and the step is safe to harden later. Raised by 4 of 8 reviewers (gemini-3.1-pro edge-case, gemini-3.1-pro adversarial, claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).

Comment thread .github/workflows/cla.yml
echo "Failed to fetch pull request commits" >&2
exit 1
fi
others=$(printf '%s\n' "$commit_authors" | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Low — Since pipefail is off, a failure in sort or grep (e.g. grep's exit 2 on an error) leaves others silently empty and emits a base-only allowlist — the same silent-wrong-allowlist outcome this diff sets out to prevent, now only closed for the gh call. Setting set -o pipefail at the top would close the gap, but only in combination with the || true fix above. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).

Comment thread .github/workflows/cla.yml
if ! commit_authors=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --paginate \
--jq '.[] | (.author.login // .commit.author.name // empty), (.committer.login // .commit.committer.name // empty)'); then
echo "Failed to fetch pull request commits" >&2
exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Low — The new exit 1 fails the whole step, and the following "CLA Assistant" step has no always()/if: override, so it is skipped — a transient gh api blip now means no CLA status is ever posted for the PR (and a recheck comment silently does nothing), where previously the run degraded to the base allowlist. Consider falling back to BASE_ALLOWLIST with a warning annotation instead of hard-failing. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).

Comment thread .github/workflows/cla.yml
others=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --paginate \
--jq '.[] | (.author.login // .commit.author.name // empty), (.committer.login // .commit.committer.name // empty)' \
| sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)
if ! commit_authors=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --paginate \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit${{ github.repository }} is interpolated directly into the shell script of a pull_request_target job holding a write-scoped token, while the neighboring values (PR_NUMBER, PR_AUTHOR) correctly come through env:. A repository slug cannot contain shell metacharacters so this is not exploitable, but it is the one spot in the step that deviates from the safe pattern. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).

@alexisrolland

Copy link
Copy Markdown
Member Author

@mattmillerai not sure if you're the right person for this, but any idea what's happening with the CI?

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

Labels

cursor-review Request a Cursor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants