fix(ci): gate claude-auto-fix-ci.yml to same-repo runs and exclude bots - #1663
Draft
Dhravya wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 18015f4 | Sep 12 2026, 02:39 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 18015f4 | Commit Preview URL Branch Preview URL |
Sep 12 2026, 02:40 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our automated "fix CI failures" helper was only staying out of pull requests opened from forks by accident, not by design. Because this repository is public and anyone can open a fork pull request, that accident was the only thing keeping outside contributors' code from being run inside a trusted, privileged automation that holds our write credentials — and this repository is the build source for the production MCP service that our AI agents and user memories sit behind. If that incidental behavior ever changed, someone else's untrusted code could execute with our secrets and push changes to the source that ships to production. Merging this makes the boundary explicit and permanent: the helper will only ever act on pull requests that originate inside this repository, and it also steps aside for routine bot-triggered runs.
Before / After
Before: When any pull request failed the type-check/format/lint checks, the auto-fix helper would consider stepping in and running with elevated, write-capable credentials. For fork pull requests it happened to stay out only because of an implicit quirk of how the platform reports those runs — nothing in the automation itself drew a line between "code from our team" and "code from an outside fork." That left a silent, fragile edge: if the platform's behavior ever shifted, or a fork run slipped through, untrusted code from an outside contributor could be pulled into the privileged automation, expose the automation's secret, and push commits onto the branch that feeds the production MCP build.
After: The auto-fix helper now checks, in plain terms, that the failing run came from a pull request inside this same repository before it does anything. A failing fork pull request still triggers the surrounding event, but the helper cleanly skips — no privileged run, no secret handed out, no code checkout, no push — and it keeps skipping even if the platform's incidental fork behavior changes later. Runs kicked off by the graphite and dependabot bots are skipped too, matching our existing review automation. Trusted same-repo pull requests are unaffected: the helper still runs and pushes fixes exactly as before.
What changed
Single file:
.github/workflows/claude-auto-fix-ci.yml, jobauto-fix, theif:gate.if:documenting the security boundary —workflow_runruns in the base-repo context with repository secrets, so checking out untrusted head-branch code there is the canonical "pwn request" pattern (linked to the GitHub Security Lab writeup).if:withgithub.event.workflow_run.head_repository.full_name == github.event.workflow_run.repository.full_nameso a run whose head is a fork can never execute the job, independent of the platform's implicit empty-pull_requestsbehavior.claude-code-review.yml:github.event.workflow_run.actor.login != 'graphite-app[bot]'and!= 'dependabot[bot]'. Theworkflow_runactorfield is used because this is aworkflow_run-triggered job.The
permissions, checkout,claude-code-actionstep, and--allowedToolslist are untouched, so the auto-fix capability is preserved for trusted same-repo pull requests (71 successful runs since March).Checks run
actionlint .github/workflows/claude-auto-fix-ci.yml(v1.7.12) — passed, no findings. Confirms the extendedif:expression and itsworkflow_runpayload references (head_repository.full_name,repository.full_name,actor.login) are valid.python3 -c "yaml.safe_load(...)"— passed.rg) for any test, doc, or config that references this workflow or asserts its gate value — none found, so no assertion was loosened or changed.bun run check-types/bun run format-lint(Biome) — not run against this change: the change is YAML-only, and the repo's Biome config lints code (TS/JS), not GitHub Actions workflow YAML, so these suites are unaffected. actionlint is the appropriate linter and was run instead.Assumptions
pull_requests[0]clause is retained (not replaced) so the gate is strictly additive; the new same-repo clause is the authoritative fork boundary while the original clause is preserved to avoid changing behavior for the trusted path.claude-code-review.yml; theworkflow_run.actor.loginfield is used rather thangithub.actorbecause for aworkflow_runtriggergithub.actoris not the reliable source of the triggering user.Fixes: Public repo auto-fix workflow with repo write + Bash(*) is a supply-chain path into the prod MCP build
What caused this
Affected:
int_ecd270c87001rlz8v4a308n0· severity mediumA check caught it, an investigation traced it, an autofix wrote the change. Each step links to its record.
fix_0960c6…This pull request originated from a Polylane autofix. Polylane investigated the issue and delegated the fix to Cursor, which authored this pull request.