T09 · Insecure Skill Coding Practices
- Location
scripts/backup-and-push.mjs:16- Finding
Git synchronization exports raw OpenClaw credentials by default
- Content
View full analysis
Vulnerability Details
File Location:
scripts/backup-and-push.mjs:16-21, 88-112;scripts/backup.mjs:214-226
Vulnerability Type: Sensitive data exposure through an unsafe backup default
Risk Level: HighVulnerable Code
js const options = { branch: 'main', remote: 'clawlite-backup', message: null, rawOpenClawConfig: true };js function main() { const backupArgs = ['scripts/backup.mjs']; if (options.rawOpenClawConfig) backupArgs.push('--raw-openclaw-config'); console.log('🔍 Creating backup before git push...'); run('node', backupArgs, { cwd: SKILL_ROOT }); const latest = latestBackupDir(); console.log(`✅ Latest backup: ${latest}`); const remoteUrl = run('git', ['remote', 'get-url', options.remote], { cwd: SKILL_ROOT }); ensureBackupRepo(remoteUrl); syncBackupsIntoRepo(); run('git', ['add', 'backups'], { cwd: BACKUP_REPO_DIR }); const status = run('git', ['status', '--short', 'backups'], { cwd: BACKUP_REPO_DIR }); if (!status) { console.log('ℹ️ No backup changes to commit.'); return; } const message = options.message || `backup: ${latest}`; run('git', ['commit', '-m', message], { cwd: BACKUP_REPO_DIR }); run('git', ['push', 'origin', options.branch], { cwd: BACKUP_REPO_DIR }); }js if (options.rawOpenClawConfig) { const size = backupFile({ sourcePath: openclawJsonPath, backupRelativePath: 'openclaw.json', manifest, backupPath, restoreTo: 'openclaw_root' }); manifest.files['openclaw.json'].raw = true; manifest.files['openclaw.json'].original = '~/.openclaw/openclaw.json'; }Technical Analysis
The Git synchronization command initializes
rawOpenClawConfigtotrue. Consequently, runningbackup-and-push.mjswithout the opt-out flag automatically invokesbackup.mjs --raw-openclaw-config.Raw mode copies
~/.openclaw/openclaw.json...[truncated 1666 chars]- Remediation
View remediation
Remediation Suggestions
- Change
rawOpenClawConfigtofalseby default. - Require an explicit
--raw-openclaw-configoption for each raw export. - Require interactive confirmation before committing raw configuration, with a clearly named override for unattended execution.
- Encrypt raw configuration before placing it in Git-backed storage.
- Add secret scanning before
git commitand abort if likely credentials are detected. - Exclude
openclaw.jsonthrough repository-level ignore and pre-commit controls unless an encrypted workflow is explicitly enabled. - Clearly state that repository privacy cannot be assumed or reliably inferred by the script.
- If exposure has already occurred, revoke affected credentials and rewrite repository history rather than merely deleting the file in a new commit.
- Change
