T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:60
- Finding
- Application Secret Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md:60-64`; supporting implementation at `lark_wiki_writer.py:433-436` **Vulnerability Type**: Application secret exposure through process arguments and command history **Risk Level**: Medium ### Vulnerable Code ```bash python3 lark_wiki_writer.py validate \ --app-id YOUR_APP_ID \ --app-secret YOUR_APP_SECRET \ --space-id YOUR_SPACE_ID ``` The implementation explicitly accepts the secret as a command-line argument: ```python parser.add_argument('--app-id', help='飞书应用 ID') parser.add_argument('--app-secret', help='飞书应用密钥') parser.add_argument('--space-id', help='知识库 Space ID') parser.add_argument('--wiki-domain', help='飞书域名') ``` ### Technical Analysis The documented invocation places a reusable Lark App Secret directly in the process argument vector. Depending on the host configuration, command-line arguments may be exposed through: - Shell history files. - Process inspection utilities and operating-system process interfaces. - CI/CD logs and job metadata. - Terminal session recording. - Monitoring, endpoint security, and observability agents. - Wrapper scripts that record invoked commands. The program does not print the secret itself, but avoiding output does not protect it from these process-level disclosure channels. Environment variables are already supported and present a more appropriate interface when populated through a secret manager, although environment variables must also be protected from logging and unauthorized process access. ### Attack Path 1. A user follows the documented command and supplies the real App Secret using `--app-secret`. 2. The command is retained in shell history, automation logs, process telemetry, or a process inspection interface. 3. A local account, monitoring-system user, CI log reader, or other party with access to that data retrieves the App ID and App Secret. 4. The attacker submits those credenti ...[truncated 876 chars]
- Remediation
- ## Remediation Suggestions 1. Remove `--app-secret` from recommended commands and examples. 2. Prefer a dedicated secret manager that injects `LARK_APP_SECRET` only into the target process. 3. For interactive use, support hidden input through Python's `getpass` module. 4. If command-line secret input must remain for compatibility, mark it as deprecated and display a clear warning that it can leak through history and process inspection. 5. Ensure CI/CD systems mask the secret and do not echo generated commands. 6. Document immediate App Secret rotation procedures for suspected exposure. 7. Grant the associated Lark application only the minimum API scopes necessary for document creation and block insertion.
