T09 · Insecure Skill Coding Practices
Error
- Location
- index.js:66
- Finding
- Feishu App Secret Exposed Through Process Arguments and Terminal Output<![CDATA[ ## Vulnerability Details **File Location**: `index.js:66-75` **Vulnerability Type**: Plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```js console.log(`\n${colors.bold}--- 飞书机器人配置片段 ---${colors.reset}`); console.log(`${colors.cyan}将以下内容添加到您的 ~/.openclaw/openclaw.json 文件中相应位置。${colors.reset}`); log.step(1, 3, `在 "channels": {"feishu": {"accounts": {}}} 中添加账户配置`); console.log(`\`\`\`json "${generatedAccountId}": { "appId": "${appid}", "appSecret": "${appsecret}", "botName": "${resolvedBotName}", "dmPolicy": "${resolvedDmPolicy}", "allowFrom": ["*"], "enabled": true }\`\`\``); ``` The CLI also instructs users to pass the secret as a command-line argument: ```js console.log(`${colors.bold}选项:${colors.reset}\n --app-id <id> 飞书应用的 App ID (必填)\n --app-secret <secret> 飞书应用的 App Secret (必填)\n --account-id <id> 为该飞书账户生成一个自定义标识 (可选, 默认自动生成)\n --bot-name <name> 机器人名称 (可选, 默认: "飞书机器人")\n --dm-policy <policy> DM 消息处理策略: open/pairing/allowlist (可选, 默认: open)\n --agent-id <id> 要绑定的 Agent ID (可选)\n --chat-id <id> 飞书群聊 ID (oc_xxx 格式), 在群聊绑定模式下必填\n --routing-mode <mode> 路由模式: account (账户级) / group (群聊级) (可选, 默认: account)\n --help 显示帮助信息\n`); ``` ### Technical Analysis The Feishu App Secret is accepted directly through `process.argv` and then printed in plaintext as part of the generated configuration fragment. Sensitive values passed on a command line may be exposed through: - Shell history files. - Process inspection utilities while the command is running. - Terminal scrollback and session recording. - CI/CD logs or automation output. - Support transcripts and copied configuration previews. Printing the complete secret creates an additional disclosure channel even when process arguments are otherwise protected. ### Attack Path 1. A user follows the documented usage and runs the helper with `--app-secret`. 2. The shell records the command, includ ...[truncated 931 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not require secrets to be supplied directly as command-line arguments. - Read the App Secret through a masked interactive prompt, standard input, a protected file descriptor, or a dedicated secret manager. - If environment-variable input is supported, document that environment exposure must be controlled and avoid logging the environment. - Redact the secret in previews, showing only a short suffix if confirmation is necessary. - Provide an option to write the configuration directly to a securely permissioned file without echoing the secret. - Ensure any generated file containing credentials is created with restrictive permissions, such as owner read/write only. - Add automated tests that verify secrets never appear in stdout, stderr, error messages, or debug logs. - Warn users to rotate credentials if they have already passed them through recorded shells or CI systems. ]]>
