T09 · Insecure Skill Coding Practices
- Location
SKILL.md:60- Finding
Application Secret Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:60-64; supporting implementation atlark_wiki_writer.py:433-436
Vulnerability Type: Application secret exposure through process arguments and command history
Risk Level: MediumVulnerable Code
bash python3 lark_wiki_writer.py validate \ --app-id YOUR_APP_ID \ --app-secret YOUR_APP_SECRET \ --space-id YOUR_SPACE_IDThe 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
- A user follows the documented command and supplies the real App Secret using
--app-secret. - The command is retained in shell history, automation logs, process telemetry, or a process inspection interface.
- A local account, monitoring-system user, CI log reader, or other party with access to that data retrieves the App ID and App Secret.
- The attacker submits those credenti ...[truncated 876 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--app-secretfrom recommended commands and examples. - Prefer a dedicated secret manager that injects
LARK_APP_SECRETonly into the target process. - For interactive use, support hidden input through Python's
getpassmodule. - 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.
- Ensure CI/CD systems mask the secret and do not echo generated commands.
- Document immediate App Secret rotation procedures for suspected exposure.
- Grant the associated Lark application only the minimum API scopes necessary for document creation and block insertion.
- Remove
