T09 · Insecure Skill Coding Practices
Warning
- Location
- config-tracker.js:31
- Finding
- Automatic Git Versioning Persistently Retains Sensitive Configuration and Agent Data<![CDATA[ ## Vulnerability Details **File Location**: `config-tracker.js:31-41` and `config-tracker.js:318-361` **Vulnerability Type**: Sensitive-data retention in Git history **Risk Level**: Medium ### Vulnerable Code ```js const DEFAULT_CONFIG = { enabled: true, workspaceFiles: [ "AGENTS.md", "USER.md", "SOUL.md", "MEMORY.md", "TOOLS.md", "HEARTBEAT.md", "IDENTITY.md" ], openclawConfig: "~/.openclaw/openclaw.json", commitMessagePrefix: "auto: track config changes", gitUserName: "OpenClaw Bot", gitUserEmail: "openclaw@localhost" }; ``` ```js async checkAndCommit(workspaceDir) { // Get workspace absolute path const workspacePath = path.resolve(workspaceDir); // 1. Track workspace markdown files const workspaceFiles = this.config.workspaceFiles.map(f => path.join(workspacePath, f)); const existingWorkspaceFiles = await Promise.all( workspaceFiles.map(async (f) => ({ path: f, exists: await fileExists(f) })) ); const validWorkspaceFiles = existingWorkspaceFiles .filter(f => f.exists) .map(f => f.path); if (validWorkspaceFiles.length > 0) { // Ensure git repo exists for workspace await initGitRepo(workspacePath, this.config); const changedWorkspaceFiles = await hasChanges(workspacePath, validWorkspaceFiles); if (changedWorkspaceFiles.length > 0) { await commitChanges(workspacePath, changedWorkspaceFiles, this.config); } } // 2. Track openclaw.json const openclawConfigPath = expandTilde(this.config.openclawConfig); const openclawDir = path.dirname(openclawConfigPath); if (await fileExists(openclawConfigPath)) { // Ensure git repo exists for ~/.openclaw/ await initGitRepo(openclawDir, this.config); const changedConfigFiles = await hasChanges(openclawDir, [openclawConfigPath]); if (changedConfigFiles.length > 0) { await commitChanges(openclawDir, changedConfigFiles, this.config); } } } ``` ### Technical Analys ...[truncated 2302 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not track `openclaw.json`, user records, memory files, or tool configuration by default. Require explicit per-file opt-in. 2. Add secret scanning before staging. Reject commits containing credential patterns such as API keys, bearer tokens, private keys, passwords, and connection strings. 3. Support configurable redaction rules and allow users to maintain an exclusion list for sensitive fields and files. 4. Display a clear warning that Git history retains deleted values and obtain explicit consent before initializing repositories or enabling automatic commits. 5. Consider storing sanitized snapshots in a dedicated repository rather than initializing Git inside live configuration directories. 6. Restrict permissions on generated `.git` directories and ensure backup or synchronization systems do not publish them unintentionally. 7. Document incident-response procedures for revoking exposed credentials and securely rewriting history with tools such as `git filter-repo`. 8. If sensitive versioning is required, encrypt repository contents using a suitable secret-management or encrypted-storage mechanism rather than relying on plain Git objects. ]]>
