T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/backup.sh:181
- Finding
- Unencrypted operational backups can expose sensitive workspace data to GitHub<![CDATA[ ## Vulnerability Details **File Location**: `scripts/backup.sh:181-190`, with the upload path in `scripts/push-to-github.sh:127-141` **Vulnerability Type**: Sensitive data exposure caused by overbroad backup scope and inadequate secret detection **Risk Level**: High ### Vulnerable Code ```bash copy_dir "$OPENCLAW_DIR/workspace" "$OP_STAGE/openclaw/workspace" "workspace/" if [ -f "$OPENCLAW_DIR/openclaw.json" ]; then mkdir -p "$OP_STAGE/openclaw" redact_openclaw_json "$OPENCLAW_DIR/openclaw.json" "$OP_STAGE/openclaw/openclaw.json" record_file "openclaw.json (redacted)" info "Added: openclaw.json (redacted)" else warn "Missing file, skipped: $OPENCLAW_DIR/openclaw.json" fi copy_file "$OPENCLAW_DIR/cron/jobs.json" "$OP_STAGE/openclaw/cron/jobs.json" "cron/jobs.json" ``` The resulting archive is copied into a Git repository and pushed: ```bash cp "$ARCHIVE_PATH" "$REPO_DIR/archives/$(basename "$ARCHIVE_PATH")" cp "$MANIFEST_PATH" "$REPO_DIR/archives/$(basename "$MANIFEST_PATH")" if [ -n "$SECRETS_PATH" ]; then cp "$SECRETS_PATH" "$REPO_DIR/archives/$(basename "$SECRETS_PATH")" fi ( cd "$REPO_DIR" git add .gitignore archives/* if git diff --cached --quiet; then info "No changes to commit." else git commit -m "Backup $(basename "$ARCHIVE_PATH")" >/dev/null git push origin HEAD >/dev/null info "Pushed backup to $REMOTE" fi ) ``` ### Technical Analysis The backup process recursively copies the entire OpenClaw workspace into an unencrypted operational archive. Only `openclaw.json` is passed through the key-name-based redaction routine. No exclusion or content-scanning logic is applied to the workspace. Consequently, the operational archive may contain: - `.env` files located below the workspace - Private keys or credential exports - API tokens embedded in scripts or configuration files - Personal information in `MEMORY.md` and daily memory files - Private Git repository metadata and remote URLs - Authentication dat ...[truncated 1914 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not classify the operational archive as cloud-safe by default. 2. Encrypt the complete backup archive before any cloud transfer, not only the known secrets tier. 3. Add deny-list exclusions for at least: - `.env` and `.env.*` - Private keys and certificates - Credential and token files - `.git/` directories - Package caches and `node_modules` - Configurable operator-defined sensitive paths 4. Add content scanning for common token, key, password, and private-key patterns before creating or uploading an operational archive. 5. Fail closed when potential secrets are detected and require explicit operator review. 6. Provide an allow-list mode that backs up only specifically documented operational files. 7. Display a file inventory and sensitive-data warning before an upload. 8. Add automated tests proving that workspace-resident `.env` files, private keys, and token fixtures are not included in cloud-bound archives. ]]>
