-
Notifications
You must be signed in to change notification settings - Fork 3k
ci(autofix): run the schema gate from a trusted staged copy, not the branch tree #7076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,6 +288,12 @@ jobs: | |
| rm -rf "${WORKDIR}" | ||
| mkdir -p "${WORKDIR}" | ||
|
|
||
| # Same staging as the review-address job: the verify gate always runs the | ||
| # trusted checkout's copy of the schema gate, never a working-tree copy. | ||
| - name: 'Stage trusted schema gate' | ||
| run: |- | ||
| cp .github/scripts/check-settings-schema.sh "${RUNNER_TEMP}/check-settings-schema.sh" | ||
|
|
||
| - name: 'Check bot credentials' | ||
| env: | ||
| GITHUB_TOKEN: '${{ secrets.CI_DEV_BOT_PAT }}' | ||
|
|
@@ -787,7 +793,11 @@ jobs: | |
| # verify step so the two copies cannot drift (rationale + the | ||
| # generator crash guard live in the script). On failure it writes | ||
| # outcome=failed to GITHUB_OUTPUT and exits 1. | ||
| bash .github/scripts/check-settings-schema.sh | ||
| # Run the copy staged from the trusted base checkout: a PR branch | ||
| # that predates the script does not contain it (bash would exit 127 | ||
| # and kill the gate with no outcome), and the gate logic must come | ||
| # from the trusted base, not the branch under verification. | ||
| bash "${RUNNER_TEMP}/check-settings-schema.sh" | ||
|
|
||
| # Run changed/related tests for the packages this fix touches. | ||
| # --changed follows the import graph so transitive breakage is caught. | ||
|
|
@@ -1196,6 +1206,16 @@ jobs: | |
| rm -rf "${WORKDIR}" | ||
| mkdir -p "${WORKDIR}" | ||
|
|
||
| # Stage the schema gate script from the TRUSTED BASE checkout before | ||
| # "Prepare branch and feedback" switches the working tree to the PR | ||
| # branch. The verify gate must run the trusted copy: a PR branch that | ||
| # predates this script does not contain it (bash exits 127 and the gate | ||
| # dies without an outcome), and an in-branch copy would let branch code | ||
| # define its own gate. | ||
| - name: 'Stage trusted schema gate' | ||
| run: |- | ||
|
Comment on lines
+1214
to
+1216
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Critical] Staging before checkout does not keep this destination trusted: after switching to the PR branch, — Codex GPT-5 via Qwen Code /review |
||
| cp .github/scripts/check-settings-schema.sh "${RUNNER_TEMP}/check-settings-schema.sh" | ||
|
|
||
| - name: 'Check runner environment' | ||
| env: | ||
| RUNNER_ENVIRONMENT: '${{ runner.environment }}' | ||
|
|
@@ -1474,7 +1494,11 @@ jobs: | |
| # the script); the write is on a tracked file compared by `git status`, | ||
| # not the commit-level no-op git-diff below, and it is restored on | ||
| # failure. On failure it writes outcome=failed and exits 1. | ||
| bash .github/scripts/check-settings-schema.sh | ||
| # Run the copy staged from the trusted base checkout: a PR branch | ||
| # that predates the script does not contain it (bash would exit 127 | ||
| # and kill the gate with no outcome), and the gate logic must come | ||
| # from the trusted base, not the branch under verification. | ||
| bash "${RUNNER_TEMP}/check-settings-schema.sh" | ||
|
|
||
| if git diff --quiet "origin/${BRANCH}...${BRANCH}"; then | ||
| # No new commit. That is only legitimate as a deliberate no-action. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Critical] This copy remains writable by branch-controlled host commands before it is invoked. In
issue-autofix, verification checks out the agent-created branch and runs itsnpm run build,npm run typecheck, andnpm run lintentry points withRUNNER_TEMPinherited before executing this file. A prompt-injected change to any of those entry points can replace the staged script with a successful no-op, so a stale schema passes and the later publish step pushes the unverified branch. Run branch-controlled commands inside a boundary that cannot mutate the gate, then materialize the trusted script from the pinned base immediately before invocation and verify its integrity instead of exposing a long-lived same-user-writable copy.— Codex GPT-5 via Qwen Code /review