T09 · Insecure Skill Coding Practices
- Location
page-generator/scripts/tpf-cli.py:192- Finding
GitHub Pages deployment destructively modifies the active Git working tree
- Content
View full analysis
- Remediation
View remediation
``` Alternatively, use a dedicated temporary Git repository containing only the generated artifacts. 2. Never run `git rm -rf .` in the primary working tree. 3. Check repository status before deployment: ```bash git status --porcelain ``` Refuse deployment when local changes exist unless the user explicitly selects a safe override. 4. Copy and stage only allowlisted artifacts, such as: - `index.html` - `trip-data.json` - Explicitly required static assets 5. Avoid `git add .`; pass exact artifact paths to `git add`. 6. Display the resolved remote URL, branch, and files to be published, then require explicit confirmation before pushing. 7. Use `check=True` for restoration operations and report restoration failures prominently. 8. Add a dry-run mode that reports all Git and filesystem changes without modifying the repository. 9. Preserve and clean up temporary worktrees in a guarded `finally` block without altering the caller's checked-out branch. ]]>
