cleanup-legacy.py: unchecked --module-code / --also-remove are passed to rmtree — '' or '.' deletes all of _bmad (agent memory included), '..' deletes the whole project
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
調査の方向性
Start with skills/bmad-bmb-setup/scripts/cleanup-legacy.py and inspect how it builds targets from --module-code and --also-remove before calling shutil.rmtree; check the related copies in the module-builder template and samples/sample-module-setup/ too. Trace verify_skills_installed() and the references to issues #96 and #139. Done when invalid or out-of-scope paths are refused and _bmad/memory/ is protected.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
cleanup-legacy.py joins --module-code and every --also-remove value onto --bmad-dir, then calls shutil.rmtree on the result. The script is shipped in skills/bmad-bmb-setup/scripts/, the module-builder setup-skill template, and samples/sample-module-setup/. Nothing validates these values:
| Value | Path(bmad_dir) / value |
What gets deleted |
|---|---|---|
--module-code "" |
_bmad/ |
all of _bmad: every module's config, _config/ manifests, and every agent's sanctum under _bmad/memory/ |
--module-code . |
_bmad/. |
same as above |
--module-code .. |
_bmad/.. |
the whole project directory, source code included |
--also-remove ../src |
_bmad/../src |
any folder outside _bmad |
The --skills-dir safety check doesn't help. verify_skills_installed() skips every directory that contains no SKILL.md, so it reports skills_verified: true and removal continues. This is related to #96 (deleting live config dirs) and #121/#136 (validating module codes), but the impact here is total data loss from a single bad argument. The module code reaches this command through a {module-code} substitution done by the scaffolder or the LLM.
Steps to reproduce
C=<bmb>/skills/bmad-bmb-setup/scripts/cleanup-legacy.py
for code in "" "." ".."; do
rm -rf /tmp/p && mkdir -p /tmp/p/_bmad/{bmm,core,memory/my-agent} /tmp/p/src && cd /tmp/p
echo x > _bmad/memory/my-agent/MEMORY.md; echo code > src/app.py
python3 $C --bmad-dir _bmad --module-code "$code" --skills-dir .claude/skills >/dev/null 2>&1
echo "code='$code': _bmad=$([ -d _bmad ] && echo kept || echo DELETED) src/app.py=$([ -f src/app.py ] && echo kept || echo DELETED)"
cd /
done
# code='': _bmad=DELETED src/app.py=kept
# code='.': _bmad=DELETED src/app.py=kept
# code='..': _bmad=DELETED src/app.py=DELETED (whole project removed)
rm -rf /tmp/p && mkdir -p /tmp/p/_bmad/core /tmp/p/src && cd /tmp/p
python3 $C --bmad-dir _bmad --module-code bmb --also-remove ../src # src/ deleted
Expected behavior
- Require
--module-codeand each--also-removevalue to be a single, non-empty, non-dot path segment, e.g.^[A-Za-z0-9_][A-Za-z0-9_.-]*$and not.or... - Resolve each target and refuse anything that is not a strict child of the resolved
--bmad-dir. - Never remove
_bmad/memory/, and never remove a directory the script can't prove is a legacy skill payload (see #96 and #139).
Environment
- Model(s) used: n/a (deterministic script)
- Agentic IDE used: n/a (scripts run directly)
- BMad version: bmad-builder
main@d4a921c(v2.2.2 + #118) - Project language: Python 3.13, Linux
- 主要言語
- Python
- スター
- 220
- フォーク
- 54
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bmad-code-org/bmad-builder のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bmad-code-org/bmad-builder#157 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bmad-code-org/bmad-builder#153 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bmad-code-org/bmad-builder#151 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
bmad-code-org/bmad-builder#127 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
bmad-code-org/bmad-builder#123 ·
bmad-code-org/bmad-builder の issue をすべて見る
似ている issue
-
namespace
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
EclipseFdn/open-vsx.org#15604 ·
メンテナーはふだん 1 日以内に返信
-
app: scripts severity: low status: backlog type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
netbox-community/netbox-scripts#164 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 5 日以内に返信
-
Public function to read participants.tsv対応中かも @bruAristimunha が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
huggingface/tau#799 ·
メンテナーはふだん 2 日以内に返信