T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/git-auto-push.sh:6
- Finding
- Unrestricted Workspace Content Is Automatically Committed and Uploaded<![CDATA[ ## Vulnerability Details **File Location**: `scripts/git-auto-push.sh`, lines 6-29 **Vulnerability Type**: Overly broad file collection and external transmission **Risk Level**: High ### Vulnerable Code ```bash cd /home/admin/.openclaw/workspace LOG_FILE="/home/admin/.openclaw/logs/git-auto-push.log" log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE" } # Check whether changes exist if git diff --quiet && git diff --cached --quiet; then exit 0 fi log "Changes detected; starting commit..." # Stage every change git add -A # Commit COMMIT_MSG="auto: $(date '+%Y-%m-%d %H:%M')" git commit -m "$COMMIT_MSG" --no-verify 2>&1 | tee -a "$LOG_FILE" # Upload log "Pushing to Gitee..." git push origin main 2>&1 | tee -a "$LOG_FILE" ``` ### Technical Analysis The script operates on the entire `/home/admin/.openclaw/workspace` repository and invokes `git add -A`, which stages every tracked and untracked change not excluded by Git configuration. It does not restrict collection to the six synchronization directories documented by the Skill. There is no validation of `.gitignore`, no sensitive-file denylist, no secret scanning, no remote URL verification, and no confirmation before transmission. The use of `--no-verify` also bypasses local commit hooks that might otherwise enforce security checks. When combined with the documented five-minute cron schedule, any sensitive file introduced into the repository can be committed and transmitted automatically. ### Attack Path 1. A credential, API key, private note, configuration file, agent memory file, or generated secret is created anywhere in the workspace repository. 2. The file is not excluded by the repository's current Git ignore rules. 3. The scheduled script detects a repository change. 4. `git add -A` stages the sensitive file. 5. `git commit --no-verify` bypasses local commit verification hooks. 6. `git push origin main` uploads the content to the configured remote. 7. Anyone ...[truncated 724 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace `git add -A` with an explicit allowlist of approved synchronization paths. 2. Verify that staged paths remain under the intended workspace directories before committing. 3. Run a secret scanner against staged content and abort on credentials, private keys, tokens, or sensitive configuration. 4. Do not use `--no-verify`; preserve repository security and policy hooks. 5. Validate and display the Git remote URL before enabling scheduled uploads. 6. Require explicit user approval during initial setup and clearly disclose which directories will be uploaded. 7. Provide a dry-run mode that lists files that would be staged and transmitted. 8. Document required `.gitignore` rules, but do not rely on ignore rules as the sole security boundary. 9. Use narrowly scoped Git credentials with access only to the intended repository. ]]>
