Skip to content

ci: harden cross-repo build workflow against workflow injection - #463

Merged
han-jiang277 merged 3 commits into
vivoblueos:mainfrom
wangchen-vivo:fix/secure-cross-repos-build
Aug 27, 2026
Merged

ci: harden cross-repo build workflow against workflow injection#463
han-jiang277 merged 3 commits into
vivoblueos:mainfrom
wangchen-vivo:fix/secure-cross-repos-build

Conversation

@wangchen-vivo

Copy link
Copy Markdown
Contributor

Fixes the command-injection RCE reported in vivoblueos/kernel#458, where attacker-controlled PR content was interpolated into execSync shell strings and could execute arbitrary commands in CI.

Changes

  • Command injection: run format/license/check commands via execFileSync argument arrays instead of execSync string concatenation, so filenames/repo names are never interpreted by a shell (poc$(id).rs no longer expands).
  • Fail-closed checks: a format tool that fails to run (file missing, parse error, tool crash) now fails the job instead of being skipped and reported as "All modified files pass format check".
  • Least privilege: format, license, and build jobs run with permissions: {} and a placeholder github-token: unused, so injected code cannot obtain the job's GITHUB_TOKEN. Container GHCR login credentials and packages: read were removed because the image is public.
  • Tokenless sync: the old setup job is split into resolve_prs, which keeps a token to comment and resolve PRs, and apply_prs, which runs repo init, sync, merge, and upload without one. This way repo sync has no GITHUB_TOKEN, so a <repo-hooks> hook injected via an attacker-controlled manifests PR cannot execute untrusted code.
  • Input validation: build_prs links must belong to this org; PR metadata is passed to shell steps via env rather than ${{ }} interpolation into run:, so a value containing shell metacharacters is treated as data and never evaluated as commands.
  • Resource limits: concurrency is grouped per PR, so a new build_prs comment cancels the in-progress run instead of launching another set of matrix build jobs.

@wangchen-vivo
wangchen-vivo force-pushed the fix/secure-cross-repos-build branch from c695aad to 9579b3e Compare August 26, 2026 11:58
@github-actions

Copy link
Copy Markdown

@wangchen-vivo
wangchen-vivo force-pushed the fix/secure-cross-repos-build branch from 44934cd to be5a227 Compare August 26, 2026 12:02
@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/32966137588.

@wangchen-vivo

Copy link
Copy Markdown
Contributor Author

build_prs

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/32968279881.

@wangchen-vivo

Copy link
Copy Markdown
Contributor Author

build_prs

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/32977874406.

@wangchen-vivo

Copy link
Copy Markdown
Contributor Author

build_prs

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/33030126518.

@wangchen-vivo

Copy link
Copy Markdown
Contributor Author

build_prs

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/33033612990.

@han-jiang277
han-jiang277 merged commit a86629d into vivoblueos:main Aug 27, 2026
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.

3 participants