Skip to content

[CI] Harden release workflow permissions and inputs#4072

Merged
Wauplin merged 2 commits intomainfrom
security/release-workflow-hardening
Apr 9, 2026
Merged

[CI] Harden release workflow permissions and inputs#4072
Wauplin merged 2 commits intomainfrom
security/release-workflow-hardening

Conversation

@Wauplin
Copy link
Copy Markdown
Contributor

@Wauplin Wauplin commented Apr 9, 2026

Summary

  • Replace broad top-level permissions: { contents: write, pull-requests: write } with permissions: {} and add least-privilege per-job permissions
  • Move VERSION_OVERRIDE and RELEASE_TYPE workflow inputs to env: blocks to prevent script injection
  • Pin OpenCode install to a specific version using vars.OPENCODE_VERSION and verify binary integrity via SHA256 checksum (vars.OPENCODE_SHA256)

Addresses security review from @paulinebm in #4046.

🤖 Generated with Claude Code


Note

Medium Risk
Changes the release GitHub Actions workflow (permissions, input handling, and third-party install verification), which can affect publishing if misconfigured but is limited to CI configuration.

Overview
Tightens the release.yml GitHub Actions workflow by removing broad top-level token permissions and granting least-privilege permissions per job (e.g., write only where tags/releases are created, read elsewhere).

Hardens shell execution by passing release_type/version_override via step env: instead of inline interpolation, and pins + verifies the OpenCode installer by specifying vars.OPENCODE_VERSION and validating the installed binary with vars.OPENCODE_SHA256.

Reviewed by Cursor Bugbot for commit 1cadd10. Bugbot is set up for automated code reviews on this repo. Configure here.

Apply least-privilege permissions per job instead of broad top-level
write access. Pin OpenCode install to a specific version. Move
workflow inputs to env blocks to prevent script injection.

Addresses security review from paulinebm in #4046.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented Apr 9, 2026

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Use repository variables OPENCODE_VERSION and OPENCODE_SHA256 to pin
the version and verify the binary integrity via sha256sum.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@Wauplin Wauplin marked this pull request as ready for review April 9, 2026 08:13
@Wauplin Wauplin requested a review from paulinebm April 9, 2026 08:13
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1cadd10. Configure here.

run: curl -fsSL https://opencode.ai/install | bash
run: |
curl -fsSL https://opencode.ai/install | bash -s -- --version ${{ vars.OPENCODE_VERSION }}
echo "${{ vars.OPENCODE_SHA256 }} $(which opencode)" | sha256sum -c -
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Repository variables interpolated directly in shell, bypassing env indirection

Medium Severity

${{ vars.OPENCODE_VERSION }} and ${{ vars.OPENCODE_SHA256 }} are directly interpolated into run: shell scripts — the same script-injection anti-pattern this PR fixes for inputs.* by moving them to env: blocks. Notably, vars.OPENCODE_VERSION is used unquoted, so a value containing shell metacharacters (e.g. ; malicious-cmd) would execute arbitrary commands. These expressions need the same env:-block indirection applied to the workflow inputs for defense-in-depth consistency.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1cadd10. Configure here.

@Wauplin Wauplin merged commit 1e34b33 into main Apr 9, 2026
13 of 21 checks passed
@Wauplin Wauplin deleted the security/release-workflow-hardening branch April 9, 2026 08:22
@Wauplin Wauplin changed the title Harden release workflow permissions and inputs [CI] Harden release workflow permissions and inputs Apr 9, 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.

2 participants