Skip to content

ci: guard privileged workflows so they cannot run in forks - #6786

Open
maphew wants to merge 13 commits into
Kilo-Org:mainfrom
maphew:kilo/sharp-matrix-ke1
Open

maphew wants to merge 13 commits into
Kilo-Org:mainfrom
maphew:kilo/sharp-matrix-ke1

Conversation

@maphew

@maphew maphew commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6248

Summary

Add a job-level if: github.repository == 'Kilo-Org/cloud' guard to every fork-triggerable privileged workflow listed in issue #6248, so forks with Actions enabled cannot trigger deploys, releases, migrations, container pushes, or shared-state automation.

Guarded (all 17 files from the issue)

  • auto-docs.yml (call-valtown)
  • bump-openclaw.yml (check)
  • check-md-table-padding.yml (check)
  • codeql.yml (analyze)
  • deploy-production.yml (all 12 jobs)
  • deploy-staging.yml (all 5 jobs)
  • deploy-workers.yml (deploy-manual, detect-changes, deploy-changed)
  • deploy-kiloclaw.yml (deploy, attest-sbom, push-dev-image)
  • extension-store-release.yml (build-artifacts, bump-version)
  • kilo-app-release.yml (all 7 jobs)
  • promote-vercel-deployment.yml (promote)
  • push-dev-kiloclaw.yml (push-dev)
  • redeploy-web.yml (all 5 jobs)
  • sbom.yml (source-sbom)
  • setup-smoke.yml (setup-smoke)
  • stage-vercel-deployment.yml (stage)
  • stale-prs.yaml (stale)

Notes

  • For pull_request/pull_request_target events, github.repository is already the base repo, so the guard is a no-op there and only blocks the fork-triggerable paths (workflow_dispatch, schedule).
  • Reusable workflows (promote-vercel-deployment.yml, stage-vercel-deployment.yml, deploy-workers.yml) are guarded on both the caller job and the called workflow's own job, so they cannot run outside the canonical repo even if a caller skips its guard.
  • Pattern copied from upstream Kilo-Org/kilocode .github/workflows/auto-docs.yml.
  • All edited YAML files validated with yaml.safe_load.
  • CI/PR-validation workflows intentionally left unguarded per the issue: ci.yml, extension-ci.yml, kilo-app-ci.yml, mobile-native-build.yml, chromatic.yml, trufflehog.yml.

Out of scope (flagged for follow-up)

  • cloud-agent-e2e-deploy.yml and cloud-agent-e2e-tests.yml are workflow_dispatch-triggered and use admin secrets (CLOUDFLARE_API_TOKEN, FAKE_LLM_ADMIN_TOKEN, E2E_INTERNAL_API_SECRET). They are not in the issue's guarded or unguarded lists, so they are left untouched here; please add them to the issue if they should be guarded.
  • kilo-mcp-catalog.yml's catalog-pr job does contents: write on same-repo PRs but is pull_request-only (guard would be a no-op). Not in either list; suggested for the issue's unguarded list.

@maphew
maphew marked this pull request as ready for review September 28, 2026 08:02
@kilo-code-bot

kilo-code-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change since beb897a only adds canonical-repo guards to check-changes, stage-ai-gateway, and kilo-mcp-release in deploy-production.yml and restores the base_sha requirement on deploy-workers.yml detect-changes; all 12 production jobs now carry the guard and both deploy-workers callers supply a non-empty base_sha, so no new defects were found.

Assumptions: [INFERENCE] The beb897a..HEAD diff also contains upstream merge content outside the PR's effective file set (gh pr diff --name-only = 17 workflow files), so review scope was limited to the PR files and their current state was verified against HEAD 9c62fb6.

Files Reviewed (4 files)
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/deploy-staging.yml (targeted check of base_sha caller)
  • .github/workflows/check-deployment-changes.yml (targeted check of base_sha output)
Previous Review Summaries (8 snapshots, latest commit beb897a)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit beb897a)

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The two blocking guard defects from the previous review are fixed at HEAD beb897a; the remaining findings are non-blocking: an unrelated condition change in deploy-workers.yml change detection and an over-broad coverage claim in a deploy-production.yml comment.

