Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Git worktree directories created with chmod 777 (CWE-732)

オープン 初心者向け
#6,392 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@DevashishX がすでに取り組んでいます。

2026年10月8日 から。

  • #6412 @DevashishX による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
git, python
領域
backend, security

調査の方向性

st2common/st2common/runners/base.py の385-387行目から始め、git worktree のパスがどのように作成され、chmod に渡されるかを追跡します。shell=True がないことも含め、worktree に対する結果の権限とコマンドの動作を検証します。worktree へのアクセスが必要なユーザーに限定され、他のローカルユーザーにアクションコードが公開されないことを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

When StackStorm creates git worktree directories for pack content versioning, it sets the permissions to 777 (world-readable, world-writable, world-executable). This allows any user on the system to read or tamper with action code before it executes.

Affected File

st2common/st2common/runners/base.py (lines 385-387)

# Make sure system / action runner user can access that directory
args = ["chmod", "777", worktree_path]
cmd = list2cmdline(args)
run_command(cmd=cmd, shell=True)

This also unnecessarily uses shell=True for a simple chmod operation.

Impact

The worktree directory contains the action code that will be executed by the action runner. With 777 permissions:

  1. Code tampering: Any local user can modify the action scripts in the worktree between creation and execution, achieving arbitrary code execution in the context of the StackStorm action runner.

  2. Information disclosure: Any local user can read the action code, which may contain embedded configuration, API endpoints, or logic that should not be broadly accessible.

  3. Race condition: Since the worktree is created and then permissions are set in a separate step, there is a window where the directory exists with its original permissions before being opened up.

Recommended Fix

Use the minimum necessary permissions. The directory only needs to be accessible by the StackStorm system user and the action runner user:

# Use 750 (owner: rwx, group: r-x, other: none) or 770 if group write is needed
args = ["chmod", "750", worktree_path]

Or better, set ownership and permissions atomically:

import os
import stat

os.chmod(worktree_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP)  # 750

This also eliminates the need for shell=True and the subprocess call entirely.

References

  • CWE-732: Incorrect Permission Assignment for Critical Resource
  • Discovered via manual code review
主要言語
Python
スター
6.5k
フォーク
792
平均マージ
1日 3時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

StackStorm/st2 のほかの issue

StackStorm/st2 の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。