T09 · Insecure Skill Coding Practices
- Location
scripts/upsert_openclaw_agent.py:155- Finding
Feishu Application Secret Exposure Through Process Arguments and JSON Output
- Content
View full analysis
\ --routing-mode \ [--account-id ] \ [--app-id ] \ [--app-secret ] \ [--bot-name ] \ [--peer-kind ] \ [--peer-id ] ``` `scripts/upsert_openclaw_agent.py:155-167`: ```python before = copy.deepcopy(existing) if args.app_id: existing["appId"] = args.app_id if args.app_secret: existing["appSecret"] = args.app_secret if args.bot_name: existing["botName"] = args.bot_name summary["channelAccount"] = { "status": status, "accountId": args.account_id, "before": before, "after": copy.deepcopy(existing), } ``` `scripts/upsert_openclaw_agent.py:258`: ```python print(json.dumps(summary, indent=2, ensure_ascii=False)) ``` ### Technical Analysis The documented workflow passes `app_secret` as a command-line argument. Command-line secrets may be recorded in shell history, Agent transcripts, process-monitoring systems, audit logs, or process listings available to other local users while the command is running. The script then copies the complete account object into both the `before` and `after` summary fields. Because account objects can contain `appSecret`, line 258 serializes the credential to standard output. This leaks both newly supplied credentials and credentials that were already present in the OpenClaw configuration. Backups produced by the workflow legitimately retain the configuration secret, but the additional disclosure through process arguments and standard output unnecessarily expands the number of locations in which the secret may persist. ### Attack Path 1. A user supplies a Feishu ` ...[truncated 1236 chars]- Remediation
View remediation
` from command examples and provide a non-echoing input mechanism, such as Python's `getpass.getpass()`. 3. Never include complete account objects in status output. Report only non-sensitive metadata and changed field names, for example: ```python summary["channelAccount"] = { "status": status, "accountId": args.account_id, "changedFields": changed_fields, } ``` 4. Add recursive output redaction as a defense-in-depth measure. Keys such as `appSecret`, `secret`, `token`, `password`, and `authorization` should be replaced with a fixed value such as `"***REDACTED***"` before serialization. 5. Review existing shell history, Agent transcripts, CI output, and operational logs for leaked secrets. Rotate any Feishu application secret that may already have been exposed. 6. Preserve restrictive file permissions when writing the configuration and backups, and document secure deletion or retention requirements for obsolete backups. ]]>