Assumptions: [INFERENCE] none. The d7db102..HEAD diff includes the upstream merge of 4k+ files, so review scope was limited to the 17 workflow files in the PR diff while re-verifying the prior findings against current code.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
.github/workflows/deploy-workers.yml 132 The added (inputs.base_sha != '' || inputs.target_environment != 'production') clause is unrelated to the fork guard. With an empty base_sha, detect-changes runs with BASE_SHA="", every git diff fails, and all deployable workers are treated as changed (full staging redeploy). Latent only because both current callers pass a non-empty base_sha.
.github/workflows/deploy-production.yml 30 New comment claims the guard "is applied to every job", but stage-ai-gateway and kilo-mcp-release have no github.repository guard. Both are covered indirectly (guarded reusable workflow / guarded deploy-workers dependency), so this is comment accuracy, not a runtime hole.
Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml - 1 suggestion
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml - 1 suggestion
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Verification Notes

  • Both previous CRITICAL findings are resolved: deploy-workers.yml detect-changes no longer references needs.check-changes, and deploy-production.yml promote-ai-gateway now guards on github.repository alone while still inheriting skip/failure from its needs.
  • The previous comment-accuracy suggestion is also resolved; its replacement wording is what the line-30 finding above refers to.
  • Prior inline comments are now outdated (line: null) and are not duplicated.

Fix these issues in Kilo Cloud

Previous review (commit d7db102)

Status: 3 Issues Found | Recommendation: Address before merge

Executive Summary

Two job guards reference a needs.check-changes output that the job does not list as a dependency, so deploy-workers.yml's detect-changes and deploy-production.yml's promote-ai-gateway are always skipped, silently disabling automatic Worker deploys and promotion of the AI gateway to production.

Overview

Severity Count
CRITICAL 2
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

CRITICAL

File Line Issue
.github/workflows/deploy-workers.yml 91 detect-changes references needs.check-changes.outputs.should_deploy, but no check-changes job exists in this reusable workflow and the job declares no needs, so the condition is always false and deploy-changed never runs. Automatic Worker deploys from the production and staging pipelines are silently disabled.
.github/workflows/deploy-production.yml 155 promote-ai-gateway gates on needs.check-changes.outputs.should_deploy, but check-changes is not in its needs (only stage-ai-gateway, check-production-db-startup, run-migrations are), so the value is empty and the condition is always false. The AI gateway is never promoted to production, and record-deployment (which requires needs.promote-ai-gateway.result == 'success') is skipped as well. promote-app and promote-global-app correctly guard on github.repository alone.

SUGGESTION

File Line Issue
.github/workflows/deploy-production.yml 29 Comment claims the workflow "only triggers on pushes to main", but it triggers on schedule and workflow_dispatch, both fork-reachable, so the guard is a real fork block rather than defense-in-depth.
Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml - 2 issues (1 critical, 1 suggestion)
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml - 1 issue (critical)
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Verification Notes

  • The previous review SHA (190f611f8) is not present in the repository (the branch was rebased), so this run fell back to a full review of the current PR diff at d7db102e9.
  • The three reverted-then-restored jobs (promote-ai-gateway, record-deployment, staging deploy-workers needs) are present in the current HEAD, but promote-ai-gateway carries the new needs.check-changes defect reported above.

Fix these issues in Kilo Cloud

Previous review (commit 190f611)

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The guard additions are correct, but deploy-workers.yml's detect-changes job now references a non-existent needs.check-changes, which permanently skips worker deployment and disables automatic Worker deploys from the production and staging pipelines.

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

CRITICAL

File Line Issue
.github/workflows/deploy-workers.yml 91 detect-changes uses needs.check-changes.outputs.should_deploy, but no check-changes job exists in this reusable workflow and the job declares no needs, so the condition is always false and deploy-changed never runs. Automatic Worker deploys from deploy-production.yml and deploy-staging.yml are silently disabled.

SUGGESTION

File Line Issue
.github/workflows/deploy-production.yml 29 Comment claims the workflow "only triggers on pushes to main", but it triggers on schedule and workflow_dispatch, both fork-reachable, so the guard is a real fork block rather than defense-in-depth.
Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml - 1 issue (suggestion)
  • .github/workflows/deploy-staging.yml - verified, no issues
  • .github/workflows/deploy-workers.yml - 1 issue (critical)
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Verification Notes

  • The previous review SHA (1d8ec82) is no longer present in the repository (the branch was rebased), so this run fell back to a full review of the current PR diff at 190f611f8.
  • The three reverted-then-restored jobs (promote-ai-gateway, record-deployment, staging deploy-workers needs) are correct in the current HEAD.

