T09 · Insecure Skill Coding Practices
- Location
shiploop/git_ops.py:160- Finding
Automatic Meta-Loop Cleanup Can Permanently Delete Uncommitted Work
- Content
View full analysis
None: await run_git(["checkout", "--", "."], cwd, check=False) await run_git(["clean", "-fd"], cwd, check=False) ``` ```python # shiploop/loops/meta.py:44-56 async def run_meta_loop( config: ShipLoopConfig, segment_name: str, segment_prompt: str, all_errors: list[str], reporter: Reporter, budget: BudgetTracker, learnings: LearningsEngine, ) -> MetaResult: repo = Path(config.repo) meta_config = config.meta num_experiments = meta_config.experiments if not meta_config.enabled: reporter._print(" Meta loop disabled — segment failed") return MetaResult(success=False) reporter.meta_start() await discard_changes(repo) ``` ```bash # scripts/meta-experiment.sh:64-68 # Create experiment branch # -------------------------------------------------------------------------- # Clean working tree (caller already discarded failed changes, but be safe) git checkout -- . 2>/dev/null || true git clean -fd 2>/dev/null || true ``` ### Technical Analysis `git checkout -- .` discards modifications to tracked files, while `git clean -fd` permanently deletes all untracked, non-ignored files and directories beneath the repository. The cleanup is performed directly against the operator-configured repository before meta experiments are isolated in worktrees. No clean-tree precondition, interactive confirmation, backup, stash, path restriction, or dry-run validation protects unrelated user work. The commands also use `check=False` or suppress errors, making it difficult for the caller to distinguish complete c ...[truncated 1753 chars]- Remediation
View remediation
