Prevent issue content from executing shell commands in the release worker #307

Closed
opened 2026-08-08 14:09:51 +00:00 by rockachopa · 0 comments
Member

User impact

A Gitea issue title or body is currently interpolated into RELEASE_AGENT_COMMAND and executed with shell=True. An issue author can therefore run shell substitutions as the autonomous release account, potentially exposing its token or changing the checkout.

Evidence

  • src/release_engine.py formats {issue_title} / {issue_body} into command text.
  • ShellRunner passes that text to subprocess.run(..., shell=True).
  • Current tests cover only the numeric template field and no shell metacharacters.
  • No historical issue title or recent commit addresses the release-worker subprocess boundary.

Acceptance criteria

  • Runner executes argv with shell=False.
  • Configured agent/test commands are parsed as trusted argv; issue-controlled fields are available only via RELEASE_ISSUE_* environment variables.
  • Checkout and push use fixed argv arrays.
  • Shell metacharacters in issue title/body are preserved byte-for-byte in environment values and never enter executable syntax.
  • Malformed/empty command configuration fails before the issue is claimed.
  • Documentation explains argv semantics and trusted wrapper scripts for pipelines.
  • Focused and full suites pass.
## User impact A Gitea issue title or body is currently interpolated into `RELEASE_AGENT_COMMAND` and executed with `shell=True`. An issue author can therefore run shell substitutions as the autonomous release account, potentially exposing its token or changing the checkout. ## Evidence - `src/release_engine.py` formats `{issue_title}` / `{issue_body}` into command text. - `ShellRunner` passes that text to `subprocess.run(..., shell=True)`. - Current tests cover only the numeric template field and no shell metacharacters. - No historical issue title or recent commit addresses the release-worker subprocess boundary. ## Acceptance criteria - [ ] Runner executes argv with `shell=False`. - [ ] Configured agent/test commands are parsed as trusted argv; issue-controlled fields are available only via `RELEASE_ISSUE_*` environment variables. - [ ] Checkout and push use fixed argv arrays. - [ ] Shell metacharacters in issue title/body are preserved byte-for-byte in environment values and never enter executable syntax. - [ ] Malformed/empty command configuration fails before the issue is claimed. - [ ] Documentation explains argv semantics and trusted wrapper scripts for pipelines. - [ ] Focused and full suites pass.
timmy was assigned by rockachopa 2026-08-08 14:09:51 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#307
No description provided.