Repository navigation
fix(#8367): sign GitHub scaffold commits with createCommitOnBranch - #8368
Conversation
E2E tests are runningAuthorization passed for this commit. See the E2E Tests workflow for results. |
Site previewPreview: https://717ea206-site.fullsend-ai.workers.dev Commit: |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
PR Summary by QodoSign GitHub scaffold commits made with operator credentials
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Code Review by Qodo
1.
|
5d96c0a to
17d97b6
Compare
17d97b6 to
8b5554c
Compare
|
/review |
|
The branch from this PR was successfully built and used locally to onboard the following repo through the GitHub's GraphQL API: RedHatInsights/notifications-gw#1002 |
8b5554c to
4072992
Compare
4072992 to
62ee773
Compare
62ee773 to
3717468
Compare
3717468 to
c2aa9ae
Compare
waynesun09
left a comment
There was a problem hiding this comment.
One finding on the GraphQL branch-protection classification, inline.
c2aa9ae to
a95fa3d
Compare
waynesun09
left a comment
There was a problem hiding this comment.
One finding on merge readiness, inline.
…OnBranch GitHub signs Git Data REST commits only for App installation tokens, so scaffold commits made with an operator's token were unsigned, rulesets with required_signatures rejected them, and the CLI reported the branch as protected. Create commits of regular inline files (and deletions) with the GraphQL createCommitOnBranch mutation, which GitHub signs for any credential; keep the streamed Git Data path for vendored installs. Map STALE_DATA onto the non-fast-forward retry and rule violations onto ErrBranchProtected, and add forge.ErrSignedCommitsRequired so callers name the signature rule. Classic branch protection is recognised by its BRANCH_PROTECTION_RULE_VIOLATION type on GraphQL and by the bare check text it returns on REST, which the ref-update classifier missed for a pull-request, lock or signature rule. A STALE_DATA answer to a mutation the transport resent after a 5xx or timeout is checked against the branch content, so a commit GitHub had already applied is still reported as made. A RATE_LIMITED answer is resent after the wait GitHub's headers ask for, or reported at once when that wait is long. Record the decision and its trade-offs in ADR 0140. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Gwenneg Lepage <gwenneg@gmail.com>
a95fa3d to
3918a7c
Compare
waynesun09
left a comment
There was a problem hiding this comment.
One finding on verification coverage, inline.
Summary
fullsend repos installcreated GitHub scaffold commits through the Git Data REST API, which GitHub signs only for App installation tokens. With the credentials an operator uses (gh authtoken, fine-grained or classic PAT) the commit was unsigned, so a ruleset withrequired_signaturesrejected the ref update — and the CLI reported it as "scaffold branch is protected; configure branch protection". Organization-level rulesets cover every branch, so PR delivery failed as well as--direct.Closes #8367.
100644, noLocalPath), and every deletion-only commit, is now created with the GraphQLcreateCommitOnBranchmutation. GitHub signs those for any credential (author = authenticated account, committer = GitHub, as in the web UI).expectedHeadOidgives compare-and-swap;STALE_DATAmaps toforge.ErrNonFastForward(existing retry), ruleset violations and classicBRANCH_PROTECTION_RULE_VIOLATIONerrors map toforge.ErrBranchProtected(existing--direct→ PR fallback),NOT_FOUND/FORBIDDENto their sentinels.LocalPathor a non-100644mode keeps the streamed Git Data REST path (unsigned with user tokens). On the signed path a mode-only difference on an existing file counts as unchanged, since the mutation cannot change it and identical content would otherwise produce an empty commit on every converge.forge.ErrSignedCommitsRequired, wrapped alongsideErrBranchProtectedwhen GitHub says "Commits must have verified signatures" (REST or GraphQL), solayersnames the rule instead of advising on branch protection. GraphQLRATE_LIMITED(reported with HTTP 200) surfaces as a 429APIErrorsoIsRateLimitError/forge.IsTransientkeep working; a SAML-enforcementFORBIDDENis a credential error, not a protection rule. Classic protection on the REST ref update returns only the failed check ("Changes must be made through a pull request.", "Cannot change this locked branch", "Commits must have verified signatures."), which the classifier did not recognise; the shared matcher now knows those texts.FULLSEND_GITLAB_PIPELINE_VAR_RESTRICTION) and removed an operator flag in ADR 0078; a "legacy commits" escape hatch here would be a path e2e never exercises, re-creating the blind spot below. The REST path stays for the cases the mutation cannot serve.docs/cli/repos.mdgains a "Signed commits" section next to DCO sign-off (they are independent); repo-management, architecture and the threat model's commit-signing passage are annotated;forge.Clientinterface docs describe the per-forge signing and mode semantics.Trade-offs recorded in ADR 0140
chmod +x-ed by the installer action).vendor: true) cannot target signature-requiring repositories.Verification
required_signaturesruleset (details in repos install: GitHub scaffold commits are unsigned with user tokens and rejected by rulesets requiring verified signatures #8367): user-token REST commitunsignedand rejected with "Commits must have verified signatures"; GraphQL commitverified: validand accepted;STALE_DATA,NOT_FOUNDandFORBIDDENresponses captured and mapped as above.BRANCH_PROTECTION_RULE_VIOLATIONwithprotected branch '<name>' check failed:followed by the failed checks; the REST ref update answers 422 with the failed check alone. Classic "Require signed commits" accepts the mutation's commit (verified: valid) and rejects the unsigned REST commit. The captured messages are the test fixtures.main(280 commits): one conflict inrepo-management.mdresolved by keeping both sides; the operator-facing text now says "vendored install" /vendor: true, since Make repos install manifest-driven and remove persistent-setting flags #8219 maderepos.yamlthe only source of the vendoring setting.go build ./...,go vet,make go-teston the rebased head; patch coverage on changed code: new functions 100%,commitFilesTo88%,DeleteFiles84%,layersbranches covered.lint-adr-status,lint-adr-numbers),lint-docs-links, whitespace/EOF checks run directly (pre-commitis not installed on the authoring machine; CI runs the full hook set).🤖 Generated with Claude Code