T09 · Insecure Skill Coding Practices
- Location
scripts/sync-memory-to-github.sh:91- Finding
Overbroad Git Synchronization Can Expose the Entire OpenClaw Workspace
- Content
View full analysis
/dev/null || echo "无变更" # 推送并捕获结果 push_result=0 git push memory main 2>&1 || { log "⚠️ 推送失败,尝试先拉取..." git pull --rebase memory main 2>/dev/null || push_result=1 if [ $push_result -eq 0 ]; then git push memory main 2>/dev/null || push_result=1 fi } ``` ### Technical Analysis The script changes into `~/.openclaw/workspace` and runs `git add -A`. This command stages all tracked changes, deletions, and untracked files within the Git working tree rather than limiting synchronization to the declared memory files. The staged content is committed and pushed to the user-configured `memory` remote. Consequently, unrelated files under the workspace—including configuration files, logs, other Skills, project data, session state, or accidentally stored credentials—can be transferred to the remote repository. The Skill describes this operation as memory synchronization, so using the entire workspace as the synchronization boundary exceeds the minimum data access required for the declared functionality. A private Git repository does not eliminate the risk because its collaborators, a compromised repository account, or an incorrectly configured remote may still receive the data. Committed secrets may also remain recoverable from Git history after deletion from the current branch. ### Attack Path 1. The workspace is initialized as a Git repository with a remote named `memory`. 2. A sensitive or unrelated file is created or modified anywhere under `~/.openclaw/workspace`. 3. The user invokes the synchronization script manually or enables the documented daily cron task. 4. `git add -A` stages the unrelated file along wit ...[truncated 1200 chars]- Remediation
View remediation
&2 exit 1 fi ``` 5. Validate and display the `memory` remote URL during setup and before the first push. Require explicit user confirmation so an incorrectly configured destination is detectable. 6. Document exactly which files are uploaded and warn users that memory records may contain sensitive conversation data. 7. If sensitive files have already been committed, rotate exposed credentials, remove the files from Git history using an appropriate history-rewriting tool, force-push the sanitized history, and notify repository collaborators. ]]>
