Skip to content

fix(ci): prevent branch-selected installed-gate workflows - #603

Open
luvs01 wants to merge 1 commit into
devfrom
codex/investigate-github-workflow-vulnerability
Open

luvs01 wants to merge 1 commit into
devfrom
codex/investigate-github-workflow-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A manual workflow_dispatch trigger allowed a caller to select a branch whose workflow YAML would run on persistent self-hosted runners, enabling a collaborator-controlled workflow to execute arbitrary steps on privileged hosts.
  • The installed-artifact gate runs on maintainer-registered self-hosted GUI machines and performs privileged operations (including noninteractive sudo dpkg -i on Linux), so the workflow must be loaded from an immutable/default ref rather than an attacker-controlled branch.
  • The change locks the dispatch routing to a repository-side, default-branch-loaded event and preserves the existing required-review environment and protected dev checkout as the enforcement surface the repo controls.

Description

  • Replaced the branch-selectable workflow_dispatch trigger with a typed repository_dispatch event (types: [desktop-installed-gate]) so GitHub loads the workflow from the repository default branch.
  • Mapped all previously inputs-based references to github.event.client_payload (release/version/hook names) and adjusted the concurrency group to use github.event.client_payload.version so payload-driven behavior remains available but is loaded from the default ref.
  • Kept the required-review environment, actions/checkout pinned ref: dev, platform matrix, and hook-name boundary intact so the gate logic and protections remain the same at runtime.
  • Updated the CI unit test tests/ci-workflows/installed-gate-drivers.test.ts to assert the new repository_dispatch trigger and to extract the event payload keys from client_payload usage in the workflow file.

Testing

  • Ran the focused workflow tests with mise exec bun@latest -- bun test tests/ci-workflows/installed-gate-drivers.test.ts, which passed (49 passed).
  • Ran the repository privacy scan with mise exec bun@latest -- bun run privacy:scan, which passed.
  • Exercised the pre-push local checks with mise exec bun@latest -- bun run prepush; typecheck and GUI lint passed but the full-suite phase encountered unrelated environment-local proxy HTTP 403s (external environment routing) and was stopped after confirming the recurring environmental failures, so unrelated full-suite failures are not attributed to this change.

Codex Task


Devin Review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 426cc58f-1dd9-4be6-93db-c514bed4030c


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-21T06:28:20.958566Z 9899598 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the bug Something isn't working label Sep 21, 2026
@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 3 potential issues.

Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Explicit security review remains required

This change affects a GitHub Actions security boundary targeting privileged self-hosted runners. Repository policy requires explicit security review before merge.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +514 to 517
const inputNames = [...text.matchAll(/client_payload\[['"]([^'"]+)['"]\]/g)].map(match => match[1]);
expect(inputNames).toContain("consent-hook");
expect(inputNames).toContain("tray-quit-hook");
expect(inputNames).toContain("elevate-accept-hook");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Payload-key test no longer verifies the dispatch contract

The regex collects duplicated payload references from the workflow body, not declared inputs. It cannot detect missing required fields or distinguish accepted keys from incidental references.

(Refers to this code)

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +13 to +14
repository_dispatch:
types: [desktop-installed-gate]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟨 Unvalidated dispatch payloads reach privileged self-hosted runners

Repository dispatches no longer validate required versions before scheduling. Malformed events can occupy every privileged gate runner and trigger failing artifact operations after approval.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9899598c8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +13 to +14
repository_dispatch:
types: [desktop-installed-gate]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Land the dispatcher on the default branch before switching

When this commit lands on dev, the default branch (main) still does not contain .github/workflows/desktop-installed-gate.yml; GitHub states that repository_dispatch triggers a run only when the workflow file exists on the default branch. Consequently, every attempted dispatch is ignored until a later promotion to main, disabling the installed-artifact gate during the period in which releases are prepared from dev. Install a trusted dispatcher definition on main before removing the existing trigger, or use an already-default-branch workflow as the dispatch trampoline. GitHub’s repository_dispatch documentation documents this restriction.

AGENTS.md reference: AGENTS.md:L339-L341

Useful? React with 👍 / 👎.

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