T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/send-voice.mjs:20
- Finding
- Feishu app secret exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/send-voice.mjs:20-28, 62-63`; `scripts/send-video.mjs:22-30, 70-71`; `SKILL.md:49-57`; `README.md:39-47, 51-58` **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code From `scripts/send-voice.mjs:20-28`: ```javascript const { values: args } = parseArgs({ options: { 'app-id': { type: 'string' }, 'app-secret': { type: 'string' }, 'user-id': { type: 'string' }, 'chat-id': { type: 'string' }, 'audio-file': { type: 'string' }, 'duration': { type: 'string' }, 'help': { type: 'boolean', short: 'h' } } }); ``` From `scripts/send-voice.mjs:62-63`: ```javascript const APP_ID = args['app-id'] || process.env.FEISHU_APP_ID; const APP_SECRET = args['app-secret'] || process.env.FEISHU_APP_SECRET; ``` The same pattern occurs in `scripts/send-video.mjs:22-30, 70-71`. The documentation actively demonstrates passing the secret as an argument. For example, `SKILL.md:49-57` contains: ```bash node scripts/send-voice.mjs \ --app-id "cli_xxx" \ --app-secret "xxx" \ --user-id "ou_xxx" \ --audio-file "audio.opus" \ --duration 3480 ``` ### Technical Analysis Command-line arguments are not an appropriate channel for long-lived application secrets. Depending on the operating system and execution environment, arguments can be recorded or exposed through: - Shell history files - Process-listing and monitoring tools - CI/CD job logs - Agent tool-call or execution logs - Terminal session recording - Debugging and telemetry systems Although the scripts also support `FEISHU_APP_SECRET`, the CLI option remains enabled and is promoted in the primary usage examples. This makes accidental credential exposure likely during ordinary documented use. The secret is transmitted only to Feishu's declared HTTPS authentication endpoint, which is necessary for the Skill's opera ...[truncated 1619 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the `--app-secret` command-line option from both message-sending scripts. 2. Remove all examples that place secrets directly in command lines. 3. Prefer a dedicated secret manager supplied by the deployment environment. 4. If secret-manager integration is unavailable, read the secret from hidden standard input or a protected file descriptor. 5. Environment variables may be retained as a compatibility mechanism, but operators should be warned that some process-management and diagnostic environments can capture them. 6. Ensure execution systems redact `FEISHU_APP_SECRET` and tenant tokens from logs and traces. 7. Apply minimum Feishu application scopes needed for media upload and bot message delivery. 8. Rotate the existing app secret if real credentials have previously been entered using the documented command-line form. 9. Add automated tests or linting rules that reject examples containing `--app-secret`. ]]>
