T09 · Insecure Skill Coding Practices
- Location
references/failure-patterns.md:482- Finding
Authentication Tokens Can Be Printed and Disclosed Through Support Artifacts
- Content
View full analysis
"; const l=fs.readFileSync(p,"utf8").split("\n").find(l=>l.startsWith("export =")); console.log(JSON.stringify(l))' ``` - a clean line has a single shell-quoted token value with no inner literal double quotes - a corrupted line has literal `"` characters just inside the shell quotes - check every `*_TOKEN` / `*_API_KEY` line in the env file the same way; the same writer emits all of them Recovery: - back up the env file: `cp .bak-token-fix-` - rewrite the affected lines using the value from `secrets.json` (which is the canonical clean value), shell-single-quoted with no inner JSON wrapping; only safe if the secret itself contains no single quotes (almost always the case for API tokens) - restart the gateway through the host service manager - re-run `openclaw channels status --deep` and confirm the channel reconnects Why it matters: - this is a packaging defect in the env-file writer, not operator drift; the local fix is fragile because the next regeneration will re-corrupt the file - share upstream or with support: exact line bytes, the source `secrets.json` value type (string), and the affected host version ``` A related command directly prints the configured Discord token: ```text - To disambiguate, inspect the actual config field directly: - `node -e 'const c=JSON.parse(require("fs").readFileSync(process.env.HOME+"/.openclaw/openclaw.json","utf8")); console.log(typeof c.channels?.discord?.token, c.channels?.discord?.token)'` ``` ### Technical Analysis ...[truncated 2630 chars]- Remediation
View remediation
' outer shell quotes: present inner literal double quotes: present source value type: string ``` 5. Add an explicit warning that command output generated by older versions of the runbook may contain live credentials and must not be uploaded or pasted into reports. 6. If a token has already appeared in an Agent transcript, terminal recording, support ticket, or other external artifact: - Revoke and rotate it. - Remove the artifact where possible. - Review channel or API logs for unauthorized use. - Update the sanitized handoff notes with the rotation time, but not the replacement value. ]]>
