T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/run.py:122
- Finding
- API Credential Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/run.py:122-126` **Vulnerability Type**: Command-line secret exposure **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument( "--appkey", required=True, help="内部医疗大模型鉴权 key。", ) ``` The documented invocation in `SKILL.md:31` reinforces this insecure usage: ```bash python3 scripts/run.py --input input.json --output output.json --appkey YOUR_KEY ``` ### Technical Analysis The application requires the Hivoice API credential to be supplied as a command-line argument. Command-line arguments are not a secure secret-delivery mechanism because they may be recorded in: - Shell history files - Process listings and process-monitoring systems - Job scheduler metadata - CI/CD execution logs - Terminal session recordings - Diagnostic and observability platforms Exposure depends on the host operating system and its process-access controls. The code does not hardcode the key or intentionally transmit it anywhere other than the documented API endpoint, but its delivery mechanism unnecessarily increases the risk of credential disclosure. ### Attack Path 1. A legitimate user invokes the skill using the documented `--appkey` argument. 2. The operating environment records the full command in shell history, process metadata, CI logs, or monitoring output. 3. A local user, administrator, support operator, or party with access to those logs retrieves the API key. 4. The exposed key is submitted as a bearer token to the configured Hivoice API endpoint. 5. The attacker makes unauthorized requests within the permissions and quota assigned to that credential. ### Impact Assessment Successful exploitation exposes the API credential used for the internal medical model. An attacker may consume API quota, incur service costs, access model functionality under the victim's identity, or cause service disruption through quota exhaustion. T ...[truncated 266 chars]
- Remediation
- ## Remediation Suggestions - Remove the required `--appkey` command-line option. - Read the credential from a protected environment variable, operating-system credential store, or dedicated secret manager. - If a secret file is supported, require restrictive file permissions and avoid including its contents in logs. - For interactive use, optionally accept the key through a non-echoing prompt. - Update `SKILL.md` so examples never encourage placing credentials directly in command arguments. - Redact authorization data from application, proxy, CI/CD, and observability logs. - Rotate any key that may already have appeared in process telemetry or command history. A safer environment-variable pattern would be: ```python import os appkey = os.environ.get("HIVOICE_APPKEY") if not appkey: raise ValueError("HIVOICE_APPKEY is required") ```