Fix these issues in Kilo Cloud

Previous review (commit 1d8ec82)

Status: No Issues Found | Recommendation: Merge

Executive Summary

This PR adds github.repository == 'Kilo-Org/cloud' guards to 17 fork-triggerable privileged workflows; guard expressions, operator precedence, needs/!cancelled() composition, reusable-workflow call sites, and YAML placement are all correct, and no issues were found in the changed lines.

Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Previous review (commit 5657d7e)

Status: No Issues Found | Recommendation: Merge

Executive Summary

This hardening PR adds if: github.repository == 'Kilo-Org/cloud' guards to 17 fork-triggerable privileged workflows; guard placement, needs/if composition, and reusable-workflow call sites remain correct, and no defects were found in the changed lines.

Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Note: the branch was rebased onto a newer main; the guard diff is unchanged, so this review re-verified the current full PR diff.

Previous review (commit c8853be)

Status: No Issues Found | Recommendation: Merge

Executive Summary

This hardening PR adds if: github.repository == 'Kilo-Org/cloud' guards to 17 fork-triggerable privileged workflows; the guard placement, needs/if composition, and reusable-workflow call sites are all correct, and no defects were found in the changed lines.

Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Note: the branch was rebased (previous review SHA c57675da is no longer an ancestor of HEAD), so this review covers the current full PR diff. Guards are one-line additions; no inline comments were posted.

Previous review (commit c57675d)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Previous review (commit 4e0a0c4)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (17 files)
  • .github/workflows/auto-docs.yml
  • .github/workflows/bump-openclaw.yml
  • .github/workflows/check-md-table-padding.yml
  • .github/workflows/codeql.yml
  • .github/workflows/deploy-kiloclaw.yml
  • .github/workflows/deploy-production.yml
  • .github/workflows/deploy-staging.yml
  • .github/workflows/deploy-workers.yml
  • .github/workflows/extension-store-release.yml
  • .github/workflows/kilo-app-release.yml
  • .github/workflows/promote-vercel-deployment.yml
  • .github/workflows/push-dev-kiloclaw.yml
  • .github/workflows/redeploy-web.yml
  • .github/workflows/sbom.yml
  • .github/workflows/setup-smoke.yml
  • .github/workflows/stage-vercel-deployment.yml
  • .github/workflows/stale-prs.yaml

Reviewed by deepseek-flash-latest · Input: 74.1K · Output: 11.9K · Cached: 835.8K

Review guidance: REVIEW.md from base branch main

Comment thread .github/workflows/deploy-workers.yml Outdated
Comment thread .github/workflows/deploy-production.yml Outdated
maphew and others added 6 commits October 13, 2026 14:56
Add a job-level  guard to
fork-triggerable privileged workflows so forks with Actions enabled
cannot trigger deploys, releases, migrations, or container pushes.

Guarded workflows: bump-openclaw, check-md-table-padding, codeql,
deploy-production, deploy-staging, deploy-workers, deploy-kiloclaw,
extension-store-release, kilo-app-release, redeploy-web, auto-docs.

Closes Kilo-Org#6248

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Complete the issue Kilo-Org#6248 scope: add the canonical-repo guard to the
remaining guarded workflows (push-dev-kiloclaw, sbom, setup-smoke,
stale-prs, promote-vercel-deployment, stage-vercel-deployment) and add
consistency comments to the bare guards in deploy-production,
deploy-staging, deploy-workers, kilo-app-release, and redeploy-web.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@maphew
maphew force-pushed the kilo/sharp-matrix-ke1 branch from 190f611 to d7db102 Compare October 13, 2026 21:56
Comment thread .github/workflows/deploy-production.yml Outdated

@maphew maphew left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed the review: removed the check-changes output guard from deploy-workers.yml's detect-changes (the reusable workflow has no such job), made promote-ai-gateway guard on repository alone like promote-app (check-changes is not in its needs), and corrected the fork-reachability comment for the scheduled/dispatch triggers.

Comment thread .github/workflows/deploy-workers.yml Outdated
Comment thread .github/workflows/deploy-production.yml
Guard check-changes, stage-ai-gateway, and kilo-mcp-release so the deploy-production comment holds for every job, and restore the base_sha requirement in deploy-workers now that the staging caller passes one.

Agent-Signature: kilo-kilo-auto/efficient-unknown-reasoning on behalf of matt wilkie

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: guard privileged workflows so they cannot run in forks

1 participant