T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:55
- Finding
- API Credential Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md:55-59` **Vulnerability Type**: API credential exposure through process arguments **Risk Level**: Medium The documented usage instructs users to expand the MiniMax API key directly into a command-line argument: ```bash python3 scripts/minimax_image_create.py \ --api-key $MINIMAX_API_KEY \ --model image-01 \ --prompt "一只可爱的橘猫" \ --aspect-ratio 16:9 ``` The script explicitly supports receiving the credential through that argument at `scripts/minimax_image_create.py:232-237`: ```python parser.add_argument( "--api-key", type=str, default=os.environ.get("MINIMAX_API_KEY"), help="MiniMax API Key (或设置环境变量 MINIMAX_API_KEY)" ) ``` ### Technical Analysis When the documented command is executed, the shell expands `$MINIMAX_API_KEY` before starting Python. The resulting secret can therefore appear in the process argument vector. Depending on operating-system configuration and local monitoring controls, command-line arguments may be observable through process inspection utilities, `/proc` interfaces, audit systems, crash diagnostics, or endpoint telemetry. Sending the API key to `https://api.minimaxi.com/v1/image_generation` as a Bearer token is necessary for the declared image-generation functionality. The vulnerability is not the authenticated network request itself; it is the unnecessary command-line exposure before the credential reaches the API client. The implementation already supports loading the credential from `MINIMAX_API_KEY`, so passing it as an argument is not required. ### Attack Path 1. A user exports a valid MiniMax API key and follows the documented command. 2. The shell expands `$MINIMAX_API_KEY` into the Python process argument list. 3. A malicious or compromised local process, process-monitoring service, or telemetry collector records the argument list while the command is running. 4. The attacker extracts the Bear ...[truncated 727 chars]
- Remediation
- ## Remediation Suggestions 1. Remove `--api-key $MINIMAX_API_KEY` from every command example. Document invocation without the credential argument: ```bash export MINIMAX_API_KEY="your-api-key" python3 scripts/minimax_image_create.py \ --model image-01 \ --prompt "a requested image" \ --aspect-ratio 16:9 ``` 2. Prefer removing the `--api-key` option entirely and accept the secret only through `MINIMAX_API_KEY` or a protected secret-management integration. 3. If an explicit input mechanism is required, read the credential from protected standard input without echoing it rather than placing it in the argument vector. 4. Ensure errors and diagnostic logging never include request headers or the complete API key. 5. Advise users who previously used the documented argument form to review process telemetry exposure and rotate potentially disclosed keys.
